diff options
| -rw-r--r-- | compiler/rustc_typeck/src/astconv/generics.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_typeck/src/astconv/generics.rs b/compiler/rustc_typeck/src/astconv/generics.rs index 754172b1158..451e1e05d14 100644 --- a/compiler/rustc_typeck/src/astconv/generics.rs +++ b/compiler/rustc_typeck/src/astconv/generics.rs @@ -11,6 +11,7 @@ use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::GenericArg; +use rustc_infer::infer::TyCtxtInferExt; use rustc_middle::ty::{ self, subst, subst::SubstsRef, GenericParamDef, GenericParamDefKind, Ty, TyCtxt, }; @@ -83,7 +84,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if let Some(param_local_id) = param.def_id.as_local() { let param_hir_id = tcx.hir().local_def_id_to_hir_id(param_local_id); let param_name = tcx.hir().ty_param_name(param_hir_id); - let param_type = tcx.type_of(param.def_id); + let param_type = tcx.infer_ctxt().enter(|infcx| { + infcx.resolve_numeric_literals_with_default( + infcx.resolve_vars_if_possible(tcx.type_of(param.def_id)), + ) + }); if param_type.is_suggestable() { err.span_suggestion( tcx.def_span(src_def_id), |
