Skip to content

Commit 02782bb

Browse files
Return ConstStability instead of &ConstStability in Item::const_stability
1 parent b647c90 commit 02782bb

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/librustdoc/clean/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ impl Item {
376376
self.def_id.as_def_id().and_then(|did| tcx.lookup_stability(did))
377377
}
378378

379-
crate fn const_stability<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Option<&'tcx ConstStability> {
380-
self.def_id.as_def_id().and_then(|did| tcx.lookup_const_stability(did))
379+
crate fn const_stability<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Option<ConstStability> {
380+
self.def_id.as_def_id().and_then(|did| tcx.lookup_const_stability(did)).map(|cs| *cs)
381381
}
382382

383383
crate fn deprecation(&self, tcx: TyCtxt<'_>) -> Option<Deprecation> {

src/librustdoc/html/format.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1349,10 +1349,7 @@ impl PrintWithSpace for hir::Mutability {
13491349
}
13501350
}
13511351

1352-
crate fn print_constness_with_space(
1353-
c: &hir::Constness,
1354-
s: Option<&ConstStability>,
1355-
) -> &'static str {
1352+
crate fn print_constness_with_space(c: &hir::Constness, s: Option<ConstStability>) -> &'static str {
13561353
match (c, s) {
13571354
// const stable or when feature(staged_api) is not set
13581355
(

src/librustdoc/html/render/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ fn assoc_type(
805805
fn render_stability_since_raw(
806806
w: &mut Buffer,
807807
ver: Option<Symbol>,
808-
const_stability: Option<&ConstStability>,
808+
const_stability: Option<ConstStability>,
809809
containing_ver: Option<Symbol>,
810810
containing_const_ver: Option<Symbol>,
811811
) {
@@ -814,7 +814,7 @@ fn render_stability_since_raw(
814814
match (ver, const_stability) {
815815
// stable and const stable
816816
(Some(v), Some(ConstStability { level: StabilityLevel::Stable { since }, .. }))
817-
if Some(*since) != containing_const_ver =>
817+
if Some(since) != containing_const_ver =>
818818
{
819819
write!(
820820
w,

0 commit comments

Comments
 (0)