Skip to content

Commit dccf10e

Browse files
committed
Descriptive variant name deprecation versions outside the standard library
1 parent e8868af commit dccf10e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

compiler/rustc_attr/src/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ pub enum DeprecatedSince {
737737
Future,
738738
/// `feature(staged_api)` is off. Deprecation versions outside the standard
739739
/// library are allowed to be arbitrary strings, for better or worse.
740-
Symbol(Symbol),
740+
NonStandard(Symbol),
741741
/// Deprecation version is unspecified but optional.
742742
Unspecified,
743743
/// Failed to parse a deprecation version, or the deprecation version is
@@ -754,7 +754,7 @@ impl Deprecation {
754754
DeprecatedSince::RustcVersion(since) => since <= RustcVersion::CURRENT,
755755
DeprecatedSince::Future => false,
756756
// The `since` field doesn't have semantic purpose without `#![staged_api]`.
757-
DeprecatedSince::Symbol(_) => true,
757+
DeprecatedSince::NonStandard(_) => true,
758758
// Assume deprecation is in effect if "since" field is absent or invalid.
759759
DeprecatedSince::Unspecified | DeprecatedSince::Err => true,
760760
}
@@ -871,7 +871,7 @@ pub fn find_deprecation(
871871
if since.as_str() == "TBD" {
872872
DeprecatedSince::Future
873873
} else if !is_rustc {
874-
DeprecatedSince::Symbol(since)
874+
DeprecatedSince::NonStandard(since)
875875
} else if let Some(version) = parse_version(since) {
876876
DeprecatedSince::RustcVersion(version)
877877
} else {

compiler/rustc_middle/src/middle/stability.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ fn deprecation_message(
162162
DeprecatedSince::Future => {
163163
format!("use of {kind} `{path}` that will be deprecated in a future Rust version")
164164
}
165-
DeprecatedSince::Symbol(_) | DeprecatedSince::Unspecified | DeprecatedSince::Err => {
165+
DeprecatedSince::NonStandard(_)
166+
| DeprecatedSince::Unspecified
167+
| DeprecatedSince::Err => {
166168
unreachable!("this deprecation is always in effect; {since:?}")
167169
}
168170
}

src/librustdoc/html/render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ fn short_item_info(
628628
}
629629
}
630630
DeprecatedSince::Future => String::from("Deprecating in a future Rust version"),
631-
DeprecatedSince::Symbol(since) => {
631+
DeprecatedSince::NonStandard(since) => {
632632
format!("Deprecated since {}", Escape(since.as_str()))
633633
}
634634
DeprecatedSince::Unspecified | DeprecatedSince::Err => String::from("Deprecated"),

src/librustdoc/json/conversions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub(crate) fn from_deprecation(deprecation: rustc_attr::Deprecation) -> Deprecat
143143
let since = match since {
144144
DeprecatedSince::RustcVersion(version) => Some(version.to_string()),
145145
DeprecatedSince::Future => Some("TBD".to_owned()),
146-
DeprecatedSince::Symbol(since) => Some(since.to_string()),
146+
DeprecatedSince::NonStandard(since) => Some(since.to_string()),
147147
DeprecatedSince::Unspecified | DeprecatedSince::Err => None,
148148
};
149149
Deprecation { since, note: note.map(|s| s.to_string()) }

0 commit comments

Comments
 (0)