about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-11 06:49:12 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-06-11 08:08:25 +0000
commit6cca6da1265b9bede368f34da6be42057adc9834 (patch)
tree594c6fe70329193fadeab77c73c5a61b92ace62b
parentfe55c0091db4654ad0185831aa3dd110e5e6cd73 (diff)
downloadrust-6cca6da1265b9bede368f34da6be42057adc9834.tar.gz
rust-6cca6da1265b9bede368f34da6be42057adc9834.zip
Revert "When checking whether an impl applies, constrain hidden types of opaque types."
This reverts commit 29a630eb72ffb94c3708947afae1e948ad3cb189.
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs2
-rw-r--r--tests/ui/impl-trait/equality.rs13
-rw-r--r--tests/ui/impl-trait/equality.stderr15
-rw-r--r--tests/ui/impl-trait/nested_impl_trait.stderr16
-rw-r--r--tests/ui/impl-trait/recursive-bound-eval.rs8
-rw-r--r--tests/ui/impl-trait/recursive-bound-eval.stderr42
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs2
-rw-r--r--tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr12
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr11
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr18
-rw-r--r--tests/ui/type-alias-impl-trait/constrain_in_projection2.rs3
-rw-r--r--tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr23
-rw-r--r--tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs8
-rw-r--r--tests/ui/type-alias-impl-trait/issue-84660-unsoundness.stderr (renamed from tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr)2
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference.rs13
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr17
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr9
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference2.rs7
-rw-r--r--tests/ui/type-alias-impl-trait/nested-tait-inference2.stderr16
-rw-r--r--tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr21
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-2.current.stderr14
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-2.rs4
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-3.rs2
-rw-r--r--tests/ui/type-alias-impl-trait/self-referential-3.stderr12
25 files changed, 121 insertions, 172 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 4a935f4a64a..4306a803524 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -2563,7 +2563,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
         let InferOk { obligations, .. } = self
             .infcx
             .at(&cause, obligation.param_env)
-            .eq(DefineOpaqueTypes::Yes, placeholder_obligation_trait_ref, impl_trait_ref)
+            .eq(DefineOpaqueTypes::No, placeholder_obligation_trait_ref, impl_trait_ref)
             .map_err(|e| {
                 debug!("match_impl: failed eq_trait_refs due to `{}`", e.to_string(self.tcx()))
             })?;
diff --git a/tests/ui/impl-trait/equality.rs b/tests/ui/impl-trait/equality.rs
index 952f81f1978..828b5aac896 100644
--- a/tests/ui/impl-trait/equality.rs
+++ b/tests/ui/impl-trait/equality.rs
@@ -22,7 +22,7 @@ fn sum_to(n: u32) -> impl Foo {
         0
     } else {
         n + sum_to(n - 1)
-        //~^ ERROR cannot satisfy `<u32 as Add<impl Foo>>::Output == i32`
+        //~^ ERROR cannot add `impl Foo` to `u32`
     }
 }
 
@@ -32,15 +32,12 @@ trait Leak: Sized {
 }
 impl<T> Leak for T {
     default type T = ();
-    default fn leak(self) -> Self::T {
-        panic!()
-    }
+    default fn leak(self) -> Self::T { panic!() }
 }
 impl Leak for i32 {
     type T = i32;
-    fn leak(self) -> i32 {
-        self
-    }
+    fn leak(self) -> i32 { self }
 }
 
-fn main() {}
+fn main() {
+}
diff --git a/tests/ui/impl-trait/equality.stderr b/tests/ui/impl-trait/equality.stderr
index c9ba1a5ba32..69f4cbbbf42 100644
--- a/tests/ui/impl-trait/equality.stderr
+++ b/tests/ui/impl-trait/equality.stderr
@@ -22,13 +22,20 @@ help: change the type of the numeric literal from `u32` to `i32`
 LL |     0_i32
    |       ~~~
 
-error[E0284]: type annotations needed: cannot satisfy `<u32 as Add<impl Foo>>::Output == i32`
+error[E0277]: cannot add `impl Foo` to `u32`
   --> $DIR/equality.rs:24:11
    |
 LL |         n + sum_to(n - 1)
