about summary refs log tree commit diff
path: root/tests/ui/impl-trait
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/impl-trait')
-rw-r--r--tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr8
-rw-r--r--tests/ui/impl-trait/non-defining-uses/as-projection-term.rs4
-rw-r--r--tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.current.stderr17
-rw-r--r--tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.rs11
-rw-r--r--tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.stderr17
-rw-r--r--tests/ui/impl-trait/non-defining-uses/recursive-call.rs30
6 files changed, 57 insertions, 30 deletions
diff --git a/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr b/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr
deleted file mode 100644
index 96e242d5d48..00000000000
--- a/tests/ui/impl-trait/non-defining-uses/as-projection-term.next.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: non-defining use of `impl Sized + '_` in the defining scope
-  --> $DIR/as-projection-term.rs:14:19
-   |
-LL |     prove_proj(|| recur());
-   |                   ^^^^^^^
-
-error: aborting due to 1 previous error
-
diff --git a/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs b/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs
index f0cf333b6a1..19f983bab70 100644
--- a/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs
+++ b/tests/ui/impl-trait/non-defining-uses/as-projection-term.rs
@@ -1,7 +1,7 @@
 //@ revisions: current next
 //@[next] compile-flags: -Znext-solver
 //@ ignore-compare-mode-next-solver (explicit revisions)
-//@[current] check-pass
+//@ check-pass
 
 fn prove_proj<R>(_: impl FnOnce() -> R) {}
 fn recur<'a>() -> impl Sized + 'a {
@@ -12,6 +12,6 @@ fn recur<'a>() -> impl Sized + 'a {
     // inference variable at this point, we unify it with `opaque<'1>` and
     // end up ignoring that defining use as the hidden type is equal to its key.
     prove_proj(|| recur());
-    //[next]~^ ERROR non-defining use of `impl Sized + '_` in the defining scope
 }
+
 fn main() {}
diff --git a/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.current.stderr b/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.current.stderr
new file mode 100644
index 00000000000..30424ec58f9
--- /dev/null
+++ b/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.current.stderr
@@ -0,0 +1,17 @@
+error[E0792]: expected generic type parameter, found `impl Foo`
+  --> $DIR/double-wrap-with-defining-use.rs:12:26
+   |
+LL | fn a<T: Foo>(x: T) -> impl Foo {
+   |      - this generic parameter must be used with a generic type parameter
+LL |     if true { x } else { a(a(x)) }
+   |                          ^^^^^^^
+
+error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
+  --> $DIR/double-wrap-with-defining-use.rs:12:26
+   |
+LL |     if true { x } else { a(a(x)) }
+   |                          ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.rs b/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.rs
index 339277fec37..734b1920772 100644
--- a/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.rs
+++ b/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.rs
@@ -1,12 +1,17 @@
 // Regression test for ICE from issue #140545
 // The error message is confusing and wrong, but that's a different problem (#139350)
+
 //@ edition:2018
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] check-pass
 
 trait Foo {}
-fn a(x: impl Foo) -> impl Foo {
+fn a<T: Foo>(x: T) -> impl Foo {
     if true { x } else { a(a(x)) }
-    //~^ ERROR: expected generic type parameter, found `impl Foo` [E0792]
-    //~| ERROR: type parameter `impl Foo` is part of concrete type but not used in parameter list for the `impl Trait` type alias
+    //[current]~^ ERROR: expected generic type parameter, found `impl Foo` [E0792]
+    //[current]~| ERROR: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
 }
 
 fn main(){}
diff --git a/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.stderr b/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.stderr
deleted file mode 100644
index 1b02811e31b..00000000000
--- a/tests/ui/impl-trait/non-defining-uses/double-wrap-with-defining-use.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0792]: expected generic type parameter, found `impl Foo`
-  --> $DIR/double-wrap-with-defining-use.rs:7:26
-   |
-LL | fn a(x: impl Foo) -> impl Foo {
-   |         -------- this generic parameter must be used with a generic type parameter
-LL |     if true { x } else { a(a(x)) }
-   |                          ^^^^^^^
-
-error: type parameter `impl Foo` is part of concrete type but not used in parameter list for the `impl Trait` type alias
-  --> $DIR/double-wrap-with-defining-use.rs:7:26
-   |
-LL |     if true { x } else { a(a(x)) }
-   |                          ^^^^^^^
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/non-defining-uses/recursive-call.rs b/tests/ui/impl-trait/non-defining-uses/recursive-call.rs
new file mode 100644
index 00000000000..ecddf2cec47
--- /dev/null
+++ b/tests/ui/impl-trait/non-defining-uses/recursive-call.rs
@@ -0,0 +1,30 @@
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@ check-pass
+
+// Regression test for the non-defining use error in `gll`.
+
+struct Foo;
+impl Foo {
+    fn recur(&self, b: bool) -> impl Sized + '_ {
+        if b {
+            let temp = Foo;
+            temp.recur(false);
+            // desugars to `Foo::recur(&temp);`
+        }
+
+        self
+    }
+
+    fn in_closure(&self) -> impl Sized + '_ {
+        let _ = || {
+            let temp = Foo;
+            temp.in_closure();
+            // desugars to `Foo::in_closure(&temp);`
+        };
+
+        self
+    }
+}
+fn main() {}