Skip to content

Commit bd6c635

Browse files
committed
change usages of const_param_default query to bound_const_param_default
1 parent c84917a commit bd6c635

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

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

compiler/rustc_metadata/src/rmeta/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
20702070
hir::GenericParamKind::Const { ref default, .. } => {
20712071
let def_id = param.def_id.to_def_id();
20722072
if default.is_some() {
2073-
record!(self.tables.const_param_default[def_id] <- self.tcx.const_param_default(def_id))
2073+
record!(self.tables.const_param_default[def_id] <- self.tcx.bound_const_param_default(def_id).subst_identity())
20742074
}
20752075
}
20762076
}

compiler/rustc_privacy/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,9 @@ impl ReachEverythingInTheInterfaceVisitor<'_, '_> {
838838
GenericParamDefKind::Const { has_default } => {
839839
self.visit(self.ev.tcx.type_of(param.def_id));
840840
if has_default {
841-
self.visit(self.ev.tcx.const_param_default(param.def_id));
841+
self.visit(
842+
self.ev.tcx.bound_const_param_default(param.def_id).subst_identity(),
843+
);
842844
}
843845
}
844846
}

src/librustdoc/clean/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ fn clean_generic_param_def<'tcx>(
506506
Some(def.def_id),
507507
)),
508508
default: match has_default {
509-
true => Some(Box::new(cx.tcx.const_param_default(def.def_id).to_string())),
509+
true => Some(Box::new(
510+
cx.tcx.bound_const_param_default(def.def_id).subst_identity().to_string(),
511+
)),
510512
false => None,
511513
},
512514
},

0 commit comments

Comments
 (0)