Expand the version placeholder to the current version in stability attribute parsing
That way, the current version is shown in rustdoc etc.
This commit is contained in:
parent
d06e0e53eb
commit
7a5b1d7939
@ -54,6 +54,14 @@ fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option<Symbol>, Span)> {
|
||||
}
|
||||
}
|
||||
}
|
||||
const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION";
|
||||
|
||||
if let Some(s) = since && s.as_str() == VERSION_PLACEHOLDER {
|
||||
let version = option_env!("CFG_VERSION").unwrap_or("<current>");
|
||||
let version = version.split(' ').next().unwrap();
|
||||
since = Some(Symbol::intern(&version));
|
||||
}
|
||||
|
||||
if let Some(feature) = feature {
|
||||
// This additional check for stability is to make sure we
|
||||
// don't emit additional, irrelevant errors for malformed
|
||||
|
Loading…
Reference in New Issue
Block a user