-
Notifications
You must be signed in to change notification settings - Fork 13.3k
trans tries to clean up values created in a match arm, outside the match. #18845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Dupe of #15892. Leaving open for now but we can close either. |
This is caused by a micro-optimization specific to dereferences of |
@eddyb I think we can probably remove it, in general removing special treatment of |
Triage: this still ICEs. |
@eddyb can you point me/us at the micro-optimization that you mentioned above, so that I (we) can try removing it ourselves and measure the impact? |
@pnkfelix I only vaguely recall this issue, but I'm pretty sure I was talking about |
triage: still ICEs. #![feature(box_syntax)]
#![crate_type="lib"]
pub fn test(foo: bool) -> u8 {
match foo {
true => *box 0,
false => 0
}
} |
Indeed, it doesn't even need pub fn test(foo: bool) -> u8 {
match foo {
true => *Box::new(0),
false => 0
}
}
fn main() {
test(true);
} Does this at least continue to ICE even if LLVM is compiled without assertions? If not, we may want to up the priority on this ticket. |
fix: Fix flycheck getting confused which package to check
Original testcase by @hoeppnertill (reduced from his nock repo):
The debug log reveals that a (shallow free) cleanup of the
Box<int>
rvalue is scheduled in the scope of AST node11
, while the dereference expression itself has id16
:--pretty expanded,identified
reveals that id11
refers to the entire function's block:This means the cleanup of a value valid only within a match arm is scheduled outside the arm.
cc @nikomatsakis @pnkfelix
The text was updated successfully, but these errors were encountered: