@@ -240,7 +240,7 @@ impl<'tcx> Const<'tcx> {
240
240
241
241
let ty = tcx. type_of ( def) . no_bound_vars ( ) . expect ( "const parameter types cannot be generic" ) ;
242
242
243
- match Self :: try_from_lit_or_param ( tcx, ty, expr) {
243
+ match Self :: try_from_lit ( tcx, ty, expr) {
244
244
Some ( v) => v,
245
245
None => ty:: Const :: new_unevaluated ( tcx, ty:: UnevaluatedConst {
246
246
def : def. to_def_id ( ) ,
@@ -278,11 +278,7 @@ impl<'tcx> Const<'tcx> {
278
278
}
279
279
280
280
#[ instrument( skip( tcx) , level = "debug" ) ]
281
- fn try_from_lit_or_param (
282
- tcx : TyCtxt < ' tcx > ,
283
- ty : Ty < ' tcx > ,
284
- expr : & ' tcx hir:: Expr < ' tcx > ,
285
- ) -> Option < Self > {
281
+ fn try_from_lit ( tcx : TyCtxt < ' tcx > , ty : Ty < ' tcx > , expr : & ' tcx hir:: Expr < ' tcx > ) -> Option < Self > {
286
282
// Unwrap a block, so that e.g. `{ P }` is recognised as a parameter. Const arguments
287
283
// currently have to be wrapped in curly brackets, so it's necessary to special-case.
288
284
let expr = match & expr. kind {
@@ -321,7 +317,7 @@ impl<'tcx> Const<'tcx> {
321
317
Err ( e) => {
322
318
tcx. dcx ( ) . span_delayed_bug (
323
319
expr. span ,
324
- format ! ( "Const::from_anon_const : couldn't lit_to_const {e:?}" ) ,
320
+ format ! ( "Const::try_from_lit : couldn't lit_to_const {e:?}" ) ,
325
321
) ;
326
322
}
327
323
}
0 commit comments