Rollup merge of #90069 - tmiasko:promoted-const-qualif, r=oli-obk
Fix const qualification when executed after promotion The const qualification was so far performed before the promotion and the implementation assumed that it will never encounter a promoted. With `const_precise_live_drops` feature, checking for live drops is delayed until after drop elaboration, which in turn runs after promotion. so the assumption is no longer true. When evaluating `NeedsNonConstDrop` it is now possible to encounter promoteds. Use type base qualification for the promoted. It is a sound approximation in general, and in the specific case of promoteds and `NeedsNonConstDrop` it is precise. Fixes #89938.
This commit is contained in:
commit
a656bc5b08
2 changed files with 18 additions and 2 deletions
9
src/test/ui/consts/precise-drop-with-promoted.rs
Normal file
9
src/test/ui/consts/precise-drop-with-promoted.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Regression test for issue #89938.
|
||||
// check-pass
|
||||
// compile-flags: --crate-type=lib
|
||||
#![feature(const_precise_live_drops)]
|
||||
|
||||
pub const fn f() {
|
||||
let _: Option<String> = None;
|
||||
let _: &'static Option<String> = &None;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue