Fix trans coercions of Box<[T]> and Box<Trait> in match arms#21692
Merged
bors merged 3 commits intorust-lang:masterfrom Jan 30, 2015
Merged
Fix trans coercions of Box<[T]> and Box<Trait> in match arms#21692bors merged 3 commits intorust-lang:masterfrom
bors merged 3 commits intorust-lang:masterfrom
Conversation
…s original L-/R-value state. This fixes a subtle issue where temporaries were being allocated (but not necessarily initialized) to the (parent) terminating scope of a match expression; in particular, the code to zero out the temporary emitted by `datum.store_to` is only attached to the particular match-arm for that temporary, but when going down other arms of the match expression, the temporary may falsely appear to have been initialized, depending on what the stack held at that location, and thus may have its destructor erroneously run at the end of the terminating scope. Test cases to appear in a follow-up commit. Fix rust-lang#20055
Note that I have not yet managed to expose any bug in `trans::expr::into_fat_ptr`; it would be good to try to do so (or show that the use of `.to_lvalue_datum` there is sound).
Contributor
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
Member
This was referenced Jan 27, 2015
Fix the issue-20055-box-trait.rs test to actually test `Box<Trait>`. Fix rust-lang#21695.
Contributor
Author
bors
added a commit
that referenced
this pull request
Jan 29, 2015
trans: When coercing to `Box<Trait>` or `Box<[T]>`, leave datum in it's original L-/R-value state. This fixes a subtle issue where temporaries were being allocated (but not necessarily initialized) to the (parent) terminating scope of a match expression; in particular, the code to zero out the temporary emitted by `datum.store_to` is only attached to the particular match-arm for that temporary, but when going down other arms of the match expression, the temporary may falsely appear to have been initialized, depending on what the stack held at that location, and thus may have its destructor erroneously run at the end of the terminating scope. FIx #20055. (There may be a latent bug still remaining in `fn into_fat_ptr`, but I am so annoyed by the test/run-pass/coerce_match.rs failures that I want to land this now.)
Collaborator
Contributor
|
ooc, is this related to the failure I've been seeing on OSX for a while? (There's no output, it just fails). |
Collaborator
Contributor
Author
|
@richo yes, this is meant to fix that. |
lnicola
pushed a commit
to lnicola/rust
that referenced
this pull request
Feb 23, 2026
…e-param fix: Fix another case where we forgot to put the type param for `PartialOrd` and `PartialEq` in builtin derives
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.
trans: When coercing to
Box<Trait>orBox<[T]>, leave datum in it's original L-/R-value state.This fixes a subtle issue where temporaries were being allocated (but not necessarily initialized) to the (parent) terminating scope of a match expression; in particular, the code to zero out the temporary emitted by
datum.store_tois only attached to the particular match-arm for that temporary, but when going down other arms of the match expression, the temporary may falsely appear to have been initialized, depending on what the stack held at that location, and thus may have its destructor erroneously run at the end of the terminating scope.FIx #20055.
(There may be a latent bug still remaining in
fn into_fat_ptr, but I am so annoyed by the test/run-pass/coerce_match.rs failures that I want to land this now.)