@@ -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:: { CRATE_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 
@@ -193,8 +175,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
193175            return ; 
194176        } 
195177
196-         let  meta_sized_did = tcx. require_lang_item ( LangItem :: MetaSized ,  span) ; 
197-         let  pointee_sized_did = tcx. require_lang_item ( LangItem :: PointeeSized ,  span) ; 
178+         let  meta_sized_did = tcx. require_lang_item ( hir :: LangItem :: MetaSized ,  span) ; 
179+         let  pointee_sized_did = tcx. require_lang_item ( hir :: LangItem :: PointeeSized ,  span) ; 
198180
199181        // If adding sizedness bounds to a trait, then there are some relevant early exits 
200182        if  let  Some ( trait_did)  = trait_did { 
@@ -244,7 +226,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
244226            }  else  { 
245227                // If there are no explicit sizedness bounds on a parameter then add a default 
246228                // `Sized` bound. 
247-                 let  sized_did = tcx. require_lang_item ( LangItem :: Sized ,  span) ; 
229+                 let  sized_did = tcx. require_lang_item ( hir :: LangItem :: Sized ,  span) ; 
248230                add_trait_bound ( tcx,  bounds,  self_ty,  sized_did,  span) ; 
249231            } 
250232        } 
@@ -476,10 +458,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
476458        ' tcx :  ' hir , 
477459    { 
478460        for  hir_bound in  hir_bounds { 
479-             if  self . should_skip_sizedness_bound ( hir_bound)  { 
480-                 continue ; 
481-             } 
482- 
483461            // In order to avoid cycles, when we're lowering `SelfTraitThatDefines`, 
484462            // we skip over any traits that don't define the given associated type. 
485463            if  let  PredicateFilter :: SelfTraitThatDefines ( assoc_ident)  = predicate_filter { 
0 commit comments