Prepare semver check for toolchain 1.87 (#3607)

* Honor 1.87's changed `attr`s

* re-gen api-baseline
This commit is contained in:
Björn Quentin 2025-06-06 14:32:53 +02:00 committed by GitHub
parent 5b56cbd559
commit b88ed17c1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 22 additions and 1 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -123,9 +123,11 @@ pub(crate) fn remove_unstable_items(path: &Path) -> Result<(), anyhow::Error> {
// first pass - just look for cfg-gated items
//
// the string to match depends on the rustfmt-json version!
// later version emit `#[<cfg>(...` instead
// later version emit `#[<cfg>(...` instead of `#[cfg(..`
let cfg_gates = vec![
"#[<cfg>(any(doc, feature = \"unstable\"))]",
"#[cfg(any(doc, feature = \"unstable\"))]",
"#[<cfg>(feature = \"unstable\")]",
"#[cfg(feature = \"unstable\")]",
];
@ -135,7 +137,26 @@ pub(crate) fn remove_unstable_items(path: &Path) -> Result<(), anyhow::Error> {
.iter()
.any(|attr| cfg_gates.contains(&attr.as_str()))
{
// remove the item itself
to_remove.push(id.clone());
// remove sub-items - shouldn't be needed but shouldn't hurt
match &item.inner {
ItemEnum::Module(module) => {
to_remove.extend(&module.items);
}
ItemEnum::Struct(s) => {
to_remove.extend(&s.impls);
}
ItemEnum::Enum(e) => {
to_remove.extend(&e.impls);
to_remove.extend(&e.variants);
}
ItemEnum::Impl(i) => {
to_remove.extend(&i.items);
}
_ => (),
}
}
}