@@ -9,13 +9,13 @@ use rustc_span::{ErrorGuaranteed, Span};
9
9
use rustc_trait_selection:: traits;
10
10
use smallvec:: SmallVec ;
11
11
12
- use crate :: astconv:: { AstConv , OnlySelfBounds , PredicateFilter } ;
12
+ use crate :: astconv:: { HirTyLowerer , OnlySelfBounds , PredicateFilter } ;
13
13
use crate :: bounds:: Bounds ;
14
14
use crate :: errors;
15
15
16
- impl < ' tcx > dyn AstConv < ' tcx > + ' _ {
16
+ impl < ' tcx > dyn HirTyLowerer < ' tcx > + ' _ {
17
17
/// Sets `implicitly_sized` to true on `Bounds` if necessary
18
- pub ( crate ) fn add_implicitly_sized (
18
+ pub ( crate ) fn add_implicit_sized_bound (
19
19
& self ,
20
20
bounds : & mut Bounds < ' tcx > ,
21
21
self_ty : Ty < ' tcx > ,
@@ -114,7 +114,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
114
114
/// `param_ty` and `ast_bounds`. See `instantiate_poly_trait_ref`
115
115
/// for more details.
116
116
#[ instrument( level = "debug" , skip( self , ast_bounds, bounds) ) ]
117
- pub ( crate ) fn add_bounds < ' hir , I : Iterator < Item = & ' hir hir:: GenericBound < ' tcx > > > (
117
+ pub ( crate ) fn lower_bounds < ' hir , I : Iterator < Item = & ' hir hir:: GenericBound < ' tcx > > > (
118
118
& self ,
119
119
param_ty : Ty < ' tcx > ,
120
120
ast_bounds : I ,
@@ -142,7 +142,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
142
142
}
143
143
hir:: TraitBoundModifier :: Maybe => continue ,
144
144
} ;
145
- let _ = self . instantiate_poly_trait_ref (
145
+ let _ = self . lower_poly_trait_ref (
146
146
& poly_trait_ref. trait_ref ,
147
147
poly_trait_ref. span ,
148
148
constness,
@@ -154,7 +154,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
154
154
) ;
155
155
}
156
156
hir:: GenericBound :: Outlives ( lifetime) => {
157
- let region = self . ast_region_to_region ( lifetime, None ) ;
157
+ let region = self . lower_region ( lifetime, None ) ;
158
158
bounds. push_region_bound (
159
159
self . tcx ( ) ,
160
160
ty:: Binder :: bind_with_vars (
@@ -199,7 +199,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
199
199
PredicateFilter :: SelfOnly | PredicateFilter :: SelfThatDefines ( _) => OnlySelfBounds ( true ) ,
200
200
} ;
201
201
202
- self . add_bounds (
202
+ self . lower_bounds (
203
203
param_ty,
204
204
ast_bounds. iter ( ) . filter ( |bound| match filter {
205
205
PredicateFilter :: All
@@ -232,7 +232,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
232
232
/// `trait_ref` here will be `for<'a> T: Iterator`. The `binding` data however is from *inside*
233
233
/// the binder (e.g., `&'a u32`) and hence may reference bound regions.
234
234
#[ instrument( level = "debug" , skip( self , bounds, speculative, dup_bindings, path_span) ) ]
235
- pub ( super ) fn add_predicates_for_ast_type_binding (
235
+ pub ( super ) fn lower_assoc_item_binding (
236
236
& self ,
237
237
hir_ref_id : hir:: HirId ,
238
238
trait_ref : ty:: PolyTraitRef < ' tcx > ,
@@ -271,26 +271,23 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
271
271
ty:: AssocKind :: Type
272
272
} ;
273
273
274
- let candidate = if self . trait_defines_associated_item_named (
275
- trait_ref. def_id ( ) ,
276
- assoc_kind,
277
- binding. ident ,
278
- ) {
279
- // Simple case: The assoc item is defined in the current trait.
280
- trait_ref
281
- } else {
282
- // Otherwise, we have to walk through the supertraits to find
283
- // one that does define it.
284
- self . one_bound_for_assoc_item (
285
- || traits:: supertraits ( tcx, trait_ref) ,
286
- trait_ref. skip_binder ( ) . print_only_trait_name ( ) ,
287
- None ,
288
- assoc_kind,
289
- binding. ident ,
290
- path_span,
291
- Some ( binding) ,
292
- ) ?
293
- } ;
274
+ let candidate =
275
+ if self . trait_defines_assoc_item_named ( trait_ref. def_id ( ) , assoc_kind, binding. ident ) {
276
+ // Simple case: The assoc item is defined in the current trait.
277
+ trait_ref
278
+ } else {
279
+ // Otherwise, we have to walk through the supertraits to find
280
+ // one that does define it.
281
+ self . find_single_bound_for_assoc_item (
282
+ || traits:: supertraits ( tcx, trait_ref) ,
283
+ trait_ref. skip_binder ( ) . print_only_trait_name ( ) ,
284
+ None ,
285
+ assoc_kind,
286
+ binding. ident ,
287
+ path_span,
288
+ Some ( binding) ,
289
+ ) ?
290
+ } ;
294
291
295
292
let ( assoc_ident, def_scope) =
296
293
tcx. adjust_ident_and_get_scope ( binding. ident , candidate. def_id ( ) , hir_ref_id) ;
@@ -418,7 +415,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
418
415
infer_args : false ,
419
416
} ;
420
417
421
- let alias_args = self . create_args_for_associated_item (
418
+ let alias_args = self . lower_args_for_assoc_item (
422
419
path_span,
423
420
assoc_item. def_id ,
424
421
& item_segment,
@@ -441,7 +438,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
441
438
}
442
439
hir:: TypeBindingKind :: Equality { term } => {
443
440
let term = match term {
444
- hir:: Term :: Ty ( ty) => self . ast_ty_to_ty ( ty) . into ( ) ,
441
+ hir:: Term :: Ty ( ty) => self . lower_ty ( ty) . into ( ) ,
445
442
hir:: Term :: Const ( ct) => ty:: Const :: from_anon_const ( tcx, ct. def_id ) . into ( ) ,
446
443
} ;
447
444
@@ -506,7 +503,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
506
503
// for the `Self` type.
507
504
if !only_self_bounds. 0 {
508
505
let param_ty = Ty :: new_alias ( tcx, ty:: Projection , projection_ty. skip_binder ( ) ) ;
509
- self . add_bounds (
506
+ self . lower_bounds (
510
507
param_ty,
511
508
ast_bounds. iter ( ) ,
512
509
bounds,
0 commit comments