about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/122904.rs12
-rw-r--r--tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs3
-rw-r--r--tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr18
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.rs1
-rw-r--r--tests/ui/impl-trait/issues/issue-86800.stderr23
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/const_generic_type.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs18
-rw-r--r--tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr30
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.rs1
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr19
-rw-r--r--tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr10
13 files changed, 59 insertions, 98 deletions
diff --git a/tests/crashes/122904.rs b/tests/crashes/122904.rs
deleted file mode 100644
index 2068cd9d239..00000000000
--- a/tests/crashes/122904.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ known-bug: #122904
-trait T {}
-
-type Alias<'a> = impl T;
-
-struct S;
-impl<'a> T for &'a S {}
-
-#[define_opaque(Alias)]
-fn with_positive(fun: impl Fn(Alias<'_>)) {
-    with_positive(|&n| ());
-}
diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs
index 2f17c0ff508..776bb7278ce 100644
--- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs
+++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs
@@ -2,8 +2,7 @@
 use std::fmt::Debug;
 
 fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
-    //~^ ERROR cannot resolve opaque type
-    //~| WARNING elided lifetime has a name
+    //~^ WARNING elided lifetime has a name
     |x| x
     //~^ ERROR expected generic lifetime parameter, found `'_`
 }
diff --git a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr
index 91550f0e284..209186db4cc 100644
--- a/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr
+++ b/tests/ui/impl-trait/impl-fn-predefined-lifetimes.stderr
@@ -7,24 +7,14 @@ LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
    = note: `#[warn(elided_named_lifetimes)]` on by default
 
 error[E0792]: expected generic lifetime parameter, found `'_`
-  --> $DIR/impl-fn-predefined-lifetimes.rs:7:9
+  --> $DIR/impl-fn-predefined-lifetimes.rs:6:9
    |
 LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
    |                                                -- this generic parameter must be used with a generic lifetime parameter
-...
+LL |
 LL |     |x| x
    |         ^
 
-error[E0720]: cannot resolve opaque type
-  --> $DIR/impl-fn-predefined-lifetimes.rs:4:35
-   |
-LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
-   |                                   ^^^^^^^^^^^^^^^ recursive opaque type
-...
-LL |     |x| x
-   |     ----- returning here with type `{closure@$DIR/impl-fn-predefined-lifetimes.rs:7:5: 7:8}`
-
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to 1 previous error; 1 warning emitted
 
-Some errors have detailed explanations: E0720, E0792.
-For more information about an error, try `rustc --explain E0720`.
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/impl-trait/issues/issue-86800.rs b/tests/ui/impl-trait/issues/issue-86800.rs
index c1176255f24..9e8ea439dde 100644
--- a/tests/ui/impl-trait/issues/issue-86800.rs
+++ b/tests/ui/impl-trait/issues/issue-86800.rs
@@ -40,7 +40,6 @@ impl Context {
         f: impl FnOnce(&mut dyn Transaction) -> TransactionFuture<'_, O>,
     ) -> TransactionResult<O> {
         //~^ ERROR expected generic lifetime parameter, found `'_`
-        //~| ERROR: item does not constrain
         let mut conn = Connection {};
         let mut transaction = TestTransaction { conn: &mut conn };
         f(&mut transaction).await
diff --git a/tests/ui/impl-trait/issues/issue-86800.stderr b/tests/ui/impl-trait/issues/issue-86800.stderr
index 11e23d97d72..80aa5d75c3c 100644
--- a/tests/ui/impl-trait/issues/issue-86800.stderr
+++ b/tests/ui/impl-trait/issues/issue-86800.stderr
@@ -24,26 +24,6 @@ note: this opaque type is supposed to be constrained
 LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item does not constrain `TransactionFuture::{opaque#0}`
-  --> $DIR/issue-86800.rs:41:31
-   |
-LL |       ) -> TransactionResult<O> {
-   |  _______________________________^
-LL | |
-LL | |
-LL | |         let mut conn = Connection {};
-LL | |         let mut transaction = TestTransaction { conn: &mut conn };
-LL | |         f(&mut transaction).await
-LL | |     }
-   | |_____^
-   |
-   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
-note: this opaque type is supposed to be constrained
-  --> $DIR/issue-86800.rs:21:34
-   |
-LL | type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionResult<O>>;
-   |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0792]: expected generic lifetime parameter, found `'_`
   --> $DIR/issue-86800.rs:31:5
    |
@@ -62,13 +42,12 @@ LL |   type TransactionFuture<'__, O> = impl '__ + Future<Output = TransactionRe
 LL |       ) -> TransactionResult<O> {
    |  _______________________________^
 LL | |
-LL | |
 LL | |         let mut conn = Connection {};
 LL | |         let mut transaction = TestTransaction { conn: &mut conn };
 LL | |         f(&mut transaction).await
 LL | |     }
    | |_____^
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
index ba97bbf89f8..241eccc5f2b 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.no_infer.stderr
@@ -19,22 +19,5 @@ note: this opaque type is supposed to be constrained
 LL | type Bar = impl std::fmt::Display;
    |            ^^^^^^^^^^^^^^^^^^^^^^
 
