Skip to content

Commit

Permalink
Return ConstStability instead of &ConstStability in Item::const_stabi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
GuillaumeGomez committed Nov 30, 2021
1 parent b647c90 commit 02782bb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/librustdoc/clean/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ impl Item {
self.def_id.as_def_id().and_then(|did| tcx.lookup_stability(did))
}

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

crate fn deprecation(&self, tcx: TyCtxt<'_>) -> Option<Deprecation> {
Expand Down
5 changes: 1 addition & 4 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1349,10 +1349,7 @@ impl PrintWithSpace for hir::Mutability {
}
}

crate fn print_constness_with_space(
c: &hir::Constness,
s: Option<&ConstStability>,
) -> &'static str {
crate fn print_constness_with_space(c: &hir::Constness, s: Option<ConstStability>) -> &'static str {
match (c, s) {
// const stable or when feature(staged_api) is not set
(
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ fn assoc_type(
fn render_stability_since_raw(
w: &mut Buffer,
ver: Option<Symbol>,
const_stability: Option<&ConstStability>,
const_stability: Option<ConstStability>,
containing_ver: Option<Symbol>,
containing_const_ver: Option<Symbol>,
) {
Expand All @@ -814,7 +814,7 @@ fn render_stability_since_raw(
match (ver, const_stability) {
// stable and const stable
(Some(v), Some(ConstStability { level: StabilityLevel::Stable { since }, .. }))
if Some(*since) != containing_const_ver =>
if Some(since) != containing_const_ver =>
{
write!(
w,
Expand Down

0 comments on commit 02782bb

Please sign in to comment.