diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 92fd4625ee8..cc29d40c0be 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -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` // 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. diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 030328d1e26..f7caf30c74c 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -2070,7 +2070,7 @@ fn encode_info_for_generics(&mut self, generics: &hir::Generics<'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()) } } } diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 564cb1baa69..9ee1e012ef2 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -838,7 +838,9 @@ fn generics(&mut self) -> &mut Self { 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(), + ); } } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 025a4379f45..869c1e3512f 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -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, }, },