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