Normalize super trait bounds when confirming object candidates
This commit is contained in:
parent
d08ab945de
commit
e674cf0200
2 changed files with 46 additions and 9 deletions
|
@ -440,15 +440,26 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let upcast_trait_ref = upcast_trait_ref.unwrap();
|
||||
|
||||
// Check supertraits hold
|
||||
nested.extend(
|
||||
tcx.super_predicates_of(trait_predicate.def_id())
|
||||
.instantiate(tcx, trait_predicate.trait_ref.substs)
|
||||
.predicates
|
||||
.into_iter()
|
||||
.map(|super_trait| {
|
||||
Obligation::new(obligation.cause.clone(), obligation.param_env, super_trait)
|
||||
}),
|
||||
);
|
||||
for super_trait in tcx
|
||||
.super_predicates_of(trait_predicate.def_id())
|
||||
.instantiate(tcx, trait_predicate.trait_ref.substs)
|
||||
.predicates
|
||||
.into_iter()
|
||||
{
|
||||
let normalized_super_trait = normalize_with_depth_to(
|
||||
self,
|
||||
obligation.param_env,
|
||||
obligation.cause.clone(),
|
||||
obligation.recursion_depth + 1,
|
||||
&super_trait,
|
||||
&mut nested,
|
||||
);
|
||||
nested.push(Obligation::new(
|
||||
obligation.cause.clone(),
|
||||
obligation.param_env.clone(),
|
||||
normalized_super_trait,
|
||||
));
|
||||
}
|
||||
|
||||
let assoc_types: Vec<_> = tcx
|
||||
.associated_items(trait_predicate.def_id())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue