Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1e5b2da

Browse files
committed
Rename Since -> StableSince in preparation for a DeprecatedSince
1 parent 1dfb6b1 commit 1e5b2da

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

compiler/rustc_attr/src/builtin.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub enum StabilityLevel {
139139
/// `#[stable]`
140140
Stable {
141141
/// Rust release which stabilized this feature.
142-
since: Since,
142+
since: StableSince,
143143
/// Is this item allowed to be referred to on stable, despite being contained in unstable
144144
/// modules?
145145
allowed_through_unstable_modules: bool,
@@ -149,7 +149,7 @@ pub enum StabilityLevel {
149149
/// Rust release in which a feature is stabilized.
150150
#[derive(Encodable, Decodable, PartialEq, Copy, Clone, Debug, Eq, Hash)]
151151
#[derive(HashStable_Generic)]
152-
pub enum Since {
152+
pub enum StableSince {
153153
Version(RustcVersion),
154154
/// Stabilized in the upcoming version, whatever number that is.
155155
Current,
@@ -378,16 +378,16 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
378378

379379
let since = if let Some(since) = since {
380380
if since.as_str() == VERSION_PLACEHOLDER {
381-
Since::Current
381+
StableSince::Current
382382
} else if let Some(version) = parse_version(since) {
383-
Since::Version(version)
383+
StableSince::Version(version)
384384
} else {
385385
sess.emit_err(session_diagnostics::InvalidSince { span: attr.span });
386-
Since::Err
386+
StableSince::Err
387387
}
388388
} else {
389389
sess.emit_err(session_diagnostics::MissingSince { span: attr.span });
390-
Since::Err
390+
StableSince::Err
391391
};
392392

393393
match feature {

compiler/rustc_passes/src/stability.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
use crate::errors;
55
use rustc_attr::{
6-
self as attr, ConstStability, Since, Stability, StabilityLevel, Unstable, UnstableReason,
6+
self as attr, ConstStability, Stability, StabilityLevel, StableSince, Unstable, UnstableReason,
77
VERSION_PLACEHOLDER,
88
};
99
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
@@ -227,10 +227,10 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
227227
(&depr.as_ref().and_then(|(d, _)| d.since), &stab.level)
228228
{
229229
match stab_since {
230-
Since::Current => {
230+
StableSince::Current => {
231231
self.tcx.sess.emit_err(errors::CannotStabilizeDeprecated { span, item_sp });
232232
}
233-
Since::Version(stab_since) => {
233+
StableSince::Version(stab_since) => {
234234
// Explicit version of iter::order::lt to handle parse errors properly
235235
for (dep_v, stab_v) in iter::zip(
236236
dep_since.as_str().split('.'),
@@ -260,7 +260,7 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
260260
}
261261
}
262262
}
263-
Since::Err => {
263+
StableSince::Err => {
264264
// An error already reported. Assume the unparseable stabilization
265265
// version is older than the deprecation version.
266266
}

src/librustdoc/clean/types.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use thin_vec::ThinVec;
1212

1313
use rustc_ast as ast;
1414
use rustc_ast_pretty::pprust;
15-
use rustc_attr::{ConstStability, Deprecation, Since, Stability, StabilityLevel};
15+
use rustc_attr::{ConstStability, Deprecation, Stability, StabilityLevel, StableSince};
1616
use rustc_const_eval::const_eval::is_unstable_const_fn;
1717
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1818
use rustc_hir as hir;
@@ -585,14 +585,14 @@ impl Item {
585585
})
586586
}
587587

588-
pub(crate) fn stable_since(&self, tcx: TyCtxt<'_>) -> Option<Since> {
588+
pub(crate) fn stable_since(&self, tcx: TyCtxt<'_>) -> Option<StableSince> {
589589
match self.stability(tcx)?.level {
590590
StabilityLevel::Stable { since, .. } => Some(since),
591591
StabilityLevel::Unstable { .. } => None,
592592
}
593593
}
594594

595-
pub(crate) fn const_stable_since(&self, tcx: TyCtxt<'_>) -> Option<Since> {
595+
pub(crate) fn const_stable_since(&self, tcx: TyCtxt<'_>) -> Option<StableSince> {
596596
match self.const_stability(tcx)?.level {
597597
StabilityLevel::Stable { since, .. } => Some(since),
598598
StabilityLevel::Unstable { .. } => None,

src/librustdoc/html/render/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use std::str;
4848
use std::string::ToString;
4949

5050
use askama::Template;
51-
use rustc_attr::{ConstStability, Deprecation, Since, StabilityLevel};
51+
use rustc_attr::{ConstStability, Deprecation, StabilityLevel, StableSince};
5252
use rustc_data_structures::captures::Captures;
5353
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
5454
use rustc_hir::def_id::{DefId, DefIdSet};
@@ -912,10 +912,10 @@ fn assoc_method(
912912
/// consequence of the above rules.
913913
fn render_stability_since_raw_with_extra(
914914
w: &mut Buffer,
915-
ver: Option<Since>,
915+
ver: Option<StableSince>,
916916
const_stability: Option<ConstStability>,
917-
containing_ver: Option<Since>,
918-
containing_const_ver: Option<Since>,
917+
containing_ver: Option<StableSince>,
918+
containing_const_ver: Option<StableSince>,
919919
extra_class: &str,
920920
) -> bool {
921921
let stable_version = if ver != containing_ver && let Some(ver) = &ver {
@@ -977,21 +977,21 @@ fn render_stability_since_raw_with_extra(
977977
!stability.is_empty()
978978
}
979979

980-
fn since_to_string(since: &Since) -> Option<String> {
980+
fn since_to_string(since: &StableSince) -> Option<String> {
981981
match since {
982-
Since::Version(since) => Some(since.to_string()),
983-
Since::Current => Some(RustcVersion::CURRENT.to_string()),
984-
Since::Err => None,
982+
StableSince::Version(since) => Some(since.to_string()),
983+
StableSince::Current => Some(RustcVersion::CURRENT.to_string()),
984+
StableSince::Err => None,
985985
}
986986
}
987987

988988
#[inline]
989989
fn render_stability_since_raw(
990990
w: &mut Buffer,
991-
ver: Option<Since>,
991+
ver: Option<StableSince>,
992992
const_stability: Option<ConstStability>,
993-
containing_ver: Option<Since>,
994-
containing_const_ver: Option<Since>,
993+
containing_ver: Option<StableSince>,
994+
containing_const_ver: Option<StableSince>,
995995
) -> bool {
996996
render_stability_since_raw_with_extra(
997997
w,

src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use crate::msrvs::Msrv;
77
use hir::LangItem;
8-
use rustc_attr::Since;
8+
use rustc_attr::StableSince;
99
use rustc_const_eval::transform::check_consts::ConstCx;
1010
use rustc_hir as hir;
1111
use rustc_hir::def_id::DefId;
@@ -372,9 +372,9 @@ fn is_const_fn(tcx: TyCtxt<'_>, def_id: DefId, msrv: &Msrv) -> bool {
372372
// as a part of an unimplemented MSRV check https://github.com/rust-lang/rust/issues/65262.
373373

374374
let const_stab_rust_version = match since {
375-
Since::Version(version) => version,
376-
Since::Current => rustc_session::RustcVersion::CURRENT,
377-
Since::Err => return false,
375+
StableSince::Version(version) => version,
376+
StableSince::Current => rustc_session::RustcVersion::CURRENT,
377+
StableSince::Err => return false,
378378
};
379379

380380
msrv.meets(RustcVersion::new(

0 commit comments

Comments
 (0)