Merged
Conversation
…d a long lost assertion This reverts part of commit 9712fa4.
Co-Authored-By: Ralf Jung <post@ralfj.de>
This commit modifies the use of `subst_and_normalize_erasing_regions` on parts of the MIR bodies returned from `instance_mir`, so that `InstanceDef::CloneShim` and `InstanceDef::DropGlue` (where there is a type) do not perform substitutions. This avoids double substitutions and enables polymorphic `InstanceDef`s. Signed-off-by: David Wood <david@davidtw.co>
Fixes rust-lang#55099 The minimized reproducer in issue rust-lang#55099 now compiles successfully. This commit adds a regression test for it.
patch is required to avoid compiler errors by building src/libpanic_unwind/hermit.rs
As discussed on reddit, this commit addresses two issues with the documentation of `mem::forget()`: * The documentation of `mem::forget()` can confuse the reader because of the discrepancy between usage examples that show correct usage and the accompanying text which speaks of the possibility of double-free. The text that says "if the panic occurs before `mem::forget` was called" refers to a variant of the second example that was never shown, modified to use `mem::forget` instead of `ManuallyDrop`. Ideally the documentation should show both variants, so it's clear what it's talking about. Also, the double free could be fixed just by placing `mem::forget(v)` before the construction of `s`. Since the lifetimes of `s` and `v` wouldn't overlap, there would be no point where panic could cause a double free. This could be mentioned, and contrasted against the more robust fix of using `ManuallyDrop`. * This sentence seems unjustified: "For some types, operations such as passing ownership (to a funcion like `mem::forget`) requires them to actually be fully owned right now [...]". Unlike C++, Rust has no move constructors, its moves are (possibly elided) bitwise copies. Even if you pass an invalid object to `mem::forget`, no harm should come to pass because `mem::forget` consumes the object and exists solely to prevent drop, so there no one left to observe the invalid state state.
…m::forget. As pointed out by Ralf Jung, dangling references and boxes are undefined behavior as per https://doc.rust-lang.org/reference/behavior-considered-undefined.html and the Miri checker.
Co-Authored-By: Ralf Jung <post@ralfj.de>
Co-Authored-By: lzutao <taolzu@gmail.com>
Clarify the relationship between `forget()` and `ManuallyDrop`. As discussed on reddit, this commit addresses two issues with the documentation of `mem::forget()`: * The documentation of `mem::forget()` can confuse the reader because of the discrepancy between usage examples that show correct usage and the accompanying text which speaks of the possibility of double-free. The text that says "if the panic occurs before `mem::forget` was called" refers to a variant of the second example that was never shown, modified to use `mem::forget` instead of `ManuallyDrop`. Ideally the documentation should show both variants, so it's clear what it's talking about. Also, the double free could be fixed just by placing `mem::forget(v)` before the construction of `s`. Since the lifetimes of `s` and `v` wouldn't overlap, there would be no point where panic could cause a double free. This could be mentioned, and contrasted against the more robust fix of using `ManuallyDrop`. * This sentence seems unjustified: "For some types, operations such as passing ownership (to a funcion like `mem::forget`) requires them to actually be fully owned right now [...]". Unlike C++, Rust has no move constructors, its moves are (possibly elided) bitwise copies. Even if you pass an invalid object to `mem::forget`, no harm should come to pass because `mem::forget` consumes the object and exists solely to prevent drop, so there no one left to observe the invalid state state.
…lfJung Compute the correct layout for variants of uninhabited enums r? @eddyb cc @RalfJung fixes rust-lang#69191 cc rust-lang#69763
codegen/mir: support polymorphic `InstanceDef`s cc rust-lang#69925 This PR modifies the use of `subst_and_normalize_erasing_regions` on parts of the MIR bodies returned from `instance_mir`, so that `InstanceDef::CloneShim` and `InstanceDef::DropGlue` (where there is a type) do not perform substitutions. This avoids double substitutions and enables polymorphic `InstanceDef`s. r? @eddyb cc @nikomatsakis
…an-DPC Clean up E0437 explanation r? @Dylan-DPC
…ikomatsakis Add regression test for TAIT lifetime inference (issue rust-lang#55099) Fixes rust-lang#55099 The minimized reproducer in issue rust-lang#55099 now compiles successfully. This commit adds a regression test for it.
…atsakis remove unused imports patch is required to avoid compiler errors by building src/libpanic_unwind/hermit.rs
doc: Add quote to .init_array The current formatting is not good without quotes: 
…an-DPC Clean up e0438 explanation r? @Dylan-DPC
…rk-Simulacrum triagebot.toml: accept cleanup-crew r? @Mark-Simulacrum
Member
Author
|
@bors r+ p=9 rollup=never |
Collaborator
|
📌 Commit 43c7a50 has been approved by |
Collaborator
|
⌛ Testing commit 43c7a50 with merge 547a95a3cd8d194643781a20ea37b96a36819445... |
Member
Author
|
Hm, failed in @bors retry |
Collaborator
|
⌛ Testing commit 43c7a50 with merge fa81648701f90b92034bf9e5ecbcf48aaf5c2e5c... |
Collaborator
|
💥 Test timed out |
Contributor
|
@bors retry |
Collaborator
|
⌛ Testing commit 43c7a50 with merge fbafce24329e954b672e5c8a5ffb5dbd39e007c9... |
Member
Author
|
Well, the above failure occurs again. |
Collaborator
|
💔 Test failed - checks-azure |
Member
Author
|
@bors retry |
Collaborator
Collaborator
|
☀️ Test successful - checks-azure |
This was referenced Mar 20, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
forget()andManuallyDrop. #69618 (Clarify the relationship betweenforget()andManuallyDrop.)InstanceDefs #69935 (codegen/mir: support polymorphicInstanceDefs)Failed merges:
r? @ghost