diff options
| author | Esteban Kuber <esteban@kuber.com.ar> | 2021-12-15 23:11:26 +0000 |
|---|---|---|
| committer | Esteban Kuber <esteban@kuber.com.ar> | 2022-03-27 02:20:17 +0000 |
| commit | c4d741fa16fb1048830db7566e0b7d1a6d61be1b (patch) | |
| tree | 78b5c6118e98c8ba5b13f3f260139701a01b1437 | |
| parent | 474626af50ae9836b56a351edf59c1ca9b104b5c (diff) | |
| download | rust-c4d741fa16fb1048830db7566e0b7d1a6d61be1b.tar.gz rust-c4d741fa16fb1048830db7566e0b7d1a6d61be1b.zip | |
Also resolve `const` param suggestion
| -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), |
