about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/counters.rs
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-10-17 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-10-18 21:56:57 +0200
commit915a581bcb3d9b7e1e2ef0da4fbfbae6b1a7fa7f (patch)
tree68eada5eecef18c90f66a77762037c80958d178e /compiler/rustc_mir_transform/src/coverage/counters.rs
parent171cbc01efe103f255f83afa2a70768e1d373edb (diff)
downloadrust-915a581bcb3d9b7e1e2ef0da4fbfbae6b1a7fa7f.tar.gz
rust-915a581bcb3d9b7e1e2ef0da4fbfbae6b1a7fa7f.zip
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.
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/counters.rs')
0 files changed, 0 insertions, 0 deletions