diff options
| author | bors <bors@rust-lang.org> | 2022-12-19 22:37:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-19 22:37:12 +0000 |
| commit | 696563efc5c3c0d87a601dff22966d2c5eb20a5e (patch) | |
| tree | 4ea1804b177b7c0d04af15a36bd716316583dc94 /src/test | |
| parent | 935dc07218b4bf6e20231e44eb9263b612fd649b (diff) | |
| parent | 5457db94108b3c3ca75e1875b7e60bc4ea6b4b66 (diff) | |
| download | rust-696563efc5c3c0d87a601dff22966d2c5eb20a5e.tar.gz rust-696563efc5c3c0d87a601dff22966d2c5eb20a5e.zip | |
Auto merge of #105905 - lqd:revert-103880, r=jackh726
Revert #103880 "Use non-ascribed type as field's type in mir" This PR prepares a revert for #103880 to fix #105809, #105881, #105886 and others (like the duplicates of the first one), in case an actual fix can't get done today. I've also added the MCVE from #105809. There is no MCVE for the #105881 and #105886 ICEs yet however, so there are no tests for them here, although we'll need one before relanding the original changes. Were this PR to land, it would also reopen #96514 as it was fixed by the original PR. Opening as draft to allow time for a possible fix. r? `@jackh726`
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/mir/field-projection-invariant.rs | 24 | ||||
| -rw-r--r-- | src/test/ui/mir/field-ty-ascription-enums.rs | 15 | ||||
| -rw-r--r-- | src/test/ui/mir/field-ty-ascription.rs | 37 | ||||
| -rw-r--r-- | src/test/ui/mir/issue-105809.rs | 36 |
4 files changed, 36 insertions, 76 deletions
diff --git a/src/test/ui/mir/field-projection-invariant.rs b/src/test/ui/mir/field-projection-invariant.rs deleted file mode 100644 index b5d6add043c..00000000000 --- a/src/test/ui/mir/field-projection-invariant.rs +++ /dev/null @@ -1,24 +0,0 @@ -// build-pass -struct Inv<'a>(&'a mut &'a ()); -enum Foo<T> { - Bar, - Var(T), -} -type Supertype = Foo<for<'a> fn(Inv<'a>, Inv<'a>)>; - -fn foo(x: Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>) { - match x { - Supertype::Bar => {} - Supertype::Var(x) => {} - } -} - -fn foo_nested(x: Foo<Foo<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>>) { - match x { - Foo::Bar => {} - Foo::Var(Supertype::Bar) => {} - Foo::Var(Supertype::Var(x)) => {} - } -} - -fn main() {} diff --git a/src/test/ui/mir/field-ty-ascription-enums.rs b/src/test/ui/mir/field-ty-ascription-enums.rs deleted file mode 100644 index 179af617090..00000000000 --- a/src/test/ui/mir/field-ty-ascription-enums.rs +++ /dev/null @@ -1,15 +0,0 @@ -// build-pass - -enum Foo<T> { - Var(T), -} // `T` is covariant. - -fn foo<'b>(x: Foo<for<'a> fn(&'a ())>) { - let Foo::Var(x): Foo<fn(&'b ())> = x; -} - -fn foo_nested<'b>(x: Foo<Foo<for<'a> fn(&'a ())>>) { - let Foo::Var(Foo::Var(x)): Foo<Foo<fn(&'b ())>> = x; -} - -fn main() {} diff --git a/src/test/ui/mir/field-ty-ascription.rs b/src/test/ui/mir/field-ty-ascription.rs deleted file mode 100644 index 178c7916bc5..00000000000 --- a/src/test/ui/mir/field-ty-ascription.rs +++ /dev/null @@ -1,37 +0,0 @@ -// build-pass - -struct Foo<T>(T); // `T` is covariant. - -struct Bar<T> { - x: T, -} // `T` is covariant. - -fn bar<'b>(x: Bar<for<'a> fn(&'a ())>) { - let Bar { x }: Bar<fn(&'b ())> = x; -} - -fn bar_nested<'b>(x: Bar<Bar<for<'a> fn(&'a ())>>) { - let Bar { x: Bar { x } }: Bar<Bar<fn(&'b ())>> = x; -} - -fn bar_foo_nested<'b>(x: Bar<Foo<for<'a> fn(&'a ())>>) { - let Bar { x: Foo ( x ) }: Bar<Foo<fn(&'b ())>> = x; -} - -fn foo<'b>(x: Foo<for<'a> fn(&'a ())>) { - let Foo(y): Foo<fn(&'b ())> = x; -} - -fn foo_nested<'b>(x: Foo<Foo<for<'a> fn(&'a ())>>) { - let Foo(Foo(y)): Foo<Foo<fn(&'b ())>> = x; -} - -fn tuple<'b>(x: (u32, for<'a> fn(&'a ()))) { - let (_, y): (u32, fn(&'b ())) = x; -} - -fn tuple_nested<'b>(x: (u32, (u32, for<'a> fn(&'a ())))) { - let (_, (_, y)): (u32, (u32, fn(&'b ()))) = x; -} - -fn main() {} diff --git a/src/test/ui/mir/issue-105809.rs b/src/test/ui/mir/issue-105809.rs new file mode 100644 index 00000000000..57828feef2d --- /dev/null +++ b/src/test/ui/mir/issue-105809.rs @@ -0,0 +1,36 @@ +// Non-regression test ICE from issue #105809 and duplicates. + +// build-pass: the ICE is during codegen +// compile-flags: --edition 2018 -Zmir-opt-level=1 + +use std::{future::Future, pin::Pin}; + +// Create a `T` without affecting analysis like `loop {}`. +fn create<T>() -> T { + loop {} +} + +async fn trivial_future() {} + +struct Connection<H> { + _h: H, +} + +async fn complex_future<H>(conn: &Connection<H>) { + let small_fut = async move { + let _ = conn; + trivial_future().await; + }; + + let mut tuple = (small_fut,); + let (small_fut_again,) = &mut tuple; + let _ = small_fut_again; +} + +fn main() { + let mut fut = complex_future(&Connection { _h: () }); + + let mut cx = create(); + let future = unsafe { Pin::new_unchecked(&mut fut) }; + let _ = future.poll(&mut cx); +} |
