change usages of const_param_default query to bound_const_param_default

This commit is contained in:
Kyle Matsuda 2023-01-10 12:20:15 -07:00
parent c84917ad2e
commit bd6c63597b
4 changed files with 9 additions and 5 deletions

View File

@ -1350,7 +1350,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
// is incorrect when dealing with unused substs, for example
// for `struct Foo<const N: usize, const M: usize = { 1 - 2 }>`
// we should eagerly error.
let default_ct = tcx.const_param_default(param.def_id);
let default_ct = tcx.bound_const_param_default(param.def_id).subst_identity();
if !default_ct.needs_subst() {
wfcx.register_wf_obligation(
tcx.def_span(param.def_id),
@ -1396,7 +1396,7 @@ fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, span: Span, def_id
GenericParamDefKind::Const { .. } => {
// If the param has a default, ...
if is_our_default(param) {
let default_ct = tcx.const_param_default(param.def_id);
let default_ct = tcx.bound_const_param_default(param.def_id).subst_identity();
// ... and it's not a dependent default, ...
if !default_ct.needs_subst() {
// ... then substitute it with the default.

View File

@ -2070,7 +2070,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
hir::GenericParamKind::Const { ref default, .. } => {
let def_id = param.def_id.to_def_id();
if default.is_some() {
record!(self.tables.const_param_default[def_id] <- self.tcx.const_param_default(def_id))
record!(self.tables.const_param_default[def_id] <- self.tcx.bound_const_param_default(def_id).subst_identity())
}
}
}

View File

@ -838,7 +838,9 @@ impl ReachEverythingInTheInterfaceVisitor<'_, '_> {
GenericParamDefKind::Const { has_default } => {
self.visit(self.ev.tcx.type_of(param.def_id));
if has_default {
self.visit(self.ev.tcx.const_param_default(param.def_id));
self.visit(
self.ev.tcx.bound_const_param_default(param.def_id).subst_identity(),
);
}
}
}

View File

@ -506,7 +506,9 @@ fn clean_generic_param_def<'tcx>(
Some(def.def_id),
)),
default: match has_default {
true => Some(Box::new(cx.tcx.const_param_default(def.def_id).to_string())),
true => Some(Box::new(
cx.tcx.bound_const_param_default(def.def_id).subst_identity().to_string(),
)),
false => None,
},
},