@@ -111,12 +111,7 @@ pub trait HirTyLowerer<'tcx> {
111
111
fn ty_infer ( & self , param : Option < & ty:: GenericParamDef > , span : Span ) -> Ty < ' tcx > ;
112
112
113
113
/// Returns the const to use when a const is omitted.
114
- fn ct_infer (
115
- & self ,
116
- ty : Ty < ' tcx > ,
117
- param : Option < & ty:: GenericParamDef > ,
118
- span : Span ,
119
- ) -> Const < ' tcx > ;
114
+ fn ct_infer ( & self , param : Option < & ty:: GenericParamDef > , span : Span ) -> Const < ' tcx > ;
120
115
121
116
/// Probe bounds in scope where the bounded type coincides with the given type parameter.
122
117
///
@@ -439,15 +434,15 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
439
434
440
435
fn provided_kind (
441
436
& mut self ,
442
- preceding_args : & [ ty:: GenericArg < ' tcx > ] ,
437
+ _preceding_args : & [ ty:: GenericArg < ' tcx > ] ,
443
438
param : & ty:: GenericParamDef ,
444
439
arg : & GenericArg < ' tcx > ,
445
440
) -> ty:: GenericArg < ' tcx > {
446
441
let tcx = self . lowerer . tcx ( ) ;
447
442
448
443
if let Err ( incorrect) = self . incorrect_args {
449
444
if incorrect. invalid_args . contains ( & ( param. index as usize ) ) {
450
- return param. to_error ( tcx, preceding_args ) ;
445
+ return param. to_error ( tcx) ;
451
446
}
452
447
}
453
448
@@ -487,12 +482,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
487
482
ty:: Const :: from_anon_const ( tcx, did) . into ( )
488
483
}
489
484
( & GenericParamDefKind :: Const { .. } , hir:: GenericArg :: Infer ( inf) ) => {
490
- let ty = tcx
491
- . at ( self . span )
492
- . type_of ( param. def_id )
493
- . no_bound_vars ( )
494
- . expect ( "const parameter types cannot be generic" ) ;
495
- self . lowerer . ct_infer ( ty, Some ( param) , inf. span ) . into ( )
485
+ self . lowerer . ct_infer ( Some ( param) , inf. span ) . into ( )
496
486
}
497
487
( kind, arg) => span_bug ! (
498
488
self . span,
@@ -511,7 +501,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
511
501
512
502
if let Err ( incorrect) = self . incorrect_args {
513
503
if incorrect. invalid_args . contains ( & ( param. index as usize ) ) {
514
- return param. to_error ( tcx, preceding_args ) ;
504
+ return param. to_error ( tcx) ;
515
505
}
516
506
}
517
507
match param. kind {
@@ -548,7 +538,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
548
538
. no_bound_vars ( )
549
539
. expect ( "const parameter types cannot be generic" ) ;
550
540
if let Err ( guar) = ty. error_reported ( ) {
551
- return ty:: Const :: new_error ( tcx, guar, ty ) . into ( ) ;
541
+ return ty:: Const :: new_error ( tcx, guar) . into ( ) ;
552
542
}
553
543
// FIXME(effects) see if we should special case effect params here
554
544
if !infer_args && has_default {
@@ -557,10 +547,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
557
547
. into ( )
558
548
} else {
559
549
if infer_args {
560
- self . lowerer . ct_infer ( ty , Some ( param) , self . span ) . into ( )
550
+ self . lowerer . ct_infer ( Some ( param) , self . span ) . into ( )
561
551
} else {
562
552
// We've already errored above about the mismatch.
563
- ty:: Const :: new_misc_error ( tcx, ty ) . into ( )
553
+ ty:: Const :: new_misc_error ( tcx) . into ( )
564
554
}
565
555
}
566
556
}
@@ -1908,7 +1898,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1908
1898
///
1909
1899
/// Early-bound const parameters get lowered to [`ty::ConstKind::Param`]
1910
1900
/// and late-bound ones to [`ty::ConstKind::Bound`].
1911
- pub ( crate ) fn lower_const_param ( & self , hir_id : HirId , param_ty : Ty < ' tcx > ) -> Const < ' tcx > {
1901
+ pub ( crate ) fn lower_const_param ( & self , hir_id : HirId ) -> Const < ' tcx > {
1912
1902
let tcx = self . tcx ( ) ;
1913
1903
match tcx. named_bound_var ( hir_id) {
1914
1904
Some ( rbv:: ResolvedArg :: EarlyBound ( def_id) ) => {
@@ -1918,12 +1908,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1918
1908
let generics = tcx. generics_of ( item_def_id) ;
1919
1909
let index = generics. param_def_id_to_index [ & def_id] ;
1920
1910
let name = tcx. item_name ( def_id) ;
1921
- ty:: Const :: new_param ( tcx, ty:: ParamConst :: new ( index, name) , param_ty )
1911
+ ty:: Const :: new_param ( tcx, ty:: ParamConst :: new ( index, name) )
1922
1912
}
1923
1913
Some ( rbv:: ResolvedArg :: LateBound ( debruijn, index, _) ) => {
1924
- ty:: Const :: new_bound ( tcx, debruijn, ty:: BoundVar :: from_u32 ( index) , param_ty )
1914
+ ty:: Const :: new_bound ( tcx, debruijn, ty:: BoundVar :: from_u32 ( index) )
1925
1915
}
1926
- Some ( rbv:: ResolvedArg :: Error ( guar) ) => ty:: Const :: new_error ( tcx, guar, param_ty ) ,
1916
+ Some ( rbv:: ResolvedArg :: Error ( guar) ) => ty:: Const :: new_error ( tcx, guar) ,
1927
1917
arg => bug ! ( "unexpected bound var resolution for {:?}: {arg:?}" , hir_id) ,
1928
1918
}
1929
1919
}
@@ -2139,7 +2129,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2139
2129
}
2140
2130
hir:: TyKind :: Array ( ty, length) => {
2141
2131
let length = match length {
2142
- hir:: ArrayLen :: Infer ( inf) => self . ct_infer ( tcx . types . usize , None , inf. span ) ,
2132
+ hir:: ArrayLen :: Infer ( inf) => self . ct_infer ( None , inf. span ) ,
2143
2133
hir:: ArrayLen :: Body ( constant) => {
2144
2134
ty:: Const :: from_anon_const ( tcx, constant. def_id )
2145
2135
}
@@ -2177,7 +2167,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2177
2167
match tcx. lit_to_const ( lit_input) {
2178
2168
Ok ( c) => c,
2179
2169
Err ( LitToConstError :: Reported ( err) ) => {
2180
- ty:: Const :: new_error ( tcx, err, ty )
2170
+ ty:: Const :: new_error ( tcx, err)
2181
2171
}
2182
2172
Err ( LitToConstError :: TypeError ) => todo ! ( ) ,
2183
2173
}
@@ -2198,19 +2188,20 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2198
2188
. type_of ( def_id)
2199
2189
. no_bound_vars ( )
2200
2190
. expect ( "const parameter types cannot be generic" ) ;
2201
- self . lower_const_param ( expr. hir_id , ty )
2191
+ self . lower_const_param ( expr. hir_id )
2202
2192
}
2203
2193
2204
2194
_ => {
2205
2195
let err = tcx
2206
2196
. dcx ( )
2207
2197
. emit_err ( crate :: errors:: NonConstRange { span : expr. span } ) ;
2208
- ty:: Const :: new_error ( tcx, err, ty )
2198
+ ty:: Const :: new_error ( tcx, err)
2209
2199
}
2210
2200
} ;
2211
- self . record_ty ( expr. hir_id , c. ty ( ) , expr. span ) ;
2201
+ // THISPR
2202
+ self . record_ty ( expr. hir_id , todo ! ( ) , expr. span ) ;
2212
2203
if let Some ( ( id, span) ) = neg {
2213
- self . record_ty ( id, c . ty ( ) , span) ;
2204
+ self . record_ty ( id, todo ! ( ) , span) ;
2214
2205
}
2215
2206
c
2216
2207
} ;
0 commit comments