diff --git a/src/librustc_typeck/check/implicator.rs b/src/librustc_typeck/check/implicator.rs index da25719baaa..4aaaf4ffe5a 100644 --- a/src/librustc_typeck/check/implicator.rs +++ b/src/librustc_typeck/check/implicator.rs @@ -329,6 +329,9 @@ impl<'a, 'tcx> Implicator<'a, 'tcx> { fn accumulate_from_assoc_types_transitive(&mut self, data: &ty::PolyTraitPredicate<'tcx>) { + debug!("accumulate_from_assoc_types_transitive({})", + data.repr(self.tcx())); + for poly_trait_ref in traits::supertraits(self.tcx(), data.to_poly_trait_ref()) { match ty::no_late_bound_regions(self.tcx(), &poly_trait_ref) { Some(trait_ref) => { self.accumulate_from_assoc_types(trait_ref); } @@ -340,6 +343,9 @@ impl<'a, 'tcx> Implicator<'a, 'tcx> { fn accumulate_from_assoc_types(&mut self, trait_ref: Rc<ty::TraitRef<'tcx>>) { + debug!("accumulate_from_assoc_types({})", + trait_ref.repr(self.tcx())); + let trait_def_id = trait_ref.def_id; let trait_def = ty::lookup_trait_def(self.tcx(), trait_def_id); let assoc_type_projections: Vec<_> = @@ -347,6 +353,8 @@ impl<'a, 'tcx> Implicator<'a, 'tcx> { .iter() .map(|&name| ty::mk_projection(self.tcx(), trait_ref.clone(), name)) .collect(); + debug!("accumulate_from_assoc_types: assoc_type_projections={}", + assoc_type_projections.repr(self.tcx())); let tys = match self.fully_normalize(&assoc_type_projections) { Ok(tys) => { tys } Err(ErrorReported) => { return; } diff --git a/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs index e96c345034b..6aa0cc003ce 100644 --- a/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs +++ b/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs @@ -15,12 +15,12 @@ #![allow(dead_code)] +use std::marker::PhantomFn; + /////////////////////////////////////////////////////////////////////////// -pub trait TheTrait { +pub trait TheTrait: PhantomFn<Self, Self> { type TheAssocType; - - fn dummy(&self) { } } pub trait TheSubTrait : TheTrait { diff --git a/src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs b/src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs index 7d955065ff4..dd89e0e038b 100644 --- a/src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs +++ b/src/test/compile-fail/regions-assoc-type-outlives-container-hrtb.rs @@ -14,12 +14,12 @@ #![allow(dead_code)] #![feature(rustc_attrs)] +use std::marker::PhantomFn; + /////////////////////////////////////////////////////////////////////////// -pub trait TheTrait<'b> { +pub trait TheTrait<'b> : PhantomFn<Self,Self> { type TheAssocType; - - fn dummy(&'b self) { } } pub struct TheType<'b> { diff --git a/src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs b/src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs index 6d8a02ab174..da7546ce21c 100644 --- a/src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs +++ b/src/test/compile-fail/regions-assoc-type-outlives-container-wc.rs @@ -15,12 +15,12 @@ #![allow(dead_code)] +use std::marker::PhantomFn; + /////////////////////////////////////////////////////////////////////////// -pub trait TheTrait { +pub trait TheTrait: PhantomFn<Self, Self> { type TheAssocType; - - fn dummy(&self) { } } pub struct TheType<'b> { diff --git a/src/test/compile-fail/regions-assoc-type-outlives-container.rs b/src/test/compile-fail/regions-assoc-type-outlives-container.rs index 5fafec50a4b..e1e72e6f56e 100644 --- a/src/test/compile-fail/regions-assoc-type-outlives-container.rs +++ b/src/test/compile-fail/regions-assoc-type-outlives-container.rs @@ -13,13 +13,14 @@ // outlive the location in which the type appears. Issue #22246. #![allow(dead_code)] +#![feature(rustc_attrs)] + +use std::marker::PhantomFn; /////////////////////////////////////////////////////////////////////////// -pub trait TheTrait { +pub trait TheTrait: PhantomFn<Self, Self> { type TheAssocType; - - fn dummy(&self) { } } pub struct TheType<'b> {