about summary refs log tree commit diff
path: root/tests/crashes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-10-02 01:54:48 +0000
committerbors <bors@rust-lang.org>2025-10-02 01:54:48 +0000
commit42b384ec0dfcd528d99a4db0a337d9188a9eecaa (patch)
tree3514e6cac9bc43fb0b255776653d322956ff4b75 /tests/crashes
parent3369e82c6bc03c5cdb66f730dba6f738b74c8e1d (diff)
parent413f095a85adb21331f6e64cf030ead124a6ba07 (diff)
downloadrust-42b384ec0dfcd528d99a4db0a337d9188a9eecaa.tar.gz
rust-42b384ec0dfcd528d99a4db0a337d9188a9eecaa.zip
Auto merge of #147055 - beepster4096:subtype_is_not_a_projection, r=lcnr
Turn ProjectionElem::Subtype into CastKind::Subtype

I noticed that drop elaboration can't, in general, handle `ProjectionElem::SubType`. It creates a disjoint move path that overlaps with other move paths. (`Subslice` does too, and I'm working on a different PR to make that special case less fragile.) If its skipped and treated as the same move path as its parent then `MovePath.place` has multiple possible projections. (It would probably make sense to remove all `Subtype` projections for the canonical place but it doesn't make sense to have this special case for a problem that doesn't actually occur in real MIR.)

The only reason this doesn't break is that `Subtype` is always the sole projection of the local its applied to. For the same reason, it works fine as a `CastKind` so I figured that makes more sense than documenting and validating this hidden invariant.

cc rust-lang/rust#112651, rust-lang/rust#133258

r? Icnr (bc you've been the main person dealing with `Subtype` it looks like)
Diffstat (limited to 'tests/crashes')
-rw-r--r--tests/crashes/120016.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/crashes/120016.rs b/tests/crashes/120016.rs
index 7eda330e7ad..12f54dbc3d9 100644
--- a/tests/crashes/120016.rs
+++ b/tests/crashes/120016.rs
@@ -1,19 +1,19 @@
 //@ known-bug: #120016
-//@ compile-flags: -Zcrate-attr=feature(const_async_blocks)
+//@ compile-flags: -Zvalidate-mir
 //@ edition: 2021
 
-#![feature(type_alias_impl_trait, const_async_blocks)]
+#![feature(type_alias_impl_trait)]
 
 struct Bug {
     V1: [(); {
-        type F = impl std::future::Future<Output = impl Sized>;
+        type F = impl Sized;
         #[define_opaque(F)]
         fn concrete_use() -> F {
-            //~^ ERROR to be a future that resolves to `u8`, but it resolves to `()`
-            async {}
+            //~^ ERROR
+            1i32
         }
-        let f: F = async { 1 };
-        //~^ ERROR `async` blocks are not allowed in constants
+        let f: F = 0u32;
+
         1
     }],
 }