From 0a81c75ed04159cc45768a2c0a0521374de0619f Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Tue, 7 Jul 2026 13:40:23 -0400 Subject: [PATCH] tests: clean up over-constraint on LLVM feature count Upstream dropped a feature, resulting in the invalid-attribute test failing because it was expecting "and 76 more" but now it's "and 75 more". Adjust the test to do a replacement with a placeholder on that text so the test is less brittle. --- tests/ui/target-feature/invalid-attribute.rs | 1 + .../target-feature/invalid-attribute.stderr | 60 +++++++++---------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/tests/ui/target-feature/invalid-attribute.rs b/tests/ui/target-feature/invalid-attribute.rs index 968fbdc1dc7f1..cd367fb722621 100644 --- a/tests/ui/target-feature/invalid-attribute.rs +++ b/tests/ui/target-feature/invalid-attribute.rs @@ -1,6 +1,7 @@ //@ add-minicore //@ compile-flags: --target=x86_64-unknown-linux-gnu //@ needs-llvm-components: x86 +//@ normalize-stderr: "and \d+ more" -> "and X more" #![warn(unused_attributes)] #![feature(no_core)] diff --git a/tests/ui/target-feature/invalid-attribute.stderr b/tests/ui/target-feature/invalid-attribute.stderr index 702ea3bb3ba5f..abe3ab431635f 100644 --- a/tests/ui/target-feature/invalid-attribute.stderr +++ b/tests/ui/target-feature/invalid-attribute.stderr @@ -1,5 +1,5 @@ error: `#[target_feature]` attribute cannot be used on extern crates - --> $DIR/invalid-attribute.rs:11:1 + --> $DIR/invalid-attribute.rs:12:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on use statements - --> $DIR/invalid-attribute.rs:15:1 + --> $DIR/invalid-attribute.rs:16:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on foreign modules - --> $DIR/invalid-attribute.rs:19:1 + --> $DIR/invalid-attribute.rs:20:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error[E0539]: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:23:1 + --> $DIR/invalid-attribute.rs:24:1 | LL | #[target_feature = "+sse2"] | ^^^^^^^^^^^^^^^^^---------^ @@ -37,7 +37,7 @@ LL + #[target_feature(enable = "feat1, feat2")] | error[E0539]: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:29:1 + --> $DIR/invalid-attribute.rs:30:1 | LL | #[target_feature(bar)] | ^^^^^^^^^^^^^^^^^---^^ @@ -51,7 +51,7 @@ LL + #[target_feature(enable = "feat1, feat2")] | error[E0539]: malformed `target_feature` attribute input - --> $DIR/invalid-attribute.rs:32:1 + --> $DIR/invalid-attribute.rs:33:1 | LL | #[target_feature(disable = "baz")] | ^^^^^^^^^^^^^^^^^-------^^^^^^^^^^ @@ -65,7 +65,7 @@ LL + #[target_feature(enable = "feat1, feat2")] | error: `#[target_feature]` attribute cannot be used on modules - --> $DIR/invalid-attribute.rs:37:1 + --> $DIR/invalid-attribute.rs:38:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -73,7 +73,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on constants - --> $DIR/invalid-attribute.rs:41:1 + --> $DIR/invalid-attribute.rs:42:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,7 +81,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on structs - --> $DIR/invalid-attribute.rs:45:1 + --> $DIR/invalid-attribute.rs:46:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on enums - --> $DIR/invalid-attribute.rs:49:1 + --> $DIR/invalid-attribute.rs:50:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -97,7 +97,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on unions - --> $DIR/invalid-attribute.rs:53:1 + --> $DIR/invalid-attribute.rs:54:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -105,7 +105,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on type aliases - --> $DIR/invalid-attribute.rs:60:1 + --> $DIR/invalid-attribute.rs:61:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -113,7 +113,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on traits - --> $DIR/invalid-attribute.rs:64:1 + --> $DIR/invalid-attribute.rs:65:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on statics - --> $DIR/invalid-attribute.rs:74:1 + --> $DIR/invalid-attribute.rs:75:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on trait impl blocks - --> $DIR/invalid-attribute.rs:78:1 + --> $DIR/invalid-attribute.rs:79:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -137,7 +137,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on inherent impl blocks - --> $DIR/invalid-attribute.rs:84:1 + --> $DIR/invalid-attribute.rs:85:1 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -145,7 +145,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on expressions - --> $DIR/invalid-attribute.rs:105:5 + --> $DIR/invalid-attribute.rs:106:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -153,7 +153,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can only be applied to functions error: `#[target_feature]` attribute cannot be used on closures - --> $DIR/invalid-attribute.rs:111:5 + --> $DIR/invalid-attribute.rs:112:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -161,7 +161,7 @@ LL | #[target_feature(enable = "sse2")] = help: `#[target_feature]` can be applied to functions and methods error: cannot use `#[inline(always)]` with `#[target_feature]` - --> $DIR/invalid-attribute.rs:68:1 + --> $DIR/invalid-attribute.rs:69:1 | LL | #[inline(always)] | ^^^^^^^^^^^^^^^^^ @@ -169,15 +169,15 @@ LL | #[inline(always)] = note: See this issue for full discussion: https://github.com/rust-lang/rust/issues/145574 error: the feature named `foo` is not valid for this target - --> $DIR/invalid-attribute.rs:26:18 + --> $DIR/invalid-attribute.rs:27:18 | LL | #[target_feature(enable = "foo")] | ^^^^^^^^^^^^^^ `foo` is not valid for this target | - = help: valid names are: `fma`, `xop`, `adx`, `aes`, and `avx` and 76 more + = help: valid names are: `fma`, `xop`, `adx`, `aes`, and `avx` and X more error[E0046]: not all trait items implemented, missing: `foo` - --> $DIR/invalid-attribute.rs:80:1 + --> $DIR/invalid-attribute.rs:81:1 | LL | impl Quux for u8 {} | ^^^^^^^^^^^^^^^^ missing `foo` in implementation @@ -186,7 +186,7 @@ LL | fn foo(); | --------- `foo` from trait error: `#[target_feature(..)]` cannot be applied to safe trait method - --> $DIR/invalid-attribute.rs:94:5 + --> $DIR/invalid-attribute.rs:95:5 | LL | #[target_feature(enable = "sse2")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method @@ -195,13 +195,13 @@ LL | fn foo() {} | -------- not an `unsafe` function error[E0053]: method `foo` has an incompatible type for trait - --> $DIR/invalid-attribute.rs:97:5 + --> $DIR/invalid-attribute.rs:98:5 | LL | fn foo() {} | ^^^^^^^^ expected safe fn, found unsafe fn | note: type in trait - --> $DIR/invalid-attribute.rs:89:5 + --> $DIR/invalid-attribute.rs:90:5 | LL | fn foo(); | ^^^^^^^^^ @@ -209,7 +209,7 @@ LL | fn foo(); found signature `#[target_features] fn()` error: the feature named `+sse2` is not valid for this target - --> $DIR/invalid-attribute.rs:116:18 + --> $DIR/invalid-attribute.rs:117:18 | LL | #[target_feature(enable = "+sse2")] | ^^^^^^^^^^^^^^^^ `+sse2` is not valid for this target @@ -221,20 +221,20 @@ LL + #[target_feature(enable = "sse2")] | error: the feature named `sse5` is not valid for this target - --> $DIR/invalid-attribute.rs:121:18 + --> $DIR/invalid-attribute.rs:122:18 | LL | #[target_feature(enable = "sse5")] | ^^^^^^^^^^^^^^^ `sse5` is not valid for this target | - = help: valid names are: `sse`, `sse2`, `sse3`, `sse4a`, and `ssse3` and 76 more + = help: valid names are: `sse`, `sse2`, `sse3`, `sse4a`, and `ssse3` and X more error: the feature named `avx512` is not valid for this target - --> $DIR/invalid-attribute.rs:126:18 + --> $DIR/invalid-attribute.rs:127:18 | LL | #[target_feature(enable = "avx512")] | ^^^^^^^^^^^^^^^^^ `avx512` is not valid for this target | - = help: valid names are: `avx512f`, `avx2`, `avx512bw`, `avx512cd`, and `avx512dq` and 76 more + = help: valid names are: `avx512f`, `avx2`, `avx512bw`, `avx512cd`, and `avx512dq` and X more error: aborting due to 26 previous errors