Descriptive variant name deprecation versions outside the standard library
This commit is contained in:
parent
e8868af75b
commit
dccf10e989
4 changed files with 8 additions and 6 deletions
|
@ -737,7 +737,7 @@ pub enum DeprecatedSince {
|
||||||
Future,
|
Future,
|
||||||
/// `feature(staged_api)` is off. Deprecation versions outside the standard
|
/// `feature(staged_api)` is off. Deprecation versions outside the standard
|
||||||
/// library are allowed to be arbitrary strings, for better or worse.
|
/// library are allowed to be arbitrary strings, for better or worse.
|
||||||
Symbol(Symbol),
|
NonStandard(Symbol),
|
||||||
/// Deprecation version is unspecified but optional.
|
/// Deprecation version is unspecified but optional.
|
||||||
Unspecified,
|
Unspecified,
|
||||||
/// Failed to parse a deprecation version, or the deprecation version is
|
/// Failed to parse a deprecation version, or the deprecation version is
|
||||||
|
@ -754,7 +754,7 @@ impl Deprecation {
|
||||||
DeprecatedSince::RustcVersion(since) => since <= RustcVersion::CURRENT,
|
DeprecatedSince::RustcVersion(since) => since <= RustcVersion::CURRENT,
|
||||||
DeprecatedSince::Future => false,
|
DeprecatedSince::Future => false,
|
||||||
// The `since` field doesn't have semantic purpose without `#![staged_api]`.
|
// The `since` field doesn't have semantic purpose without `#![staged_api]`.
|
||||||
DeprecatedSince::Symbol(_) => true,
|
DeprecatedSince::NonStandard(_) => true,
|
||||||
// Assume deprecation is in effect if "since" field is absent or invalid.
|
// Assume deprecation is in effect if "since" field is absent or invalid.
|
||||||
DeprecatedSince::Unspecified | DeprecatedSince::Err => true,
|
DeprecatedSince::Unspecified | DeprecatedSince::Err => true,
|
||||||
}
|
}
|
||||||
|
@ -871,7 +871,7 @@ pub fn find_deprecation(
|
||||||
if since.as_str() == "TBD" {
|
if since.as_str() == "TBD" {
|
||||||
DeprecatedSince::Future
|
DeprecatedSince::Future
|
||||||
} else if !is_rustc {
|
} else if !is_rustc {
|
||||||
DeprecatedSince::Symbol(since)
|
DeprecatedSince::NonStandard(since)
|
||||||
} else if let Some(version) = parse_version(since) {
|
} else if let Some(version) = parse_version(since) {
|
||||||
DeprecatedSince::RustcVersion(version)
|
DeprecatedSince::RustcVersion(version)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -162,7 +162,9 @@ fn deprecation_message(
|
||||||
DeprecatedSince::Future => {
|
DeprecatedSince::Future => {
|
||||||
format!("use of {kind} `{path}` that will be deprecated in a future Rust version")
|
format!("use of {kind} `{path}` that will be deprecated in a future Rust version")
|
||||||
}
|
}
|
||||||
DeprecatedSince::Symbol(_) | DeprecatedSince::Unspecified | DeprecatedSince::Err => {
|
DeprecatedSince::NonStandard(_)
|
||||||
|
| DeprecatedSince::Unspecified
|
||||||
|
| DeprecatedSince::Err => {
|
||||||
unreachable!("this deprecation is always in effect; {since:?}")
|
unreachable!("this deprecation is always in effect; {since:?}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,7 +628,7 @@ fn short_item_info(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DeprecatedSince::Future => String::from("Deprecating in a future Rust version"),
|
DeprecatedSince::Future => String::from("Deprecating in a future Rust version"),
|
||||||
DeprecatedSince::Symbol(since) => {
|
DeprecatedSince::NonStandard(since) => {
|
||||||
format!("Deprecated since {}", Escape(since.as_str()))
|
format!("Deprecated since {}", Escape(since.as_str()))
|
||||||
}
|
}
|
||||||
DeprecatedSince::Unspecified | DeprecatedSince::Err => String::from("Deprecated"),
|
DeprecatedSince::Unspecified | DeprecatedSince::Err => String::from("Deprecated"),
|
||||||
|
|
|
@ -143,7 +143,7 @@ pub(crate) fn from_deprecation(deprecation: rustc_attr::Deprecation) -> Deprecat
|
||||||
let since = match since {
|
let since = match since {
|
||||||
DeprecatedSince::RustcVersion(version) => Some(version.to_string()),
|
DeprecatedSince::RustcVersion(version) => Some(version.to_string()),
|
||||||
DeprecatedSince::Future => Some("TBD".to_owned()),
|
DeprecatedSince::Future => Some("TBD".to_owned()),
|
||||||
DeprecatedSince::Symbol(since) => Some(since.to_string()),
|
DeprecatedSince::NonStandard(since) => Some(since.to_string()),
|
||||||
DeprecatedSince::Unspecified | DeprecatedSince::Err => None,
|
DeprecatedSince::Unspecified | DeprecatedSince::Err => None,
|
||||||
};
|
};
|
||||||
Deprecation { since, note: note.map(|s| s.to_string()) }
|
Deprecation { since, note: note.map(|s| s.to_string()) }
|
||||||
|
|
Loading…
Add table
Reference in a new issue