diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-10-22 19:42:49 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-22 19:42:49 +0900 |
| commit | a656bc5b089aa39c69ee208baecce21e8bf138a7 (patch) | |
| tree | ca5f3d14c58d38aea08fba0356b0cbd89defa15b /src | |
| parent | 9ed9025ea9f047a13653bb15b57c5f62e1be3828 (diff) | |
| parent | 74c6636d27fe95e79d130f7420302d5db2559c3b (diff) | |
| download | rust-a656bc5b089aa39c69ee208baecce21e8bf138a7.tar.gz rust-a656bc5b089aa39c69ee208baecce21e8bf138a7.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/consts/precise-drop-with-promoted.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/ui/consts/precise-drop-with-promoted.rs b/src/test/ui/consts/precise-drop-with-promoted.rs new file mode 100644 index 00000000000..6f2317a5a27 --- /dev/null +++ b/src/test/ui/consts/precise-drop-with-promoted.rs @@ -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; +} |
