-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-bugCategory: This is a bug.Category: This is a bug.
Description
Found by @nbdd0121 here, the following code compiles when it shouldn't:
#![feature(const_precise_live_drops)]
struct S;
impl Drop for S {
fn drop(&mut self) {
println!("Hello!");
}
}
const fn foo() {
let s = S;
}
fn main() {}
The final "post-borrowck cleanup" pass is the Deaggregator, which replaces the assignment _1 = S; with a nop because S has no fields. That means _1
never gets initialized in the MIR before its Drop
terminator, so the qualification logic doesn't assign it NeedsDrop
.
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-bugCategory: This is a bug.Category: This is a bug.