Skip to content

Commit

Permalink
Unconditionally register alias-relate in projection goal
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Dec 14, 2023
1 parent 2ecba0f commit d04ecdf
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 56 deletions.
34 changes: 23 additions & 11 deletions compiler/rustc_trait_selection/src/solve/project_goals.rs
Expand Up @@ -8,16 +8,28 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
&mut self,
goal: Goal<'tcx, ProjectionPredicate<'tcx>>,
) -> QueryResult<'tcx> {
match goal.predicate.term.unpack() {
ty::TermKind::Ty(term) => {
let alias = goal.predicate.projection_ty.to_ty(self.tcx());
self.eq(goal.param_env, alias, term)?;
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
}
// FIXME(associated_const_equality): actually do something here.
ty::TermKind::Const(_) => {
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
}
}
let tcx = self.tcx();
let projection_term = match goal.predicate.term.unpack() {
ty::TermKind::Ty(_) => goal.predicate.projection_ty.to_ty(tcx).into(),
ty::TermKind::Const(_) => ty::Const::new_unevaluated(
tcx,
ty::UnevaluatedConst::new(
goal.predicate.projection_ty.def_id,
goal.predicate.projection_ty.args,
),
tcx.type_of(goal.predicate.projection_ty.def_id)
.instantiate(tcx, goal.predicate.projection_ty.args),
)
.into(),
};
self.add_goal(goal.with(
tcx,
ty::PredicateKind::AliasRelate(
projection_term,
goal.predicate.term,
ty::AliasRelationDirection::Equate,
),
));
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
}
}

This file was deleted.

This file was deleted.

@@ -1,8 +1,18 @@
error[E0284]: type annotations needed: cannot satisfy `<<Rigid as IdHigherRankedBound>::Assoc as WithAssoc<<Wrapper<Leaf> as Id>::Assoc>>::Assoc normalizes-to <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
error[E0284]: type annotations needed
--> $DIR/generalize-proj-new-universe-index-2.rs:74:5
|
LL | bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<<Rigid as IdHigherRankedBound>::Assoc as WithAssoc<<Wrapper<Leaf> as Id>::Assoc>>::Assoc normalizes-to <<Leaf as WithAssoc<_>>::Assoc as Id>::Assoc`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound`
|
= note: cannot satisfy `<<Rigid as IdHigherRankedBound>::Assoc as WithAssoc<<Wrapper<Leaf> as Id>::Assoc>>::Assoc == _`
note: required by a bound in `bound`
--> $DIR/generalize-proj-new-universe-index-2.rs:69:21
|
LL | fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
| ----- required by a bound in this function
LL | where
LL | T: WithAssoc<U, Assoc = V>,
| ^^^^^^^^^ required by this bound in `bound`

error: aborting due to 1 previous error

Expand Down

0 comments on commit d04ecdf

Please sign in to comment.