@@ -103,12 +103,7 @@ pub trait HirTyLowerer<'tcx> {
103103 fn ty_infer ( & self , param : Option < & ty:: GenericParamDef > , span : Span ) -> Ty < ' tcx > ;
104104
105105 /// 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 > ;
112107
113108 /// Probe bounds in scope where the bounded type coincides with the given type parameter.
114109 ///
@@ -438,15 +433,15 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
438433
439434 fn provided_kind (
440435 & mut self ,
441- preceding_args : & [ ty:: GenericArg < ' tcx > ] ,
436+ _preceding_args : & [ ty:: GenericArg < ' tcx > ] ,
442437 param : & ty:: GenericParamDef ,
443438 arg : & GenericArg < ' tcx > ,
444439 ) -> ty:: GenericArg < ' tcx > {
445440 let tcx = self . lowerer . tcx ( ) ;
446441
447442 if let Err ( incorrect) = self . incorrect_args {
448443 if incorrect. invalid_args . contains ( & ( param. index as usize ) ) {
449- return param. to_error ( tcx, preceding_args ) ;
444+ return param. to_error ( tcx) ;
450445 }
451446 }
452447
@@ -491,16 +486,11 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
491486 ty:: Const :: from_anon_const ( tcx, did) . into ( )
492487 }
493488 ( & GenericParamDefKind :: Const { .. } , hir:: GenericArg :: Infer ( inf) ) => {
494- let ty = tcx
495- . at ( self . span )
496- . type_of ( param. def_id )
497- . no_bound_vars ( )
498- . expect ( "const parameter types cannot be generic" ) ;
499489 if self . lowerer . allow_infer ( ) {
500- self . lowerer . ct_infer ( ty , Some ( param) , inf. span ) . into ( )
490+ self . lowerer . ct_infer ( Some ( param) , inf. span ) . into ( )
501491 } else {
502492 self . inferred_params . push ( inf. span ) ;
503- ty:: Const :: new_misc_error ( tcx, ty ) . into ( )
493+ ty:: Const :: new_misc_error ( tcx) . into ( )
504494 }
505495 }
506496 ( kind, arg) => span_bug ! (
@@ -520,7 +510,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
520510
521511 if let Err ( incorrect) = self . incorrect_args {
522512 if incorrect. invalid_args . contains ( & ( param. index as usize ) ) {
523- return param. to_error ( tcx, preceding_args ) ;
513+ return param. to_error ( tcx) ;
524514 }
525515 }
526516 match param. kind {
@@ -568,7 +558,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
568558 . no_bound_vars ( )
569559 . expect ( "const parameter types cannot be generic" ) ;
570560 if let Err ( guar) = ty. error_reported ( ) {
571- return ty:: Const :: new_error ( tcx, guar, ty ) . into ( ) ;
561+ return ty:: Const :: new_error ( tcx, guar) . into ( ) ;
572562 }
573563 // FIXME(effects) see if we should special case effect params here
574564 if !infer_args && has_default {
@@ -577,10 +567,10 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
577567 . into ( )
578568 } else {
579569 if infer_args {
580- self . lowerer . ct_infer ( ty , Some ( param) , self . span ) . into ( )
570+ self . lowerer . ct_infer ( Some ( param) , self . span ) . into ( )
581571 } else {
582572 // We've already errored above about the mismatch.
583- ty:: Const :: new_misc_error ( tcx, ty ) . into ( )
573+ ty:: Const :: new_misc_error ( tcx) . into ( )
584574 }
585575 }
586576 }
@@ -1930,7 +1920,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
19301920 ///
19311921 /// Early-bound const parameters get lowered to [`ty::ConstKind::Param`]
19321922 /// and late-bound ones to [`ty::ConstKind::Bound`].
1933- pub ( crate ) fn lower_const_param ( & self , hir_id : HirId , param_ty : Ty < ' tcx > ) -> Const < ' tcx > {
1923+ pub ( crate ) fn lower_const_param ( & self , hir_id : HirId ) -> Const < ' tcx > {
19341924 let tcx = self . tcx ( ) ;
19351925 match tcx. named_bound_var ( hir_id) {
19361926 Some ( rbv:: ResolvedArg :: EarlyBound ( def_id) ) => {
@@ -1940,12 +1930,12 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
19401930 let generics = tcx. generics_of ( item_def_id) ;
19411931 let index = generics. param_def_id_to_index [ & def_id] ;
19421932 let name = tcx. item_name ( def_id) ;
1943- ty:: Const :: new_param ( tcx, ty:: ParamConst :: new ( index, name) , param_ty )
1933+ ty:: Const :: new_param ( tcx, ty:: ParamConst :: new ( index, name) )
19441934 }
19451935 Some ( rbv:: ResolvedArg :: LateBound ( debruijn, index, _) ) => {
1946- ty:: Const :: new_bound ( tcx, debruijn, ty:: BoundVar :: from_u32 ( index) , param_ty )
1936+ ty:: Const :: new_bound ( tcx, debruijn, ty:: BoundVar :: from_u32 ( index) )
19471937 }
1948- Some ( rbv:: ResolvedArg :: Error ( guar) ) => ty:: Const :: new_error ( tcx, guar, param_ty ) ,
1938+ Some ( rbv:: ResolvedArg :: Error ( guar) ) => ty:: Const :: new_error ( tcx, guar) ,
19491939 arg => bug ! ( "unexpected bound var resolution for {:?}: {arg:?}" , hir_id) ,
19501940 }
19511941 }
@@ -2161,7 +2151,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
21612151 }
21622152 hir:: TyKind :: Array ( ty, length) => {
21632153 let length = match length {
2164- hir:: ArrayLen :: Infer ( inf) => self . ct_infer ( tcx . types . usize , None , inf. span ) ,
2154+ hir:: ArrayLen :: Infer ( inf) => self . ct_infer ( None , inf. span ) ,
21652155 hir:: ArrayLen :: Body ( constant) => {
21662156 ty:: Const :: from_anon_const ( tcx, constant. def_id )
21672157 }
@@ -2199,7 +2189,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
21992189 match tcx. lit_to_const ( lit_input) {
22002190 Ok ( c) => c,
22012191 Err ( LitToConstError :: Reported ( err) ) => {
2202- ty:: Const :: new_error ( tcx, err, ty )
2192+ ty:: Const :: new_error ( tcx, err)
22032193 }
22042194 Err ( LitToConstError :: TypeError ) => todo ! ( ) ,
22052195 }
@@ -2220,19 +2210,20 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
22202210 . type_of ( def_id)
22212211 . no_bound_vars ( )
22222212 . expect ( "const parameter types cannot be generic" ) ;
2223- self . lower_const_param ( expr. hir_id , ty )
2213+ self . lower_const_param ( expr. hir_id )
22242214 }
22252215
22262216 _ => {
22272217 let err = tcx
22282218 . dcx ( )
22292219 . emit_err ( crate :: errors:: NonConstRange { span : expr. span } ) ;
2230- ty:: Const :: new_error ( tcx, err, ty )
2220+ ty:: Const :: new_error ( tcx, err)
22312221 }
22322222 } ;
2233- self . record_ty ( expr. hir_id , c. ty ( ) , expr. span ) ;
2223+ // THISPR
2224+ self . record_ty ( expr. hir_id , todo ! ( ) , expr. span ) ;
22342225 if let Some ( ( id, span) ) = neg {
2235- self . record_ty ( id, c . ty ( ) , span) ;
2226+ self . record_ty ( id, todo ! ( ) , span) ;
22362227 }
22372228 c
22382229 } ;
0 commit comments