Skip to content

Commit 7a5b1d7

Browse files
committed
Expand the version placeholder to the current version in stability attribute parsing
That way, the current version is shown in rustdoc etc.
1 parent d06e0e5 commit 7a5b1d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_passes/src/lib_features.rs

+8
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ impl<'tcx> LibFeatureCollector<'tcx> {
5454
}
5555
}
5656
}
57+
const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION";
58+
59+
if let Some(s) = since && s.as_str() == VERSION_PLACEHOLDER {
60+
let version = option_env!("CFG_VERSION").unwrap_or("<current>");
61+
let version = version.split(' ').next().unwrap();
62+
since = Some(Symbol::intern(&version));
63+
}
64+
5765
if let Some(feature) = feature {
5866
// This additional check for stability is to make sure we
5967
// don't emit additional, irrelevant errors for malformed

0 commit comments

Comments
 (0)