-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require stabilizations to use a placeholder instead of writing out stabilization version #100591
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d06e0e5
tidy: forbid since values for features that point to the current rele…
est31 7a5b1d7
Expand the version placeholder to the current version in stability at…
est31 e576a9b
Adjust ptr_const_cast stabilization version to CURRENT_RUSTC_VERSION
est31 6e4e3e8
Adjust backtrace stabilization version to CURRENT_RUSTC_VERSION
est31 4caedba
Adjust label break value stabilization version to CURRENT_RUSTC_VERSION
est31 a2e2d76
tidy: move directory traversal utility functions into dedicated module
est31 d32ff14
Add replace-version-placeholder tool
est31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[package] | ||
name = "replace-version-placeholder" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
tidy = { path = "../tidy" } | ||
walkdir = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::path::PathBuf; | ||
use tidy::{t, walk}; | ||
|
||
pub const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION"; | ||
|
||
fn main() { | ||
let root_path: PathBuf = std::env::args_os().nth(1).expect("need path to root of repo").into(); | ||
let version_path = root_path.join("src").join("version"); | ||
let version_str = t!(std::fs::read_to_string(&version_path), version_path); | ||
let version_str = version_str.trim(); | ||
walk::walk( | ||
&root_path, | ||
&mut |path| { | ||
walk::filter_dirs(path) | ||
// We exempt these as they require the placeholder | ||
// for their operation | ||
|| path.ends_with("compiler/rustc_passes/src/lib_features.rs") | ||
|| path.ends_with("src/tools/tidy/src/features/version.rs") | ||
|| path.ends_with("src/tools/replace-version-placeholder") | ||
}, | ||
&mut |entry, contents| { | ||
if !contents.contains(VERSION_PLACEHOLDER) { | ||
return; | ||
} | ||
let new_contents = contents.replace(VERSION_PLACEHOLDER, version_str); | ||
let path = entry.path(); | ||
t!(std::fs::write(&path, new_contents), path); | ||
}, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to say that this will fail on the x86_64-gnu-stable builder, but I think we should be OK -- that builder has its channel overridden with
./configure --release-channel
, whereas here we're always reading src/ci/channel, which should be unaffected.