about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/mir/field-projection-invariant.rs24
-rw-r--r--src/test/ui/mir/field-ty-ascription-enums.rs15
-rw-r--r--src/test/ui/mir/field-ty-ascription.rs37
-rw-r--r--src/test/ui/mir/issue-105809.rs36
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);
+}