diff options
6 files changed, 10 insertions, 31 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index e2afea76b77..f2ed5ae26a3 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -756,7 +756,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { // when we started out trying to unify // some inference variables. See the comment above // for more infomration - if p.term().skip_binder().ty().has_infer_types() { + if p.term().skip_binder().has_infer_types() { if !self.evaluate_nested_obligations( ty, v.into_iter(), diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 65385851d05..f89349505be 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1804,11 +1804,11 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { } ty::PredicateKind::Projection(data) => { let self_ty = data.projection_ty.self_ty(); - let ty = data.term.ty(); + let term = data.term; if predicate.references_error() || self.is_tainted_by_errors() { return; } - if self_ty.needs_infer() && ty.needs_infer() { + if self_ty.needs_infer() && term.needs_infer() { // We do this for the `foo.collect()?` case to produce a suggestion. let mut err = self.emit_inference_failure_err( body_id, diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 2bbdb72a4fb..f49f53351aa 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1802,7 +1802,7 @@ fn confirm_param_env_candidate<'cx, 'tcx>( Ok(InferOk { value: _, obligations }) => { nested_obligations.extend(obligations); assoc_ty_own_obligations(selcx, obligation, &mut nested_obligations); - // FIXME(...): Handle consts here as well? Maybe this progress type should just take + // FIXME(associated_const_equality): Handle consts here as well? Maybe this progress type should just take // a term instead. Progress { ty: cache_entry.term.ty().unwrap(), obligations: nested_obligations } } diff --git a/compiler/rustc_typeck/src/astconv/mod.rs b/compiler/rustc_typeck/src/astconv/mod.rs index a1f1adb8058..7c53e49e280 100644 --- a/compiler/rustc_typeck/src/astconv/mod.rs +++ b/compiler/rustc_typeck/src/astconv/mod.rs @@ -1403,9 +1403,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { // `trait_object_dummy_self`, so check for that. let references_self = match pred.skip_binder().term { ty::Term::Ty(ty) => ty.walk().any(|arg| arg == dummy_self.into()), - ty::Term::Const(c) => { - c.ty.walk().any(|arg| arg == dummy_self.into()) - } + ty::Term::Const(c) => c.ty.walk().any(|arg| arg == dummy_self.into()), }; // If the projection output contains `Self`, force the user to diff --git a/src/test/ui/associated-consts/assoc-const.rs b/src/test/ui/associated-consts/assoc-const.rs index 9e6bfa346ec..cd4b42f9f84 100644 --- a/src/test/ui/associated-consts/assoc-const.rs +++ b/src/test/ui/associated-consts/assoc-const.rs @@ -1,3 +1,5 @@ +#![feature(associated_const_equality)] + pub trait Foo { const N: usize; } @@ -13,9 +15,7 @@ const TEST:usize = 3; fn foo<F: Foo<N=3>>() {} //~^ ERROR associated const equality is incomplete -//~| ERROR associated const equality is incomplete fn bar<F: Foo<N={TEST}>>() {} //~^ ERROR associated const equality is incomplete -//~| ERROR associated const equality is incomplete fn main() {} diff --git a/src/test/ui/associated-consts/assoc-const.stderr b/src/test/ui/associated-consts/assoc-const.stderr index 07da190bc8f..ccaa6fa8ee8 100644 --- a/src/test/ui/associated-consts/assoc-const.stderr +++ b/src/test/ui/associated-consts/assoc-const.stderr @@ -1,33 +1,14 @@ -error[E0658]: associated const equality is incomplete - --> $DIR/assoc-const.rs:14:15 - | -LL | fn foo<F: Foo<N=3>>() {} - | ^^^ - | - = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information - = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable - -error[E0658]: associated const equality is incomplete - --> $DIR/assoc-const.rs:17:15 - | -LL | fn bar<F: Foo<N={TEST}>>() {} - | ^^^^^^^^ - | - = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information - = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable - error: associated const equality is incomplete - --> $DIR/assoc-const.rs:14:15 + --> $DIR/assoc-const.rs:16:15 | LL | fn foo<F: Foo<N=3>>() {} | ^^^ cannot yet relate associated const error: associated const equality is incomplete - --> $DIR/assoc-const.rs:17:15 + --> $DIR/assoc-const.rs:18:15 | LL | fn bar<F: Foo<N={TEST}>>() {} | ^^^^^^^^ cannot yet relate associated const -error: aborting due to 4 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. |