-   |           ^ cannot satisfy `<u32 as Add<impl Foo>>::Output == i32`
+   |           ^ no implementation for `u32 + impl Foo`
+   |
+   = help: the trait `Add<impl Foo>` is not implemented for `u32`
+   = help: the following other types implement trait `Add<Rhs>`:
+             <&'a u32 as Add<u32>>
+             <&u32 as Add<&u32>>
+             <u32 as Add<&u32>>
+             <u32 as Add>
 
 error: aborting due to 2 previous errors; 1 warning emitted
 
-Some errors have detailed explanations: E0284, E0308.
-For more information about an error, try `rustc --explain E0284`.
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/tests/ui/impl-trait/nested_impl_trait.stderr b/tests/ui/impl-trait/nested_impl_trait.stderr
index f7c708a1dfa..1f9a2a5e9d6 100644
--- a/tests/ui/impl-trait/nested_impl_trait.stderr
+++ b/tests/ui/impl-trait/nested_impl_trait.stderr
@@ -46,23 +46,19 @@ error[E0277]: the trait bound `impl Into<u32>: Into<impl Debug>` is not satisfie
   --> $DIR/nested_impl_trait.rs:6:46
    |
 LL | fn bad_in_ret_position(x: impl Into<u32>) -> impl Into<impl Debug> { x }
