about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs2
-rw-r--r--compiler/rustc_hir_typeck/src/method/confirm.rs2
-rw-r--r--compiler/rustc_hir_typeck/src/method/probe.rs65
-rw-r--r--compiler/rustc_middle/src/traits/query.rs2
-rw-r--r--tests/ui/impl-trait/method-resolution.current.stderr36
-rw-r--r--tests/ui/impl-trait/method-resolution.rs9
-rw-r--r--tests/ui/impl-trait/method-resolution2.rs2
-rw-r--r--tests/ui/impl-trait/method-resolution3.current.stderr43
-rw-r--r--tests/ui/impl-trait/method-resolution3.next.stderr2
-rw-r--r--tests/ui/impl-trait/method-resolution3.rs4
-rw-r--r--tests/ui/impl-trait/method-resolution4.rs2
-rw-r--r--tests/ui/methods/opaque_param_in_ufc.rs6
-rw-r--r--tests/ui/methods/opaque_param_in_ufc.stderr36
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution2.current.stderr36
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution2.rs6
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution5.current.stderr15
-rw-r--r--tests/ui/type-alias-impl-trait/method_resolution5.rs3
17 files changed, 58 insertions, 213 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
index 94e879ae9c3..9531c002829 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
@@ -1418,7 +1418,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             let impl_ty = self.normalize(span, tcx.type_of(impl_def_id).instantiate(tcx, args));
             let self_ty = self.normalize(span, self_ty);
             match self.at(&self.misc(span), self.param_env).eq(
-                DefineOpaqueTypes::No,
+                DefineOpaqueTypes::Yes,
                 impl_ty,
                 self_ty,
             ) {
diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs
index 3c9a49e91a3..120e3239d1f 100644
--- a/compiler/rustc_hir_typeck/src/method/confirm.rs
+++ b/compiler/rustc_hir_typeck/src/method/confirm.rs
@@ -497,7 +497,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
                 args,
             })),
         );
-        match self.at(&cause, self.param_env).sup(DefineOpaqueTypes::No, method_self_ty, self_ty) {
+        match self.at(&cause, self.param_env).sup(DefineOpaqueTypes::Yes, method_self_ty, self_ty) {
             Ok(InferOk { obligations, value: () }) => {
                 self.register_predicates(obligations);
             }
diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs
index e842bba34bf..3986374a343 100644
--- a/compiler/rustc_hir_typeck/src/method/probe.rs
+++ b/compiler/rustc_hir_typeck/src/method/probe.rs
@@ -634,8 +634,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         }
     }
 
+    #[instrument(level = "debug", skip(self))]
     fn assemble_probe(&mut self, self_ty: &Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>) {
-        debug!("assemble_probe: self_ty={:?}", self_ty);
         let raw_self_ty = self_ty.value.value;
         match *raw_self_ty.kind() {
             ty::Dynamic(data, ..) if let Some(p) = data.principal() => {
@@ -713,13 +713,12 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         }
     }
 
+    #[instrument(level = "debug", skip(self))]
     fn assemble_inherent_impl_probe(&mut self, impl_def_id: DefId) {
         if !self.impl_dups.insert(impl_def_id) {
             return; // already visited
         }
 
-        debug!("assemble_inherent_impl_probe {:?}", impl_def_id);
-
         for item in self.impl_or_trait_item(impl_def_id) {
             if !self.has_applicable_self(&item) {
                 // No receiver declared. Not a candidate.
@@ -737,9 +736,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         }
     }
 
+    #[instrument(level = "debug", skip(self))]
     fn assemble_inherent_candidates_from_object(&mut self, self_ty: Ty<'tcx>) {
-        debug!("assemble_inherent_candidates_from_object(self_ty={:?})", self_ty);
-
         let principal = match self_ty.kind() {
             ty::Dynamic(ref data, ..) => Some(data),
             _ => None,
@@ -768,9 +766,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         });
     }
 
+    #[instrument(level = "debug", skip(self))]
     fn assemble_inherent_candidates_from_param(&mut self, param_ty: ty::ParamTy) {
         // FIXME: do we want to commit to this behavior for param bounds?
-        debug!("assemble_inherent_candidates_from_param(param_ty={:?})", param_ty);
 
         let bounds = self.param_env.caller_bounds().iter().filter_map(|predicate| {
             let bound_predicate = predicate.kind();
@@ -826,6 +824,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         }
     }
 
+    #[instrument(level = "debug", skip(self))]
     fn assemble_extension_candidates_for_traits_in_scope(&mut self) {
         let mut duplicates = FxHashSet::default();
         let opt_applicable_traits = self.tcx.in_scope_traits(self.scope_expr_id);
@@ -842,6 +841,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         }
     }
 
+    #[instrument(level = "debug", skip(self))]
     fn assemble_extension_candidates_for_all_traits(&mut self) {
         let mut duplicates = FxHashSet::default();
         for trait_info in suggest::all_traits(self.tcx) {
@@ -863,12 +863,12 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         }
     }
 
+    #[instrument(level = "debug", skip(self))]
     fn assemble_extension_candidates_for_trait(
         &mut self,
         import_ids: &SmallVec<[LocalDefId; 1]>,
         trait_def_id: DefId,
     ) {
-        debug!("assemble_extension_candidates_for_trait(trait_def_id={:?})", trait_def_id);
         let trait_args = self.fresh_args_for_item(self.span, trait_def_id);
         let trait_ref = ty::TraitRef::new(self.tcx, trait_def_id, trait_args);
 
@@ -958,6 +958,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
     ///////////////////////////////////////////////////////////////////////////
     // THE ACTUAL SEARCH
 
+    #[instrument(level = "debug", skip(self))]
     fn pick(mut self) -> PickResult<'tcx> {
         assert!(self.method_name.is_some());
 
@@ -1386,6 +1387,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
         }
     }
 
