From 1ebc7eff46fb01c625ecce55a0537dcc78e58756 Mon Sep 17 00:00:00 2001 From: scalexm Date: Thu, 10 Aug 2017 14:41:24 +0200 Subject: [PATCH] Fix for the supertrait example in #43784 --- src/librustc/ty/wf.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index c24c583ad1e19..580a3aec3e870 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -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())