about summary refs log tree commit diff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2022-08-15 17:28:43 +0200
committerest31 <MTest31@outlook.com>2022-08-27 17:08:52 +0200
commit7a5b1d7939a39c38d3c644a9211b969319496be5 (patch)
treea22989f62e161e7ef0a2001b0f2ee6b30d47fa7d
parentd06e0e53eb083895c0a98b918699e7047f7c87d7 (diff)
downloadrust-7a5b1d7939a39c38d3c644a9211b969319496be5.tar.gz
rust-7a5b1d7939a39c38d3c644a9211b969319496be5.zip
Expand the version placeholder to the current version in stability attribute parsing
That way, the current version is shown in rustdoc etc.
-rw-r--r--compiler/rustc_passes/src/lib_features.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_passes/src/lib_features.rs b/compiler/rustc_passes/src/lib_features.rs
index 868887c66cd..70b6bfd1e58 100644
--- a/compiler/rustc_passes/src/lib_features.rs
+++ b/compiler/rustc_passes/src/lib_features.rs
@@ -54,6 +54,14 @@ impl<'tcx> LibFeatureCollector<'tcx> {
                         }
                     }
                 }
+                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