-   |                                              ^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `impl Into<u32>`
+   |                                              ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Into<u32>`, which is required by `impl Into<u32>: Into<impl Debug>`
    |
-help: consider further restricting this bound
-   |
-LL | fn bad_in_ret_position(x: impl Into<u32> + std::fmt::Debug) -> impl Into<impl Debug> { x }
-   |                                          +++++++++++++++++
+   = help: the trait `Into<U>` is implemented for `T`
+   = note: required for `impl Into<u32>` to implement `Into<impl Debug>`
 
 error[E0277]: the trait bound `impl Into<u32>: Into<impl Debug>` is not satisfied
   --> $DIR/nested_impl_trait.rs:19:34
    |
 LL |     fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
-   |                                  ^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `impl Into<u32>`
-   |
-help: consider further restricting this bound
+   |                                  ^^^^^^^^^^^^^^^^^^^^^ the trait `From<impl Into<u32>>` is not implemented for `impl Into<u32>`, which is required by `impl Into<u32>: Into<impl Debug>`
    |
-LL |     fn bad(x: impl Into<u32> + std::fmt::Debug) -> impl Into<impl Debug> { x }
-   |                              +++++++++++++++++
+   = help: the trait `Into<U>` is implemented for `T`
+   = note: required for `impl Into<u32>` to implement `Into<impl Debug>`
 
 error: aborting due to 7 previous errors
 
diff --git a/tests/ui/impl-trait/recursive-bound-eval.rs b/tests/ui/impl-trait/recursive-bound-eval.rs
index f992cb3071a..591553e7ceb 100644
--- a/tests/ui/impl-trait/recursive-bound-eval.rs
+++ b/tests/ui/impl-trait/recursive-bound-eval.rs
@@ -1,3 +1,8 @@
+//! Test that we can evaluate nested obligations when invoking methods on recursive calls on
+//! an RPIT.
+
+//@ check-pass
+
 pub trait Parser<E> {
     fn parse(&self) -> E;
 }
@@ -9,10 +14,7 @@ impl<E, T: Fn() -> E> Parser<E> for T {
 }
 
 pub fn recursive_fn<E>() -> impl Parser<E> {
-    //~^ ERROR: cycle detected
     move || recursive_fn().parse()
-    //~^ ERROR: type annotations needed
-    //~| ERROR: no method named `parse` found for opaque type
 }
 
 fn main() {}
diff --git a/tests/ui/impl-trait/recursive-bound-eval.stderr b/tests/ui/impl-trait/recursive-bound-eval.stderr
deleted file mode 100644
index c7283380234..00000000000
--- a/tests/ui/impl-trait/recursive-bound-eval.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0282]: type annotations needed
-  --> $DIR/recursive-bound-eval.rs:13:28
-   |
-LL |     move || recursive_fn().parse()
-   |                            ^^^^^ cannot infer type
-
-error[E0599]: no method named `parse` found for opaque type `impl Parser<_>` in the current scope
-  --> $DIR/recursive-bound-eval.rs:13:28
-   |
-LL |     move || recursive_fn().parse()
-   |                            ^^^^^ method not found in `impl Parser<_>`
-   |
-   = help: items from traits can only be used if the trait is implemented and in scope
-help: trait `Parser` which provides `parse` is implemented but not in scope; perhaps you want to import it
-   |
-LL + use Parser;
-   |
-
-error[E0391]: cycle detected when computing type of opaque `recursive_fn::{opaque#0}`
-  --> $DIR/recursive-bound-eval.rs:11:29
-   |
-LL | pub fn recursive_fn<E>() -> impl Parser<E> {
-   |                             ^^^^^^^^^^^^^^
-   |
-note: ...which requires type-checking `recursive_fn`...
-  --> $DIR/recursive-bound-eval.rs:13:13
-   |
-LL |     move || recursive_fn().parse()
-   |             ^^^^^^^^^^^^^^
-   = note: ...which requires evaluating trait selection obligation `recursive_fn::{opaque#0}: core::marker::Unpin`...
-   = note: ...which again requires computing type of opaque `recursive_fn::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `recursive_fn::{opaque#0}`
-  --> $DIR/recursive-bound-eval.rs:11:29
-   |
-LL | pub fn recursive_fn<E>() -> impl Parser<E> {
-   |                             ^^^^^^^^^^^^^^
-   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error: aborting due to 3 previous errors
-
-Some errors have detailed explanations: E0282, E0391, E0599.
-For more information about an error, try `rustc --explain E0282`.
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs
index 7874a21f3ae..aab10be2de2 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.rs
@@ -11,7 +11,7 @@ impl PartialEq<(Bar, i32)> for Bar {
 }
 
 fn foo() -> Foo {
-    //~^ ERROR overflow evaluating the requirement `Bar: PartialEq<(Foo, i32)>`
+    //~^ ERROR can't compare `Bar` with `(Foo, i32)`
     Bar
 }
 
diff --git a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr
index 2d4707f8a27..bc810c0f88f 100644
--- a/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr
+++ b/tests/ui/impl-trait/recursive-type-alias-impl-trait-declaration.stderr
@@ -1,9 +1,15 @@
-error[E0275]: overflow evaluating the requirement `Bar: PartialEq<(Foo, i32)>`
+error[E0277]: can't compare `Bar` with `(Foo, i32)`
   --> $DIR/recursive-type-alias-impl-trait-declaration.rs:13:13
    |
 LL | fn foo() -> Foo {
-   |             ^^^
+   |             ^^^ no implementation for `Bar == (Foo, i32)`
+LL |
+LL |     Bar
+   |     --- return type was inferred to be `Bar` here
+   |
+   = help: the trait `PartialEq<(Foo, i32)>` is not implemented for `Bar`
+   = help: the trait `PartialEq<(Bar, i32)>` is implemented for `Bar`
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr
new file mode 100644
index 00000000000..c215d197db4
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.current.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
+  --> $DIR/constrain_in_projection.rs:24:14
+   |
+LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
+   |              ^^^ the trait `Trait<Bar>` is not implemented for `Foo`
+   |
+   = help: the trait `Trait<()>` is implemented for `Foo`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs
index 2a246900106..7d7d16361ae 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection.rs
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection.rs
@@ -4,7 +4,7 @@
 //@ revisions: current next
 //@ ignore-compare-mode-next-solver (explicit revisions)
 //@[next] compile-flags: -Znext-solver
-//@check-pass
+//@[next]check-pass
 
 #![feature(type_alias_impl_trait)]
 
@@ -22,6 +22,7 @@ impl Trait<()> for Foo {
 
 fn bop(_: Bar) {
     let x = <Foo as Trait<Bar>>::Assoc::default();
+    //[current]~^ `Foo: Trait<Bar>` is not satisfied
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr
index 0d6eac4216b..69df5c77f9d 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.current.stderr
@@ -1,19 +1,13 @@
-error[E0283]: type annotations needed: cannot satisfy `Foo: Trait<Bar>`
+error[E0277]: the trait bound `Foo: Trait<Bar>` is not satisfied
   --> $DIR/constrain_in_projection2.rs:27:14
    |
 LL |     let x = <Foo as Trait<Bar>>::Assoc::default();
-   |              ^^^ help: use the fully qualified path to an implementation: `<Type as Trait>::Assoc`
+   |              ^^^ the trait `Trait<Bar>` is not implemented for `Foo`
    |
-note: multiple `impl`s satisfying `Foo: Trait<Bar>` found
-  --> $DIR/constrain_in_projection2.rs:18:1
-   |
-LL | impl Trait<()> for Foo {
-   | ^^^^^^^^^^^^^^^^^^^^^^
-...
-LL | impl Trait<u32> for Foo {
-   | ^^^^^^^^^^^^^^^^^^^^^^^
-   = note: associated types cannot be accessed directly on a `trait`, they can only be accessed through a specific `impl`
+   = help: the following other types implement trait `Trait<T>`:
+             <Foo as Trait<()>>
+             <Foo as Trait<u32>>
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0283`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs
index 0066131f015..af222f6c153 100644
--- a/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs
+++ b/tests/ui/type-alias-impl-trait/constrain_in_projection2.rs
@@ -25,7 +25,8 @@ impl Trait<u32> for Foo {
 
 fn bop(_: Bar) {
     let x = <Foo as Trait<Bar>>::Assoc::default();
-    //~^ ERROR: cannot satisfy `Foo: Trait<Bar>`
+    //[next]~^ ERROR: cannot satisfy `Foo: Trait<Bar>`
+    //[current]~^^ ERROR: `Foo: Trait<Bar>` is not satisfied
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr
deleted file mode 100644
index 607f0b062ab..00000000000
--- a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.next.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-error[E0284]: type annotations needed: cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
-  --> $DIR/issue-84660-unsoundness.rs:22:37
-   |
-LL |       fn convert(_i: In) -> Self::Out {
-   |  _____________________________________^
-LL | |
-LL | |         unreachable!();
-LL | |     }
-   | |_____^ cannot satisfy `<Out as Trait<Bar, In>>::Out == ()`
-
-error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
-  --> $DIR/issue-84660-unsoundness.rs:28:1
-   |
-LL | impl<In, Out> Trait<Bar, In> for Out {
-   | ------------------------------------ first implementation here
-...
-LL | impl<In, Out> Trait<(), In> for Out {
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0119, E0284.
-For more information about an error, try `rustc --explain E0119`.
diff --git a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs
index 99a5d36066b..48d4b0c96ff 100644
--- a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs
+++ b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.rs
@@ -1,10 +1,6 @@
 // Another example from issue #84660, this time weaponized as a safe transmute: an opaque type in an
 // impl header being accepted was used to create unsoundness.
 
-//@ revisions: current next
-//@ ignore-compare-mode-next-solver (explicit revisions)
-//@[next] compile-flags: -Znext-solver
-
 #![feature(type_alias_impl_trait)]
 
 trait Foo {}
@@ -20,13 +16,11 @@ trait Trait<T, In> {
 impl<In, Out> Trait<Bar, In> for Out {
     type Out = Out;
     fn convert(_i: In) -> Self::Out {
-        //[next]~^ ERROR: type annotations needed
         unreachable!();
     }
 }
 
-impl<In, Out> Trait<(), In> for Out {
-    //~^ ERROR conflicting implementations of trait `Trait<Bar, _>`
+impl<In, Out> Trait<(), In> for Out { //~ ERROR conflicting implementations of trait `Trait<Bar, _>`
     type Out = In;
     fn convert(i: In) -> Self::Out {
         i
diff --git a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.stderr
index a7ff097e8bf..461da20f37b 100644
--- a/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.current.stderr
+++ b/tests/ui/type-alias-impl-trait/issue-84660-unsoundness.stderr
@@ -1,5 +1,5 @@
 error[E0119]: conflicting implementations of trait `Trait<Bar, _>`
-  --> $DIR/issue-84660-unsoundness.rs:28:1
+  --> $DIR/issue-84660-unsoundness.rs:23:1
    |
 LL | impl<In, Out> Trait<Bar, In> for Out {
    | ------------------------------------ first implementation here
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference.rs b/tests/ui/type-alias-impl-trait/nested-tait-inference.rs
index 70495c44706..82248971692 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference.rs
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference.rs
@@ -1,21 +1,18 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-//@ revisions: current next
-//@ ignore-compare-mode-next-solver (explicit revisions)
-//@[next] compile-flags: -Znext-solver
-//@check-pass
-
 use std::fmt::Debug;
 
 type FooX = impl Debug;
 
-trait Foo<A> {}
+trait Foo<A> { }
 
-impl Foo<()> for () {}
+impl Foo<()> for () { }
 
 fn foo() -> impl Foo<FooX> {
+    //~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
+    // FIXME(type-alias-impl-trait): We could probably make this work.
     ()
 }
 
-fn main() {}
+fn main() { }
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr
deleted file mode 100644
index c7b7af152ab..00000000000
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference2.current.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error[E0283]: type annotations needed: cannot satisfy `(): Foo<FooX>`
-  --> $DIR/nested-tait-inference2.rs:17:13
-   |
-LL | fn foo() -> impl Foo<FooX> {
-   |             ^^^^^^^^^^^^^^
-   |
-note: multiple `impl`s satisfying `(): Foo<FooX>` found
-  --> $DIR/nested-tait-inference2.rs:14:1
-   |
-LL | impl Foo<()> for () {}
-   | ^^^^^^^^^^^^^^^^^^^
-LL | impl Foo<u32> for () {}
-   | ^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr
deleted file mode 100644
index 9647d9e376e..00000000000
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference2.next.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0284]: type annotations needed: cannot satisfy `impl Foo<FooX> == ()`
-  --> $DIR/nested-tait-inference2.rs:19:5
-   |
-LL |     ()
-   |     ^^ cannot satisfy `impl Foo<FooX> == ()`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs b/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs
index fe2f76e552a..0d7f5bad25f 100644
--- a/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference2.rs
@@ -1,10 +1,6 @@
 #![feature(type_alias_impl_trait)]
 #![allow(dead_code)]
 
-//@ revisions: current next
-//@ ignore-compare-mode-next-solver (explicit revisions)
-//@[next] compile-flags: -Znext-solver
-
 use std::fmt::Debug;
 
 type FooX = impl Debug;
@@ -15,9 +11,8 @@ impl Foo<()> for () {}
 impl Foo<u32> for () {}
 
 fn foo() -> impl Foo<FooX> {
-    //[current]~^ ERROR: cannot satisfy `(): Foo<FooX>`
+    //~^ ERROR: the trait bound `(): Foo<FooX>` is not satisfied
     ()
-    //[next]~^ ERROR: cannot satisfy `impl Foo<FooX> == ()`
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/nested-tait-inference2.stderr b/tests/ui/type-alias-impl-trait/nested-tait-inference2.stderr
new file mode 100644
index 00000000000..241342b0509
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/nested-tait-inference2.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `(): Foo<FooX>` is not satisfied
+  --> $DIR/nested-tait-inference2.rs:13:13
+   |
+LL | fn foo() -> impl Foo<FooX> {
+   |             ^^^^^^^^^^^^^^ the trait `Foo<FooX>` is not implemented for `()`
+LL |
+LL |     ()
+   |     -- return type was inferred to be `()` here
+   |
+   = help: the following other types implement trait `Foo<A>`:
+             <() as Foo<()>>
+             <() as Foo<u32>>
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr b/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr
index eff29303bf1..a40dac06a01 100644
--- a/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr
+++ b/tests/ui/type-alias-impl-trait/normalize-hidden-types.current.stderr
@@ -22,17 +22,21 @@ note: previous use here
 LL |     fn define_1() -> Opaque { dyn_hoops::<_>(0) }
    |                               ^^^^^^^^^^^^^^^^^
 
-error: concrete type differs from previous defining opaque type use
+error[E0308]: mismatched types
   --> $DIR/normalize-hidden-types.rs:43:25
    |
+LL |     type Opaque = impl Sized;
+   |                   ---------- the expected opaque type
+...
 LL |         let _: Opaque = dyn_hoops::<u8>(0);
-   |                         ^^^^^^^^^^^^^^^^^^ expected `*const (dyn FnOnce(()) + 'static)`, got `*const dyn for<'a> FnOnce(<u8 as Trait>::Gat<'a>)`
-   |
-note: previous use here
-  --> $DIR/normalize-hidden-types.rs:44:9
-   |
-LL |         None
-   |         ^^^^
+   |                ------   ^^^^^^^^^^^^^^^^^^ expected opaque type, found `*const dyn FnOnce(())`
+   |                |
+   |                expected due to this
+   |
+   = note: expected opaque type `typeck::Opaque`
+              found raw pointer `*const (dyn FnOnce(()) + 'static)`
+   = help: consider constraining the associated type `<u8 as Trait>::Gat<'_>` to `()` or calling a method that returns `<u8 as Trait>::Gat<'_>`
+   = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
 
 error: concrete type differs from previous defining opaque type use
   --> $DIR/normalize-hidden-types.rs:52:25
@@ -48,3 +52,4 @@ LL |         None
 
 error: aborting due to 4 previous errors
 
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr
new file mode 100644
index 00000000000..3ae3590ca7f
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/self-referential-2.current.stderr
@@ -0,0 +1,14 @@
+error[E0277]: can't compare `i32` with `Foo`
+  --> $DIR/self-referential-2.rs:10:13
+   |
+LL | fn bar() -> Bar {
+   |             ^^^ no implementation for `i32 == Foo`
+LL |     42_i32
+   |     ------ return type was inferred to be `i32` here
+   |
+   = help: the trait `PartialEq<Foo>` is not implemented for `i32`
+   = help: the trait `PartialEq` is implemented for `i32`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/type-alias-impl-trait/self-referential-2.rs b/tests/ui/type-alias-impl-trait/self-referential-2.rs
index f4102f2e2cb..f96364ccfcd 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-2.rs
+++ b/tests/ui/type-alias-impl-trait/self-referential-2.rs
@@ -1,14 +1,14 @@
 //@ revisions: current next
 //@ ignore-compare-mode-next-solver (explicit revisions)
 //@[next] compile-flags: -Znext-solver
-//@ check-pass
+//@[next] check-pass
 #![feature(type_alias_impl_trait)]
 
 type Foo = impl std::fmt::Debug;
 type Bar = impl PartialEq<Foo>;
 
 fn bar() -> Bar {
-    42_i32
+    42_i32 //[current]~^ ERROR can't compare `i32` with `Foo`
 }
 
 fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.rs b/tests/ui/type-alias-impl-trait/self-referential-3.rs
index 3b015ab322a..b33051da2d7 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-3.rs
+++ b/tests/ui/type-alias-impl-trait/self-referential-3.rs
@@ -5,7 +5,7 @@
 type Bar<'a, 'b> = impl PartialEq<Bar<'a, 'b>> + std::fmt::Debug;
 
 fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
-    //~^ ERROR overflow normalizing the type alias `Bar<'a, 'b>`
+    //~^ ERROR can't compare `&i32` with `Bar<'a, 'b>`
     i
 }
 
diff --git a/tests/ui/type-alias-impl-trait/self-referential-3.stderr b/tests/ui/type-alias-impl-trait/self-referential-3.stderr
index caa9f9691dd..32eac622e51 100644
--- a/tests/ui/type-alias-impl-trait/self-referential-3.stderr
+++ b/tests/ui/type-alias-impl-trait/self-referential-3.stderr
@@ -1,11 +1,15 @@
-error[E0275]: overflow normalizing the type alias `Bar<'a, 'b>`
+error[E0277]: can't compare `&i32` with `Bar<'a, 'b>`
   --> $DIR/self-referential-3.rs:7:31
    |
 LL | fn bar<'a, 'b>(i: &'a i32) -> Bar<'a, 'b> {
-   |                               ^^^^^^^^^^^
+   |                               ^^^^^^^^^^^ no implementation for `&i32 == Bar<'a, 'b>`
+LL |
+LL |     i
+   |     - return type was inferred to be `&i32` here
    |
-   = note: in case this is a recursive type alias, consider using a struct, enum, or union instead
+   = help: the trait `PartialEq<Bar<'a, 'b>>` is not implemented for `&i32`
+   = help: the trait `PartialEq` is implemented for `i32`
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0277`.