1
Fork 0

Add suggestions to deprecation lints

This commit is contained in:
Oliver Scherer 2019-01-30 17:47:36 +01:00
parent e4a9b5c623
commit 4056b575e2
8 changed files with 111 additions and 26 deletions

View file

@ -158,6 +158,8 @@ impl StabilityLevel {
pub struct RustcDeprecation {
pub since: Symbol,
pub reason: Symbol,
/// A text snippet used to completely replace any use of the deprecated item in an expression.
pub suggestion: Option<Symbol>,
}
/// Check if `attrs` contains an attribute like `#![feature(feature_name)]`.
@ -274,13 +276,14 @@ fn find_stability_generic<'a, I>(sess: &ParseSess,
continue 'outer
}
get_meta!(since, reason);
get_meta!(since, reason, suggestion);
match (since, reason) {
(Some(since), Some(reason)) => {
rustc_depr = Some(RustcDeprecation {
since,
reason,
suggestion,
})
}
(None, _) => {