@@ -6,7 +6,7 @@ use rustc_errors::struct_span_code_err;
6
6
use rustc_hir as hir;
7
7
use rustc_hir:: def:: { DefKind , Res } ;
8
8
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
9
- use rustc_hir:: { AmbigArg , LangItem , PolyTraitRef } ;
9
+ use rustc_hir:: { AmbigArg , PolyTraitRef } ;
10
10
use rustc_middle:: bug;
11
11
use rustc_middle:: ty:: {
12
12
self as ty, IsSuggestable , Ty , TyCtxt , TypeSuperVisitable , TypeVisitable , TypeVisitableExt ,
@@ -124,13 +124,13 @@ fn collect_sizedness_bounds<'tcx>(
124
124
self_ty_where_predicates : Option < ( LocalDefId , & ' tcx [ hir:: WherePredicate < ' tcx > ] ) > ,
125
125
span : Span ,
126
126
) -> CollectedSizednessBounds {
127
- let sized_did = tcx. require_lang_item ( LangItem :: Sized , span) ;
127
+ let sized_did = tcx. require_lang_item ( hir :: LangItem :: Sized , span) ;
128
128
let sized = collect_bounds ( hir_bounds, self_ty_where_predicates, sized_did) ;
129
129
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) ;
131
131
let meta_sized = collect_bounds ( hir_bounds, self_ty_where_predicates, meta_sized_did) ;
132
132
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) ;
134
134
let pointee_sized = collect_bounds ( hir_bounds, self_ty_where_predicates, pointee_sized_did) ;
135
135
136
136
CollectedSizednessBounds { sized, meta_sized, pointee_sized }
@@ -151,24 +151,6 @@ fn add_trait_bound<'tcx>(
151
151
}
152
152
153
153
impl < ' 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
-
172
154
/// Adds sizedness bounds to a trait, trait alias, parameter, opaque type or associated type.
173
155
///
174
156
/// - On parameters, opaque type and associated types, add default `Sized` bound if no explicit
@@ -188,8 +170,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
188
170
) {
189
171
let tcx = self . tcx ( ) ;
190
172
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) ;
193
175
194
176
// If adding sizedness bounds to a trait, then there are some relevant early exits
195
177
if let Some ( trait_did) = trait_did {
@@ -230,7 +212,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
230
212
} else {
231
213
// If there are no explicit sizedness bounds on a parameter then add a default
232
214
// `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) ;
234
216
add_trait_bound ( tcx, bounds, self_ty, sized_did, span) ;
235
217
}
236
218
}
@@ -465,10 +447,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
465
447
' tcx : ' hir ,
466
448
{
467
449
for hir_bound in hir_bounds {
468
- if self . should_skip_sizedness_bound ( hir_bound) {
469
- continue ;
470
- }
471
-
472
450
// In order to avoid cycles, when we're lowering `SelfTraitThatDefines`,
473
451
// we skip over any traits that don't define the given associated type.
474
452
if let PredicateFilter :: SelfTraitThatDefines ( assoc_ident) = predicate_filter {
0 commit comments