Skip to content
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

don't bless proc_macro_deps.rs unless it's necessary #135193

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,17 @@ fn check_proc_macro_dep_list(root: &Path, cargo: &Path, bless: bool, bad: &mut b
}
// Remove the proc-macro crates themselves
proc_macro_deps.retain(|pkg| !is_proc_macro_pkg(&metadata[pkg]));
let proc_macro_deps_iter = proc_macro_deps.into_iter().map(|dep| metadata[dep].name.clone());

if bless {
let mut proc_macro_deps: Vec<_> = proc_macro_deps_iter.collect();
let proc_macro_deps: HashSet<_> =
proc_macro_deps.into_iter().map(|dep| metadata[dep].name.clone()).collect();
let expected = proc_macro_deps::CRATES.iter().map(|s| s.to_string()).collect::<HashSet<_>>();

let needs_blessing = proc_macro_deps.difference(&expected).next().is_some()
|| expected.difference(&proc_macro_deps).next().is_some();

if needs_blessing && bless {
let mut proc_macro_deps: Vec<_> = proc_macro_deps.into_iter().collect();
proc_macro_deps.sort();
proc_macro_deps.dedup();
let mut file = File::create(root.join("src/bootstrap/src/utils/proc_macro_deps.rs"))
.expect("`proc_macro_deps` should exist");
writeln!(
Expand All @@ -649,10 +654,8 @@ pub static CRATES: &[&str] = &[
)
.unwrap();
} else {
let proc_macro_deps: HashSet<_> = proc_macro_deps_iter.collect();
let expected =
proc_macro_deps::CRATES.iter().map(|s| s.to_string()).collect::<HashSet<_>>();
let old_bad = *bad;

for missing in proc_macro_deps.difference(&expected) {
tidy_error!(
bad,
Expand Down
Loading