Add method for checking if deprecation is a rustc version
This commit is contained in:
parent
dccf10e989
commit
8b8906b264
@ -759,6 +759,10 @@ pub fn is_in_effect(&self) -> bool {
|
||||
DeprecatedSince::Unspecified | DeprecatedSince::Err => true,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_since_rustc_version(&self) -> bool {
|
||||
matches!(self.since, DeprecatedSince::RustcVersion(_))
|
||||
}
|
||||
}
|
||||
|
||||
/// Finds the deprecation attribute. `None` if none exists.
|
||||
|
@ -349,7 +349,7 @@ pub fn eval_stability_allow_unstable(
|
||||
// With #![staged_api], we want to emit down the whole
|
||||
// hierarchy.
|
||||
let depr_attr = &depr_entry.attr;
|
||||
if !skip || matches!(depr_attr.since, DeprecatedSince::RustcVersion(_)) {
|
||||
if !skip || depr_attr.is_since_rustc_version() {
|
||||
// Calculating message for lint involves calling `self.def_path_str`.
|
||||
// Which by default to calculate visible path will invoke expensive `visible_parent_map` query.
|
||||
// So we skip message calculation altogether, if lint is allowed.
|
||||
|
@ -196,15 +196,9 @@ fn annotate<F>(
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((
|
||||
rustc_attr::Deprecation { since: DeprecatedSince::RustcVersion(_), .. },
|
||||
span,
|
||||
)) = &depr
|
||||
{
|
||||
if stab.is_none() {
|
||||
if let Some((depr, span)) = &depr && depr.is_since_rustc_version() && stab.is_none() {
|
||||
self.tcx.sess.emit_err(errors::DeprecatedAttribute { span: *span });
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((body_stab, _span)) = body_stab {
|
||||
// FIXME: check that this item can have body stability
|
||||
|
Loading…
Reference in New Issue
Block a user