Skip to content

Commit

Permalink
Update with final comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKnodt committed Jan 17, 2022
1 parent 1c1ce2f commit b77bb5c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 31 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_typeck/src/astconv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/associated-consts/assoc-const.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![feature(associated_const_equality)]

pub trait Foo {
const N: usize;
}
Expand All @@ -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() {}
25 changes: 3 additions & 22 deletions src/test/ui/associated-consts/assoc-const.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit b77bb5c

Please sign in to comment.