Skip to content

Commit c4d741f

Browse files
committed
Also resolve const param suggestion
1 parent 474626a commit c4d741f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/rustc_typeck/src/astconv/generics.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rustc_hir as hir;
1111
use rustc_hir::def::{DefKind, Res};
1212
use rustc_hir::def_id::DefId;
1313
use rustc_hir::GenericArg;
14+
use rustc_infer::infer::TyCtxtInferExt;
1415
use rustc_middle::ty::{
1516
self, subst, subst::SubstsRef, GenericParamDef, GenericParamDefKind, Ty, TyCtxt,
1617
};
@@ -83,7 +84,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
8384
if let Some(param_local_id) = param.def_id.as_local() {
8485
let param_hir_id = tcx.hir().local_def_id_to_hir_id(param_local_id);
8586
let param_name = tcx.hir().ty_param_name(param_hir_id);
86-
let param_type = tcx.type_of(param.def_id);
87+
let param_type = tcx.infer_ctxt().enter(|infcx| {
88+
infcx.resolve_numeric_literals_with_default(
89+
infcx.resolve_vars_if_possible(tcx.type_of(param.def_id)),
90+
)
91+
});
8792
if param_type.is_suggestable() {
8893
err.span_suggestion(
8994
tcx.def_span(src_def_id),

0 commit comments

Comments
 (0)