Skip to content

Commit

Permalink
Fix for the supertrait example in rust-lang#43784
Browse files Browse the repository at this point in the history
  • Loading branch information
scalexm committed Aug 10, 2017
1 parent c2de81f commit 1ebc7ef
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/librustc/ty/wf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {

let cause = self.cause(traits::MiscObligation);
let param_env = self.param_env;

let implied_obligations = traits::elaborate_predicates(self.infcx.tcx, vec![
ty::Predicate::Trait(ty::Binder(
ty::TraitPredicate { trait_ref: *trait_ref }
))
]);
let implied_obligations = implied_obligations.map(|pred| {
traits::Obligation::new(cause.clone(), param_env, pred)
});
self.out.extend(implied_obligations);

self.out.extend(
trait_ref.substs.types()
.filter(|ty| !ty.has_escaping_regions())
Expand Down

0 comments on commit 1ebc7ef

Please sign in to comment.