-error: item does not constrain `Bar::{opaque#0}`
-  --> $DIR/const_generic_type.rs:8:31
-   |
-LL |   async fn test<const N: Bar>() {
-   |  _______________________________^
-...  |
-LL | |     let x: u32 = N;
-LL | | }
-   | |_^
-   |
-   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
-note: this opaque type is supposed to be constrained
-  --> $DIR/const_generic_type.rs:5:12
-   |
-LL | type Bar = impl std::fmt::Display;
-   |            ^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/type-alias-impl-trait/const_generic_type.rs b/tests/ui/type-alias-impl-trait/const_generic_type.rs
index 5b093be9231..9b38f1449f8 100644
--- a/tests/ui/type-alias-impl-trait/const_generic_type.rs
+++ b/tests/ui/type-alias-impl-trait/const_generic_type.rs
@@ -8,7 +8,6 @@ type Bar = impl std::fmt::Display;
 async fn test<const N: Bar>() {
     //~^ ERROR: `Bar` is forbidden as the type of a const generic parameter
     //[no_infer]~^^ ERROR item does not constrain
-    //[no_infer]~| ERROR item does not constrain
     #[cfg(infer)]
     let x: u32 = N;
 }
diff --git a/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs
new file mode 100644
index 00000000000..a2de3957c0b
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.rs
@@ -0,0 +1,18 @@
+// We previously didn't taint the borrowck result in this test,
+// causing an ICE later on.
+#![feature(type_alias_impl_trait)]
+trait T {}
+
+type Alias<'a> = impl T;
+
+struct S;
+impl<'a> T for &'a S {}
+
+#[define_opaque(Alias)]
+fn with_positive(fun: impl Fn(Alias<'_>)) {
+    //~^ WARN function cannot return without recursing
+    with_positive(|&n| ());
+    //~^ ERROR cannot move out of a shared reference
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr
new file mode 100644
index 00000000000..956ce3e5936
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/error-tainting-issue-122904.stderr
@@ -0,0 +1,30 @@
+warning: function cannot return without recursing
+  --> $DIR/error-tainting-issue-122904.rs:12:1
+   |
+LL | fn with_positive(fun: impl Fn(Alias<'_>)) {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot return without recursing
+LL |
+LL |     with_positive(|&n| ());
+   |     ---------------------- recursive call site
+   |
+   = help: a `loop` may express intention better if this is on purpose
+   = note: `#[warn(unconditional_recursion)]` on by default
+
+error[E0507]: cannot move out of a shared reference
+  --> $DIR/error-tainting-issue-122904.rs:14:20
+   |
+LL |     with_positive(|&n| ());
+   |                    ^-
+   |                     |
+   |                     data moved here
+   |                     move occurs because `n` has type `S`, which does not implement the `Copy` trait
+   |
+help: consider removing the borrow
+   |
+LL -     with_positive(|&n| ());
+LL +     with_positive(|n| ());
+   |
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
index 7e010918b29..cbd8150d117 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
@@ -22,7 +22,6 @@ where
     for<'any> F: FnMut(&'any mut ()) -> FutNothing<'any>,
 {
     //~^ ERROR: expected generic lifetime parameter, found `'any`
-    //~| ERROR item does not constrain
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
index 2ca6a199448..2c0be0cbcdc 100644
--- a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
@@ -11,21 +11,6 @@ note: this opaque type is supposed to be constrained
 LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: item does not constrain `FutNothing::{opaque#0}`
-  --> $DIR/hkl_forbidden4.rs:23:1
-   |
-LL | / {
-...  |
-LL | | }
-   | |_^
-   |
-   = note: consider removing `#[define_opaque]` or adding an empty `#[define_opaque()]`
-note: this opaque type is supposed to be constrained
-  --> $DIR/hkl_forbidden4.rs:10:23
-   |
-LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
-   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error: concrete type differs from previous defining opaque type use
   --> $DIR/hkl_forbidden4.rs:12:1
    |
@@ -54,10 +39,10 @@ LL |   type FutNothing<'a> = impl 'a + Future<Output = ()>;
    |                   -- this generic parameter must be used with a generic lifetime parameter
 ...
 LL | / {
-...  |
+LL | |
 LL | | }
    | |_^
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs
index 7452000b65d..92c8a8f3216 100644
--- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs
+++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.rs
@@ -6,7 +6,7 @@ trait Foo {
 }
 
 impl Foo for () {
-    type Assoc<'a> = impl Sized; //~ ERROR unconstrained opaque type
+    type Assoc<'a> = impl Sized;
     fn bar<'a: 'a>()
     where
         Self::Assoc<'a>:,
diff --git a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr
index 1274a8b60de..7ce4517fb1e 100644
--- a/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr
+++ b/tests/ui/type-alias-impl-trait/in-assoc-ty-early-bound2.stderr
@@ -9,14 +9,6 @@ LL |     fn bar<'a: 'a>()
 LL |             let _: Self::Assoc<'a> = x;
    |                    ^^^^^^^^^^^^^^^
 
-error: unconstrained opaque type
-  --> $DIR/in-assoc-ty-early-bound2.rs:9:22
-   |
-LL |     type Assoc<'a> = impl Sized;
-   |                      ^^^^^^^^^^
-   |
-   = note: `Assoc` must be used in combination with a concrete type within the same impl
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0700`.