@@ -103,12 +103,7 @@ pub trait HirTyLowerer<'tcx> {
103
103
fn ty_infer ( & self , param : Option < & ty:: GenericParamDef > , span : Span ) -> Ty < ' tcx > ;
104
104
105
105
/// Returns the const to use when a const is omitted.
106
- fn ct_infer (
107
- & self ,
108
- ty : Ty < ' tcx > ,
109
- param : Option < & ty:: GenericParamDef > ,
110
- span : Span ,
111
- ) -> Const < ' tcx > ;
106
+ fn ct_infer ( & self , param : Option < & ty:: GenericParamDef > , span : Span ) -> Const < ' tcx > ;
112
107
113
108
/// Probe bounds in scope where the bounded type coincides with the given type parameter.
114
109
///
@@ -485,16 +480,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
485
480
ty:: Const :: from_anon_const ( tcx, did) . into ( )
486
481
}
487
482
( & GenericParamDefKind :: Const { .. } , hir:: GenericArg :: Infer ( inf) ) => {
488
- let ty = tcx
489
- . at ( self . span )
490
- . type_of ( param. def_id )
491
- . no_bound_vars ( )
492
- . expect ( "const parameter types cannot be generic" ) ;
493
483
if self . lowerer . allow_infer ( ) {
494
- self . lowerer . ct_infer ( ty , Some ( param) , inf. span ) . into ( )
484
+ self . lowerer . ct_infer ( Some ( param) , inf. span ) . into ( )
495
485
} else {
496
486
self . inferred_params . push ( inf. span ) ;
497
- ty:: Const :: new_misc_error ( tcx, ty ) . into ( )
487
+ ty:: Const :: new_misc_error ( tcx) . into ( )
498
488
}
499
489
}
500
490
( kind, arg) => span_bug ! (
@@ -552,7 +542,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
552
542
. no_bound_vars ( )
553
543
. expect ( "const parameter types cannot be generic" ) ;
554
544
if let Err ( guar) = ty. error_reported ( ) {
555
- return ty:: Const :: new_error ( tcx, guar, ty ) . into ( ) ;
545
+ return ty:: Const :: new_error ( tcx, guar) . into ( ) ;
556
546
}
557
547
// FIXME(effects) see if we should special case effect params here
558
548
if !infer_args && has_default {
@@ -561,10 +551,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
561
551
. into ( )
562
552
} else {
563
553
if infer_args {
564
- self . lowerer . ct_infer ( ty , Some ( param) , self . span ) . into ( )
554
+ self . lowerer . ct_infer ( Some ( param) , self . span ) . into ( )
565
555
} else {
566
556
// We've already errored above about the mismatch.
567
- ty:: Const :: new_misc_error ( tcx, ty ) . into ( )
557
+ ty:: Const :: new_misc_error ( tcx) . into ( )
568
558
}
569
559
}
570
560
}
@@ -1914,7 +1904,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1914
1904
///
1915
1905
/// Early-bound const parameters get lowered to [`ty::ConstKind::Param`]
1916
1906
/// and late-bound ones to [`ty::ConstKind::Bound`].
1917
- pub ( crate ) fn lower_const_param ( & self , hir_id : HirId , param_ty : Ty < ' tcx > ) -> Const < ' tcx > {
1907
+ pub ( crate ) fn lower_const_param ( & self , hir_id : HirId ) -> Const < ' tcx > {
1918
1908
let tcx = self . tcx ( ) ;
1919
1909
match tcx. named_bound_var ( hir_id) {
1920
1910
Some ( rbv:: ResolvedArg :: EarlyBound ( def_id) ) => {
@@ -1924,12 +1914,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
1924
1914
let generics = tcx. generics_of ( item_def_id) ;
1925
1915
let index = generics. param_def_id_to_index [ & def_id] ;
1926
1916
let name = tcx. item_name ( def_id) ;
1927
- ty:: Const :: new_param ( tcx, ty:: ParamConst :: new ( index, name) , param_ty )
1917
+ ty:: Const :: new_param ( tcx, ty:: ParamConst :: new ( index, name) )
1928
1918
}
1929
1919
Some ( rbv:: ResolvedArg :: LateBound ( debruijn, index, _) ) => {
1930
- ty:: Const :: new_bound ( tcx, debruijn, ty:: BoundVar :: from_u32 ( index) , param_ty )
1920
+ ty:: Const :: new_bound ( tcx, debruijn, ty:: BoundVar :: from_u32 ( index) )
1931
1921
}
1932
- Some ( rbv:: ResolvedArg :: Error ( guar) ) => ty:: Const :: new_error ( tcx, guar, param_ty ) ,
1922
+ Some ( rbv:: ResolvedArg :: Error ( guar) ) => ty:: Const :: new_error ( tcx, guar) ,
1933
1923
arg => bug ! ( "unexpected bound var resolution for {:?}: {arg:?}" , hir_id) ,
1934
1924
}
1935
1925
}
@@ -2145,7 +2135,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2145
2135
}
2146
2136
hir:: TyKind :: Array ( ty, length) => {
2147
2137
let length = match length {
2148
- hir:: ArrayLen :: Infer ( inf) => self . ct_infer ( tcx . types . usize , None , inf. span ) ,
2138
+ hir:: ArrayLen :: Infer ( inf) => self . ct_infer ( None , inf. span ) ,
2149
2139
hir:: ArrayLen :: Body ( constant) => {
2150
2140
ty:: Const :: from_anon_const ( tcx, constant. def_id )
2151
2141
}
@@ -2183,7 +2173,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2183
2173
match tcx. lit_to_const ( lit_input) {
2184
2174
Ok ( c) => c,
2185
2175
Err ( LitToConstError :: Reported ( err) ) => {
2186
- ty:: Const :: new_error ( tcx, err, ty )
2176
+ ty:: Const :: new_error ( tcx, err)
2187
2177
}
2188
2178
Err ( LitToConstError :: TypeError ) => todo ! ( ) ,
2189
2179
}
@@ -2204,19 +2194,20 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
2204
2194
. type_of ( def_id)
2205
2195
. no_bound_vars ( )
2206
2196
. expect ( "const parameter types cannot be generic" ) ;
2207
- self . lower_const_param ( expr. hir_id , ty )
2197
+ self . lower_const_param ( expr. hir_id )
2208
2198
}
2209
2199
2210
2200
_ => {
2211
2201
let err = tcx
2212
2202
. dcx ( )
2213
2203
. emit_err ( crate :: errors:: NonConstRange { span : expr. span } ) ;
2214
- ty:: Const :: new_error ( tcx, err, ty )
2204
+ ty:: Const :: new_error ( tcx, err)
2215
2205
}
2216
2206
} ;
2217
- self . record_ty ( expr. hir_id , c. ty ( ) , expr. span ) ;
2207
+ // THISPR
2208
+ self . record_ty ( expr. hir_id , todo ! ( ) , expr. span ) ;
2218
2209
if let Some ( ( id, span) ) = neg {
2219
- self . record_ty ( id, c . ty ( ) , span) ;
2210
+ self . record_ty ( id, todo ! ( ) , span) ;
2220
2211
}
2221
2212
c
2222
2213
} ;
0 commit comments