Update with final comments

This commit is contained in:
kadmin 2022-01-14 19:01:35 +00:00
parent 1c1ce2fbda
commit b77bb5cb25
6 changed files with 10 additions and 31 deletions

View File

@ -756,7 +756,7 @@ fn evaluate_nested_obligations(
// when we started out trying to unify // when we started out trying to unify
// some inference variables. See the comment above // some inference variables. See the comment above
// for more infomration // 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( if !self.evaluate_nested_obligations(
ty, ty,
v.into_iter(), v.into_iter(),

View File

@ -1804,11 +1804,11 @@ fn maybe_report_ambiguity(
} }
ty::PredicateKind::Projection(data) => { ty::PredicateKind::Projection(data) => {
let self_ty = data.projection_ty.self_ty(); 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() { if predicate.references_error() || self.is_tainted_by_errors() {
return; 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. // We do this for the `foo.collect()?` case to produce a suggestion.
let mut err = self.emit_inference_failure_err( let mut err = self.emit_inference_failure_err(
body_id, body_id,

View File

@ -1802,7 +1802,7 @@ fn confirm_param_env_candidate<'cx, 'tcx>(
Ok(InferOk { value: _, obligations }) => { Ok(InferOk { value: _, obligations }) => {
nested_obligations.extend(obligations); nested_obligations.extend(obligations);
assoc_ty_own_obligations(selcx, obligation, &mut nested_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. // a term instead.
Progress { ty: cache_entry.term.ty().unwrap(), obligations: nested_obligations } Progress { ty: cache_entry.term.ty().unwrap(), obligations: nested_obligations }
} }

View File

@ -1403,9 +1403,7 @@ trait here instead: `trait NewTrait: {} {{}}`",
// `trait_object_dummy_self`, so check for that. // `trait_object_dummy_self`, so check for that.
let references_self = match pred.skip_binder().term { let references_self = match pred.skip_binder().term {
ty::Term::Ty(ty) => ty.walk().any(|arg| arg == dummy_self.into()), ty::Term::Ty(ty) => ty.walk().any(|arg| arg == dummy_self.into()),
ty::Term::Const(c) => { ty::Term::Const(c) => c.ty.walk().any(|arg| arg == dummy_self.into()),
c.ty.walk().any(|arg| arg == dummy_self.into())
}
}; };
// If the projection output contains `Self`, force the user to // If the projection output contains `Self`, force the user to

View File

@ -1,3 +1,5 @@
#![feature(associated_const_equality)]
pub trait Foo { pub trait Foo {
const N: usize; const N: usize;
} }
@ -13,9 +15,7 @@ impl Foo for Bar {
fn foo<F: Foo<N=3>>() {} fn foo<F: Foo<N=3>>() {}
//~^ ERROR associated const equality is incomplete //~^ ERROR associated const equality is incomplete
//~| ERROR associated const equality is incomplete
fn bar<F: Foo<N={TEST}>>() {} fn bar<F: Foo<N={TEST}>>() {}
//~^ ERROR associated const equality is incomplete //~^ ERROR associated const equality is incomplete
//~| ERROR associated const equality is incomplete
fn main() {} fn main() {}

View File

@ -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 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>>() {} LL | fn foo<F: Foo<N=3>>() {}
| ^^^ cannot yet relate associated const | ^^^ cannot yet relate associated const
error: associated const equality is incomplete 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}>>() {} LL | fn bar<F: Foo<N={TEST}>>() {}
| ^^^^^^^^ cannot yet relate associated const | ^^^^^^^^ 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`.