Closed
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
.