Return ConstStability instead of &ConstStability in Item::const_stability
This commit is contained in:
parent
b647c90262
commit
02782bba60
3 changed files with 5 additions and 8 deletions
|
@ -376,8 +376,8 @@ impl Item {
|
||||||
self.def_id.as_def_id().and_then(|did| tcx.lookup_stability(did))
|
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> {
|
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))
|
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> {
|
crate fn deprecation(&self, tcx: TyCtxt<'_>) -> Option<Deprecation> {
|
||||||
|
|
|
@ -1349,10 +1349,7 @@ impl PrintWithSpace for hir::Mutability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
crate fn print_constness_with_space(
|
crate fn print_constness_with_space(c: &hir::Constness, s: Option<ConstStability>) -> &'static str {
|
||||||
c: &hir::Constness,
|
|
||||||
s: Option<&ConstStability>,
|
|
||||||
) -> &'static str {
|
|
||||||
match (c, s) {
|
match (c, s) {
|
||||||
// const stable or when feature(staged_api) is not set
|
// const stable or when feature(staged_api) is not set
|
||||||
(
|
(
|
||||||
|
|
|
@ -805,7 +805,7 @@ fn assoc_type(
|
||||||
fn render_stability_since_raw(
|
fn render_stability_since_raw(
|
||||||
w: &mut Buffer,
|
w: &mut Buffer,
|
||||||
ver: Option<Symbol>,
|
ver: Option<Symbol>,
|
||||||
const_stability: Option<&ConstStability>,
|
const_stability: Option<ConstStability>,
|
||||||
containing_ver: Option<Symbol>,
|
containing_ver: Option<Symbol>,
|
||||||
containing_const_ver: Option<Symbol>,
|
containing_const_ver: Option<Symbol>,
|
||||||
) {
|
) {
|
||||||
|
@ -814,7 +814,7 @@ fn render_stability_since_raw(
|
||||||
match (ver, const_stability) {
|
match (ver, const_stability) {
|
||||||
// stable and const stable
|
// stable and const stable
|
||||||
(Some(v), Some(ConstStability { level: StabilityLevel::Stable { since }, .. }))
|
(Some(v), Some(ConstStability { level: StabilityLevel::Stable { since }, .. }))
|
||||||
if Some(*since) != containing_const_ver =>
|
if Some(since) != containing_const_ver =>
|
||||||
{
|
{
|
||||||
write!(
|
write!(
|
||||||
w,
|
w,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue