@@ -6,7 +6,7 @@ use rustc_errors::struct_span_code_err;
66use rustc_hir as hir;
77use rustc_hir:: def:: { DefKind , Res } ;
88use rustc_hir:: def_id:: { DefId , LocalDefId } ;
9- use rustc_hir:: { AmbigArg , LangItem , PolyTraitRef } ;
9+ use rustc_hir:: { AmbigArg , PolyTraitRef } ;
1010use rustc_middle:: bug;
1111use rustc_middle:: ty:: {
1212 self as ty, IsSuggestable , Ty , TyCtxt , TypeSuperVisitable , TypeVisitable , TypeVisitableExt ,
@@ -124,13 +124,13 @@ fn collect_sizedness_bounds<'tcx>(
124124 self_ty_where_predicates : Option < ( LocalDefId , & ' tcx [ hir:: WherePredicate < ' tcx > ] ) > ,
125125 span : Span ,
126126) -> CollectedSizednessBounds {
127- let sized_did = tcx. require_lang_item ( LangItem :: Sized , span) ;
127+ let sized_did = tcx. require_lang_item ( hir :: LangItem :: Sized , span) ;
128128 let sized = collect_bounds ( hir_bounds, self_ty_where_predicates, sized_did) ;
129129
130- let meta_sized_did = tcx. require_lang_item ( LangItem :: MetaSized , span) ;
130+ let meta_sized_did = tcx. require_lang_item ( hir :: LangItem :: MetaSized , span) ;
131131 let meta_sized = collect_bounds ( hir_bounds, self_ty_where_predicates, meta_sized_did) ;
132132
133- let pointee_sized_did = tcx. require_lang_item ( LangItem :: PointeeSized , span) ;
133+ let pointee_sized_did = tcx. require_lang_item ( hir :: LangItem :: PointeeSized , span) ;
134134 let pointee_sized = collect_bounds ( hir_bounds, self_ty_where_predicates, pointee_sized_did) ;
135135
136136 CollectedSizednessBounds { sized, meta_sized, pointee_sized }
@@ -151,24 +151,6 @@ fn add_trait_bound<'tcx>(
151151}
152152
153153impl < ' tcx > dyn HirTyLowerer < ' tcx > + ' _ {
154- /// Skip `PointeeSized` bounds.
155- ///
156- /// `PointeeSized` is a "fake bound" insofar as anywhere a `PointeeSized` bound exists, there
157- /// is actually the absence of any bounds. This avoids limitations around non-global where
158- /// clauses being preferred over item bounds (where `PointeeSized` bounds would be
159- /// proven) - which can result in errors when a `PointeeSized` supertrait/bound/predicate is
160- /// added to some items.
161- pub ( crate ) fn should_skip_sizedness_bound < ' hir > (
162- & self ,
163- bound : & ' hir hir:: GenericBound < ' tcx > ,
164- ) -> bool {
165- bound
166- . trait_ref ( )
167- . and_then ( |tr| tr. trait_def_id ( ) )
168- . map ( |did| self . tcx ( ) . is_lang_item ( did, LangItem :: PointeeSized ) )
169- . unwrap_or ( false )
170- }
171-
172154 /// Adds sizedness bounds to a trait, trait alias, parameter, opaque type or associated type.
173155 ///
174156 /// - On parameters, opaque type and associated types, add default `Sized` bound if no explicit
@@ -188,8 +170,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
188170 ) {
189171 let tcx = self . tcx ( ) ;
190172
191- let meta_sized_did = tcx. require_lang_item ( LangItem :: MetaSized , span) ;
192- let pointee_sized_did = tcx. require_lang_item ( LangItem :: PointeeSized , span) ;
173+ let meta_sized_did = tcx. require_lang_item ( hir :: LangItem :: MetaSized , span) ;
174+ let pointee_sized_did = tcx. require_lang_item ( hir :: LangItem :: PointeeSized , span) ;
193175
194176 // If adding sizedness bounds to a trait, then there are some relevant early exits
195177 if let Some ( trait_did) = trait_did {
@@ -230,7 +212,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
230212 } else {
231213 // If there are no explicit sizedness bounds on a parameter then add a default
232214 // `Sized` bound.
233- let sized_did = tcx. require_lang_item ( LangItem :: Sized , span) ;
215+ let sized_did = tcx. require_lang_item ( hir :: LangItem :: Sized , span) ;
234216 add_trait_bound ( tcx, bounds, self_ty, sized_did, span) ;
235217 }
236218 }
@@ -465,10 +447,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
465447 ' tcx : ' hir ,
466448 {
467449 for hir_bound in hir_bounds {
468- if self . should_skip_sizedness_bound ( hir_bound) {
469- continue ;
470- }
471-
472450 // In order to avoid cycles, when we're lowering `SelfTraitThatDefines`,
473451 // we skip over any traits that don't define the given associated type.
474452 if let PredicateFilter :: SelfTraitThatDefines ( assoc_ident) = predicate_filter {
0 commit comments