+    #[instrument(level = "trace", skip(self, possibly_unsatisfied_predicates), ret)]
     fn consider_probe(
         &self,
         self_ty: Ty<'tcx>,
@@ -1415,15 +1417,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
                     (xform_self_ty, xform_ret_ty) =
                         self.xform_self_ty(probe.item, impl_ty, impl_args);
                     xform_self_ty = ocx.normalize(cause, self.param_env, xform_self_ty);
-                    // FIXME: Make this `ocx.sup` once we define opaques more eagerly.
-                    match self.at(cause, self.param_env).sup(
-                        DefineOpaqueTypes::No,
-                        xform_self_ty,
-                        self_ty,
-                    ) {
-                        Ok(infer_ok) => {
-                            ocx.register_infer_ok_obligations(infer_ok);
-                        }
+                    match ocx.sup(cause, self.param_env, xform_self_ty, self_ty) {
+                        Ok(()) => {}
                         Err(err) => {
                             debug!("--> cannot relate self-types {:?}", err);
                             return ProbeResult::NoMatch;
@@ -1484,19 +1479,23 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
                     (xform_self_ty, xform_ret_ty) =
                         self.xform_self_ty(probe.item, trait_ref.self_ty(), trait_ref.args);
                     xform_self_ty = ocx.normalize(cause, self.param_env, xform_self_ty);
-                    // FIXME: Make this `ocx.sup` once we define opaques more eagerly.
-                    match self.at(cause, self.param_env).sup(
-                        DefineOpaqueTypes::No,
-                        xform_self_ty,
-                        self_ty,
-                    ) {
-                        Ok(infer_ok) => {
-                            ocx.register_infer_ok_obligations(infer_ok);
-                        }
-                        Err(err) => {
-                            debug!("--> cannot relate self-types {:?}", err);
+                    match self_ty.kind() {
+                        // HACK: opaque types will match anything for which their bounds hold.
+                        // Thus we need to prevent them from trying to match the `&_` autoref
+                        // candidates that get created for `&self` trait methods.
+                        ty::Alias(ty::Opaque, alias_ty)
+                            if self.infcx.can_define_opaque_ty(alias_ty.def_id)
+                                && !xform_self_ty.is_ty_var() =>
+                        {
                             return ProbeResult::NoMatch;
                         }
+                        _ => match ocx.sup(cause, self.param_env, xform_self_ty, self_ty) {
+                            Ok(()) => {}
+                            Err(err) => {
+                                debug!("--> cannot relate self-types {:?}", err);
+                                return ProbeResult::NoMatch;
+                            }
+                        },
                     }
                     let obligation = traits::Obligation::new(
                         self.tcx,
@@ -1536,15 +1535,8 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
                     (xform_self_ty, xform_ret_ty) =
                         self.xform_self_ty(probe.item, trait_ref.self_ty(), trait_ref.args);
                     xform_self_ty = ocx.normalize(cause, self.param_env, xform_self_ty);
-                    // FIXME: Make this `ocx.sup` once we define opaques more eagerly.
-                    match self.at(cause, self.param_env).sup(
-                        DefineOpaqueTypes::No,
-                        xform_self_ty,
-                        self_ty,
-                    ) {
-                        Ok(infer_ok) => {
-                            ocx.register_infer_ok_obligations(infer_ok);
-                        }
+                    match ocx.sup(cause, self.param_env, xform_self_ty, self_ty) {
+                        Ok(()) => {}
                         Err(err) => {
                             debug!("--> cannot relate self-types {:?}", err);
                             return ProbeResult::NoMatch;
@@ -1665,6 +1657,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
     /// Similarly to `probe_for_return_type`, this method attempts to find the best matching
     /// candidate method where the method name may have been misspelled. Similarly to other
     /// edit distance based suggestions, we provide at most one such suggestion.
+    #[instrument(level = "debug", skip(self))]
     pub(crate) fn probe_for_similar_candidate(
         &mut self,
     ) -> Result<Option<ty::AssocItem>, MethodError<'tcx>> {
diff --git a/compiler/rustc_middle/src/traits/query.rs b/compiler/rustc_middle/src/traits/query.rs
index 50b6c77e1b2..4fad721ce98 100644
--- a/compiler/rustc_middle/src/traits/query.rs
+++ b/compiler/rustc_middle/src/traits/query.rs
@@ -156,7 +156,7 @@ pub struct CandidateStep<'tcx> {
 
 #[derive(Copy, Clone, Debug, HashStable)]
 pub struct MethodAutoderefStepsResult<'tcx> {
-    /// The valid autoderef steps that could be find.
+    /// The valid autoderef steps that could be found.
     pub steps: &'tcx [CandidateStep<'tcx>],
     /// If Some(T), a type autoderef reported an error on.
     pub opt_bad_ty: Option<&'tcx MethodAutoderefBadTy<'tcx>>,
diff --git a/tests/ui/impl-trait/method-resolution.current.stderr b/tests/ui/impl-trait/method-resolution.current.stderr
deleted file mode 100644
index 6d10693c893..00000000000
--- a/tests/ui/impl-trait/method-resolution.current.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0599]: no method named `bar` found for struct `Bar<impl Sized>` in the current scope
-  --> $DIR/method-resolution.rs:23:11
-   |
-LL | struct Bar<T>(T);
-   | ------------- method `bar` not found for this struct
-...
-LL |         x.bar();
-   |           ^^^ method not found in `Bar<impl Sized>`
-   |
-   = note: the method was found for
-           - `Bar<u32>`
-
-error[E0391]: cycle detected when computing type of opaque `foo::{opaque#0}`
-  --> $DIR/method-resolution.rs:19:24
-   |
-LL | fn foo(x: bool) -> Bar<impl Sized> {
-   |                        ^^^^^^^^^^
-   |
-note: ...which requires type-checking `foo`...
-  --> $DIR/method-resolution.rs:23:9
-   |
-LL |         x.bar();
-   |         ^
-   = note: ...which requires evaluating trait selection obligation `Bar<foo::{opaque#0}>: core::marker::Unpin`...
-   = note: ...which again requires computing type of opaque `foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `foo::{opaque#0}`
-  --> $DIR/method-resolution.rs:19:24
-   |
-LL | fn foo(x: bool) -> Bar<impl Sized> {
-   |                        ^^^^^^^^^^
-   = 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 2 previous errors
-
-Some errors have detailed explanations: E0391, E0599.
-For more information about an error, try `rustc --explain E0391`.
diff --git a/tests/ui/impl-trait/method-resolution.rs b/tests/ui/impl-trait/method-resolution.rs
index 07618aa6408..60fbacd8646 100644
--- a/tests/ui/impl-trait/method-resolution.rs
+++ b/tests/ui/impl-trait/method-resolution.rs
@@ -1,10 +1,9 @@
-//! Check that we do not constrain hidden types during method resolution.
-//! Otherwise we'd pick up that calling `bar` can be satisfied iff `u32`
-//! is the hidden type of the RPIT.
+//! Since there is only one possible `bar` method, we invoke it and subsequently
+//! constrain `foo`'s RPIT to `u32`.
 
 //@ revisions: current next
 //@[next] compile-flags: -Znext-solver
-//@[next] check-pass
+//@ check-pass
 
 trait Trait {}
 
@@ -17,11 +16,9 @@ impl Bar<u32> {
 }
 
 fn foo(x: bool) -> Bar<impl Sized> {
-    //[current]~^ ERROR: cycle detected
     if x {
         let x = foo(false);
         x.bar();
-        //[current]~^ ERROR: no method named `bar` found
     }
     todo!()
 }
diff --git a/tests/ui/impl-trait/method-resolution2.rs b/tests/ui/impl-trait/method-resolution2.rs
index 2930b42b8bc..88d4f3d9896 100644
--- a/tests/ui/impl-trait/method-resolution2.rs
+++ b/tests/ui/impl-trait/method-resolution2.rs
@@ -1,5 +1,5 @@
 //! Check that the method call does not constrain the RPIT to `i32`, even though
-//! `i32` is the only trait that satisfies the RPIT's trait bounds.
+//! `i32` is the only type that satisfies the RPIT's trait bounds.
 
 //@ revisions: current next
 //@[next] compile-flags: -Znext-solver
diff --git a/tests/ui/impl-trait/method-resolution3.current.stderr b/tests/ui/impl-trait/method-resolution3.current.stderr
index 7407b489e32..87dd862ef8f 100644
--- a/tests/ui/impl-trait/method-resolution3.current.stderr
+++ b/tests/ui/impl-trait/method-resolution3.current.stderr
@@ -1,37 +1,20 @@
-error[E0599]: no method named `bar` found for struct `Bar<impl Sized>` in the current scope
-  --> $DIR/method-resolution3.rs:22:11
+error[E0034]: multiple applicable items in scope
+  --> $DIR/method-resolution3.rs:21:11
    |
-LL | struct Bar<T>(T);
-   | ------------- method `bar` not found for this struct
-...
 LL |         x.bar();
-   |           ^^^ method not found in `Bar<impl Sized>`
+   |           ^^^ multiple `bar` found
    |
-   = note: the method was found for
-           - `Bar<i32>`
-           - `Bar<u32>`
-
-error[E0391]: cycle detected when computing type of opaque `foo::{opaque#0}`
-  --> $DIR/method-resolution3.rs:18:24
-   |
-LL | fn foo(x: bool) -> Bar<impl Sized> {
-   |                        ^^^^^^^^^^
+note: candidate #1 is defined in an impl for the type `Bar<i32>`
+  --> $DIR/method-resolution3.rs:15:5
    |
-note: ...which requires type-checking `foo`...
-  --> $DIR/method-resolution3.rs:22:9
-   |
-LL |         x.bar();
-   |         ^
-   = note: ...which requires evaluating trait selection obligation `Bar<foo::{opaque#0}>: core::marker::Unpin`...
-   = note: ...which again requires computing type of opaque `foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `foo::{opaque#0}`
-  --> $DIR/method-resolution3.rs:18:24
+LL |     fn bar(self) {}
+   |     ^^^^^^^^^^^^
+note: candidate #2 is defined in an impl for the type `Bar<u32>`
+  --> $DIR/method-resolution3.rs:11:5
    |
-LL | fn foo(x: bool) -> Bar<impl Sized> {
-   |                        ^^^^^^^^^^
-   = 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
+LL |     fn bar(self) {}
+   |     ^^^^^^^^^^^^
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0391, E0599.
-For more information about an error, try `rustc --explain E0391`.
+For more information about this error, try `rustc --explain E0034`.
diff --git a/tests/ui/impl-trait/method-resolution3.next.stderr b/tests/ui/impl-trait/method-resolution3.next.stderr
index 53b77c620ba..87dd862ef8f 100644
--- a/tests/ui/impl-trait/method-resolution3.next.stderr
+++ b/tests/ui/impl-trait/method-resolution3.next.stderr
@@ -1,5 +1,5 @@
 error[E0034]: multiple applicable items in scope
-  --> $DIR/method-resolution3.rs:22:11
+  --> $DIR/method-resolution3.rs:21:11
    |
 LL |         x.bar();
    |           ^^^ multiple `bar` found
diff --git a/tests/ui/impl-trait/method-resolution3.rs b/tests/ui/impl-trait/method-resolution3.rs
index 8474e2da7db..8c47ef4fc75 100644
--- a/tests/ui/impl-trait/method-resolution3.rs
+++ b/tests/ui/impl-trait/method-resolution3.rs
@@ -16,12 +16,10 @@ impl Bar<i32> {
 }
 
 fn foo(x: bool) -> Bar<impl Sized> {
-    //[current]~^ ERROR: cycle
     if x {
         let x = foo(false);
         x.bar();
-        //[current]~^ ERROR: no method named `bar`
-        //[next]~^^ ERROR: multiple applicable items in scope
+        //~^ ERROR: multiple applicable items in scope
     }
     todo!()
 }
diff --git a/tests/ui/impl-trait/method-resolution4.rs b/tests/ui/impl-trait/method-resolution4.rs
index 3578db7cb55..91884eb59fd 100644
--- a/tests/ui/impl-trait/method-resolution4.rs
+++ b/tests/ui/impl-trait/method-resolution4.rs
@@ -4,9 +4,9 @@
 //! variable, but get a type mismatch when comparing `&mut _` with
 //! `std::iter::Empty`.
 
-//@[current] check-pass
 //@ revisions: current next
 //@[next] compile-flags: -Znext-solver
+//@[current] check-pass
 
 fn foo(b: bool) -> impl Iterator<Item = ()> {
     if b {
diff --git a/tests/ui/methods/opaque_param_in_ufc.rs b/tests/ui/methods/opaque_param_in_ufc.rs
index a4b27a0131f..b170e6805f6 100644
--- a/tests/ui/methods/opaque_param_in_ufc.rs
+++ b/tests/ui/methods/opaque_param_in_ufc.rs
@@ -1,4 +1,7 @@
 #![feature(type_alias_impl_trait)]
+
+//@ check-pass
+
 struct Foo<T>(T);
 
 impl Foo<u32> {
@@ -15,14 +18,11 @@ fn bar() -> Bar {
 impl Foo<Bar> {
     fn foo() -> Bar {
         Self::method();
-        //~^ ERROR: no function or associated item named `method` found for struct `Foo<Bar>`
         Foo::<Bar>::method();
-        //~^ ERROR: no function or associated item named `method` found for struct `Foo<Bar>`
         let x = Foo(bar());
         Foo::method2(x);
         let x = Self(bar());
         Self::method2(x);
-        //~^ ERROR: no function or associated item named `method2` found for struct `Foo<Bar>`
         todo!()
     }
 }
diff --git a/tests/ui/methods/opaque_param_in_ufc.stderr b/tests/ui/methods/opaque_param_in_ufc.stderr
deleted file mode 100644
index 7e5bbbac8a9..00000000000
--- a/tests/ui/methods/opaque_param_in_ufc.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0599]: no function or associated item named `method` found for struct `Foo<Bar>` in the current scope
-  --> $DIR/opaque_param_in_ufc.rs:17:15
-   |
-LL | struct Foo<T>(T);
-   | ------------- function or associated item `method` not found for this struct
-...
-LL |         Self::method();
-   |               ^^^^^^ function or associated item not found in `Foo<Bar>`
-   |
-   = note: the function or associated item was found for
-           - `Foo<u32>`
-
-error[E0599]: no function or associated item named `method` found for struct `Foo<Bar>` in the current scope
-  --> $DIR/opaque_param_in_ufc.rs:19:21
-   |
-LL | struct Foo<T>(T);
-   | ------------- function or associated item `method` not found for this struct
-...
-LL |         Foo::<Bar>::method();
-   |                     ^^^^^^ function or associated item not found in `Foo<Bar>`
-   |
-   = note: the function or associated item was found for
-           - `Foo<u32>`
-
-error[E0599]: no function or associated item named `method2` found for struct `Foo<Bar>` in the current scope
-  --> $DIR/opaque_param_in_ufc.rs:24:15
-   |
-LL | struct Foo<T>(T);
-   | ------------- function or associated item `method2` not found for this struct
-...
-LL |         Self::method2(x);
-   |               ^^^^^^^ function or associated item not found in `Foo<Bar>`
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/type-alias-impl-trait/method_resolution2.current.stderr b/tests/ui/type-alias-impl-trait/method_resolution2.current.stderr
deleted file mode 100644
index e68ea70a8ef..00000000000
--- a/tests/ui/type-alias-impl-trait/method_resolution2.current.stderr
+++ /dev/null
@@ -1,36 +0,0 @@
-error[E0599]: no method named `foo` found for struct `Bar<Foo>` in the current scope
-  --> $DIR/method_resolution2.rs:17:14
-   |
-LL | struct Bar<T>(T);
-   | ------------- method `foo` not found for this struct
-...
-LL |         self.foo()
-   |              ^^^ method not found in `Bar<Foo>`
-   |
-   = note: the method was found for
-           - `Bar<u32>`
-
-error[E0391]: cycle detected when computing type of opaque `Foo::{opaque#0}`
-  --> $DIR/method_resolution2.rs:10:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-   |
-note: ...which requires type-checking `<impl at $DIR/method_resolution2.rs:15:1: 15:14>::bar`...
-  --> $DIR/method_resolution2.rs:17:9
-   |
-LL |         self.foo()
-   |         ^^^^
-   = note: ...which requires evaluating trait selection obligation `Bar<Foo>: core::marker::Unpin`...
-   = note: ...which again requires computing type of opaque `Foo::{opaque#0}`, completing the cycle
-note: cycle used when computing type of `Foo::{opaque#0}`
-  --> $DIR/method_resolution2.rs:10:12
-   |
-LL | type Foo = impl Sized;
-   |            ^^^^^^^^^^
-   = 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 2 previous errors
-
-Some errors have detailed explanations: E0391, E0599.
-For more information about an error, try `rustc --explain E0391`.
diff --git a/tests/ui/type-alias-impl-trait/method_resolution2.rs b/tests/ui/type-alias-impl-trait/method_resolution2.rs
index d252f8640d4..f69661db799 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution2.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution2.rs
@@ -1,21 +1,19 @@
-//! Check that we do not unify `Bar<Foo>` with `Bar<u32>`, even though the
+//! Check that we do unify `Bar<Foo>` with `Bar<u32>`, as the
 //! `foo` method call can be resolved unambiguously by doing so.
 
 //@ revisions: current next
 //@[next] compile-flags: -Znext-solver
-//@[next] check-pass
+//@ check-pass
 
 #![feature(type_alias_impl_trait)]
 
 type Foo = impl Sized;
-//[current]~^ ERROR: cycle
 
 struct Bar<T>(T);
 
 impl Bar<Foo> {
     fn bar(self) {
         self.foo()
-        //[current]~^ ERROR: no method named `foo`
     }
 }
 
diff --git a/tests/ui/type-alias-impl-trait/method_resolution5.current.stderr b/tests/ui/type-alias-impl-trait/method_resolution5.current.stderr
deleted file mode 100644
index 193e6e14709..00000000000
--- a/tests/ui/type-alias-impl-trait/method_resolution5.current.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0599]: no method named `bar` found for struct `Bar<u32>` in the current scope
-  --> $DIR/method_resolution5.rs:25:14
-   |
-LL | struct Bar<T>(T);
-   | ------------- method `bar` not found for this struct
-...
-LL |         self.bar()
-   |              ^^^ method not found in `Bar<u32>`
-   |
-   = note: the method was found for
-           - `Bar<Foo>`
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/type-alias-impl-trait/method_resolution5.rs b/tests/ui/type-alias-impl-trait/method_resolution5.rs
index 69335c9dede..64355e4560d 100644
--- a/tests/ui/type-alias-impl-trait/method_resolution5.rs
+++ b/tests/ui/type-alias-impl-trait/method_resolution5.rs
@@ -3,7 +3,7 @@
 
 //@ revisions: current next
 //@[next] compile-flags: -Znext-solver
-//@[next] check-pass
+//@ check-pass
 
 #![feature(type_alias_impl_trait)]
 
@@ -23,7 +23,6 @@ impl Bar<u32> {
         Foo:,
     {
         self.bar()
-        //[current]~^ ERROR: no method named `bar`
     }
 }