1
Fork 0
rust/compiler/rustc_const_eval
Tomasz Miąsko 915a581bcb Do not promote values with const drop that need to be dropped
Changes from #88558 allowed using `~const Drop` in constants by
introducing a new `NeedsNonConstDrop` qualif.

The new qualif was also used for promotion purposes, and allowed
promotion to happen for values that needs to be dropped but which
do have a const drop impl.

Since for promoted the drop implementation is never executed,
this lead to observable change in behaviour. For example:

```rust

struct Panic();

impl const Drop for Panic {
    fn drop(&mut self) {
        panic!();
    }
}

fn main() {
    let _ = &Panic();
}
```

Restore the use of `NeedsDrop` qualif during promotion to avoid the issue.
2021-10-18 21:56:57 +02:00
..
src Do not promote values with const drop that need to be dropped 2021-10-18 21:56:57 +02:00
Cargo.toml Remove unused dependencies from rustc_const_eval 2021-10-14 15:42:42 -05:00