diff options
| author | bors <bors@rust-lang.org> | 2025-01-07 07:21:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-07 07:21:09 +0000 |
| commit | fb546ee09b226bc4dd4b712d35a372d923c4fa54 (patch) | |
| tree | 0c7763780646922b1a22605afa77179c12543357 | |
| parent | 6f2ca607bc03f526c3c88ba300a713609a8bdab0 (diff) | |
| parent | 80cdaeac3de16f48db1e187b2426c2517d5aa5ea (diff) | |
| download | rust-fb546ee09b226bc4dd4b712d35a372d923c4fa54.tar.gz rust-fb546ee09b226bc4dd4b712d35a372d923c4fa54.zip | |
Auto merge of #135173 - pietroalbini:pa-fix-rvp, r=workingjubilee
Avoid replacing the definition of `CURRENT_RUSTC_VERSION` Before this PR, replace-version-placeholder hardcoded the path defining CURRENT_RUSTC_VERSION (to avoid replacing it). After a refactor moved the file defining it without changing the hardcoded path, the tool started replacing the constant itself with the version number. To avoid this from happening in the future, this changes the definition of the constant to avoid the tool from ever matching it. r? `@workingjubilee`
| -rw-r--r-- | compiler/rustc_attr_data_structures/src/stability.rs | 7 | ||||
| -rw-r--r-- | src/tools/replace-version-placeholder/src/main.rs | 7 |
2 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_attr_data_structures/src/stability.rs b/compiler/rustc_attr_data_structures/src/stability.rs index 021fe40e3e0..3c77d4c766c 100644 --- a/compiler/rustc_attr_data_structures/src/stability.rs +++ b/compiler/rustc_attr_data_structures/src/stability.rs @@ -9,7 +9,12 @@ use crate::RustcVersion; /// `since` field of the `#[stable]` attribute. /// /// For more, see [this pull request](https://github.com/rust-lang/rust/pull/100591). -pub const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION"; +pub const VERSION_PLACEHOLDER: &str = concat!("CURRENT_RUSTC_VERSIO", "N"); +// Note that the `concat!` macro above prevents `src/tools/replace-version-placeholder` from +// replacing the constant with the current version. Hardcoding the tool to skip this file doesn't +// work as the file can (and at some point will) be moved around. +// +// Turning the `concat!` macro into a string literal will make Pietro cry. That'd be sad :( /// Represents the following attributes: /// diff --git a/src/tools/replace-version-placeholder/src/main.rs b/src/tools/replace-version-placeholder/src/main.rs index 247e4e7e932..88118cab235 100644 --- a/src/tools/replace-version-placeholder/src/main.rs +++ b/src/tools/replace-version-placeholder/src/main.rs @@ -11,12 +11,7 @@ fn main() { let version_str = version_str.trim(); walk::walk_many( &[&root_path.join("compiler"), &root_path.join("library")], - |path, _is_dir| { - walk::filter_dirs(path) - // We exempt these as they require the placeholder - // for their operation - || path.ends_with("compiler/rustc_attr/src/builtin.rs") - }, + |path, _is_dir| walk::filter_dirs(path), &mut |entry, contents| { if !contents.contains(VERSION_PLACEHOLDER) { return; |
