-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This code will segfault running drop glue for Box<Box<Fn()>>
, even though a value of that type is not actually created.
enum Handler {
Default,
Custom(*mut Box<Fn()>),
}
fn main() {
take();
}
fn take() -> Box<Fn()> {
unsafe {
match Handler::Default {
Handler::Default => Box::new(main),
Handler::Custom(ptr) => *Box::from_raw(ptr),
}
}
}
Interestingly, it exits successfully if the second match body is wrapped in a block.
Metadata
Metadata
Assignees
Labels
I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.