1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
|
From: Jieyou Xu <jieyouxu@outlook.com>
Date: Tue, 24 Jun 2025 10:09:58 +0800
Subject: Don't include current rustc version string in feature removed help
The version string is difficult to properly normalize out, and removing
it isn't a huge deal (the user can query version info easily through
`rustc --version` or `cargo --version`).
The normalization options were all non-ideal:
- Per-test version string normalization is nasty to maintain, and we
need to maintain `n` copies of it.
- Centralized compiletest normalization (with a directive opt-out) is
also not ideal, because `cfg(version(..))` tests can't have those
accidentally normalized out (and you'd have to remember to opt-out).
(cherry picked from commit db11e747230caa23aad3f159e42dc3b47baf7557)
Conflicts:
tests/ui/unsized-locals/yote.stderr
placeholder got replaced with 1.89.0
Forwarded: not-needed
---
compiler/rustc_expand/messages.ftl | 2 +-
compiler/rustc_expand/src/config.rs | 1 -
compiler/rustc_expand/src/errors.rs | 1 -
tests/ui/deprecation/deprecated_no_stack_check.rs | 2 --
tests/ui/deprecation/deprecated_no_stack_check.stderr | 4 ++--
.../ui/feature-gates/feature-gate-coverage-attribute.rs | 2 --
.../feature-gates/feature-gate-coverage-attribute.stderr | 6 +++---
tests/ui/feature-gates/gated-bad-feature.rs | 1 -
tests/ui/feature-gates/gated-bad-feature.stderr | 16 ++++++++--------
.../removed-features-note-version-and-pr-issue-141619.rs | 2 --
...oved-features-note-version-and-pr-issue-141619.stderr | 6 +++---
tests/ui/macros/macro-reexport-removed.rs | 1 -
tests/ui/macros/macro-reexport-removed.stderr | 6 +++---
tests/ui/rustdoc/renamed-features-rustdoc_internals.rs | 2 --
.../ui/rustdoc/renamed-features-rustdoc_internals.stderr | 8 ++++----
.../const-traits/const-trait-impl-parameter-mismatch.rs | 1 -
.../const-trait-impl-parameter-mismatch.stderr | 6 +++---
tests/ui/unsized-locals/yote.rs | 2 --
tests/ui/unsized-locals/yote.stderr | 4 ++--
19 files changed, 29 insertions(+), 44 deletions(-)
diff --git a/compiler/rustc_expand/messages.ftl b/compiler/rustc_expand/messages.ftl
index 8b7c47d..b7555bb 100644
--- a/compiler/rustc_expand/messages.ftl
+++ b/compiler/rustc_expand/messages.ftl
@@ -62,7 +62,7 @@ expand_feature_not_allowed =
expand_feature_removed =
feature has been removed
.label = feature has been removed
- .note = removed in {$removed_rustc_version} (you are using {$current_rustc_version}){$pull_note}
+ .note = removed in {$removed_rustc_version}{$pull_note}
.reason = {$reason}
expand_glob_delegation_outside_impls =
diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs
index 9a359e9..170ac39 100644
--- a/compiler/rustc_expand/src/config.rs
+++ b/compiler/rustc_expand/src/config.rs
@@ -92,7 +92,6 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
span: mi.span(),
reason: f.reason.map(|reason| FeatureRemovedReason { reason }),
removed_rustc_version: f.feature.since,
- current_rustc_version: sess.cfg_version,
pull_note,
});
continue;
diff --git a/compiler/rustc_expand/src/errors.rs b/compiler/rustc_expand/src/errors.rs
index 714ba3b..e69ad9e 100644
--- a/compiler/rustc_expand/src/errors.rs
+++ b/compiler/rustc_expand/src/errors.rs
@@ -162,7 +162,6 @@ pub(crate) struct FeatureRemoved<'a> {
#[subdiagnostic]
pub reason: Option<FeatureRemovedReason<'a>>,
pub removed_rustc_version: &'a str,
- pub current_rustc_version: &'a str,
pub pull_note: String,
}
diff --git a/tests/ui/deprecation/deprecated_no_stack_check.rs b/tests/ui/deprecation/deprecated_no_stack_check.rs
index 64635c5..8e1f5bb 100644
--- a/tests/ui/deprecation/deprecated_no_stack_check.rs
+++ b/tests/ui/deprecation/deprecated_no_stack_check.rs
@@ -1,5 +1,3 @@
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
-
#![deny(warnings)]
#![feature(no_stack_check)]
//~^ ERROR: feature has been removed [E0557]
diff --git a/tests/ui/deprecation/deprecated_no_stack_check.stderr b/tests/ui/deprecation/deprecated_no_stack_check.stderr
index 2d08b1b..3378866 100644
--- a/tests/ui/deprecation/deprecated_no_stack_check.stderr
+++ b/tests/ui/deprecation/deprecated_no_stack_check.stderr
@@ -1,10 +1,10 @@
error[E0557]: feature has been removed
- --> $DIR/deprecated_no_stack_check.rs:4:12
+ --> $DIR/deprecated_no_stack_check.rs:2:12
|
LL | #![feature(no_stack_check)]
| ^^^^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.0.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/40110> for more information
+ = note: removed in 1.0.0; see <https://github.com/rust-lang/rust/pull/40110> for more information
error: aborting due to 1 previous error
diff --git a/tests/ui/feature-gates/feature-gate-coverage-attribute.rs b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
index 67ac866..0a46375 100644
--- a/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
+++ b/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
@@ -1,5 +1,3 @@
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
-
#![crate_type = "lib"]
#![feature(no_coverage)] //~ ERROR feature has been removed [E0557]
diff --git a/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr
index 8c23544..68d0d9b 100644
--- a/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr
+++ b/tests/ui/feature-gates/feature-gate-coverage-attribute.stderr
@@ -1,14 +1,14 @@
error[E0557]: feature has been removed
- --> $DIR/feature-gate-coverage-attribute.rs:4:12
+ --> $DIR/feature-gate-coverage-attribute.rs:2:12
|
LL | #![feature(no_coverage)]
| ^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.74.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/114656> for more information
+ = note: removed in 1.74.0; see <https://github.com/rust-lang/rust/pull/114656> for more information
= note: renamed to `coverage_attribute`
error[E0658]: the `#[coverage]` attribute is an experimental feature
- --> $DIR/feature-gate-coverage-attribute.rs:12:1
+ --> $DIR/feature-gate-coverage-attribute.rs:10:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/feature-gates/gated-bad-feature.rs b/tests/ui/feature-gates/gated-bad-feature.rs
index aa094ac..51f2db5 100644
--- a/tests/ui/feature-gates/gated-bad-feature.rs
+++ b/tests/ui/feature-gates/gated-bad-feature.rs
@@ -1,4 +1,3 @@
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
#![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
//~^ ERROR malformed `feature`
//~| ERROR malformed `feature`
diff --git a/tests/ui/feature-gates/gated-bad-feature.stderr b/tests/ui/feature-gates/gated-bad-feature.stderr
index 0e75dff..e0e84d8 100644
--- a/tests/ui/feature-gates/gated-bad-feature.stderr
+++ b/tests/ui/feature-gates/gated-bad-feature.stderr
@@ -1,43 +1,43 @@
error[E0556]: malformed `feature` attribute input
- --> $DIR/gated-bad-feature.rs:2:25
+ --> $DIR/gated-bad-feature.rs:1:25
|
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
| ^^^^^^^^ help: expected just one word: `foo`
error[E0556]: malformed `feature` attribute input
- --> $DIR/gated-bad-feature.rs:2:35
+ --> $DIR/gated-bad-feature.rs:1:35
|
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
| ^^^^^^^^^^^ help: expected just one word: `foo`
error[E0557]: feature has been removed
- --> $DIR/gated-bad-feature.rs:9:12
+ --> $DIR/gated-bad-feature.rs:8:12
|
LL | #![feature(test_removed_feature)]
| ^^^^^^^^^^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.0.0 (you are using $RUSTC_VERSION)
+ = note: removed in 1.0.0
error: malformed `feature` attribute input
- --> $DIR/gated-bad-feature.rs:7:1
+ --> $DIR/gated-bad-feature.rs:6:1
|
LL | #![feature]
| ^^^^^^^^^^^ help: must be of the form: `#![feature(name1, name2, ...)]`
error: malformed `feature` attribute input
- --> $DIR/gated-bad-feature.rs:8:1
+ --> $DIR/gated-bad-feature.rs:7:1
|
LL | #![feature = "foo"]
| ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![feature(name1, name2, ...)]`
error[E0635]: unknown feature `foo_bar_baz`
- --> $DIR/gated-bad-feature.rs:2:12
+ --> $DIR/gated-bad-feature.rs:1:12
|
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
| ^^^^^^^^^^^
error[E0635]: unknown feature `foo`
- --> $DIR/gated-bad-feature.rs:2:48
+ --> $DIR/gated-bad-feature.rs:1:48
|
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
| ^^^
diff --git a/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.rs b/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.rs
index a217a7f..d8c5f48 100644
--- a/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.rs
+++ b/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.rs
@@ -1,5 +1,3 @@
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
-
#![feature(external_doc)] //~ ERROR feature has been removed
#![doc(include("README.md"))] //~ ERROR unknown `doc` attribute `include`
diff --git a/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.stderr b/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.stderr
index 43205c7..bd8c56c 100644
--- a/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.stderr
+++ b/tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.stderr
@@ -1,14 +1,14 @@
error[E0557]: feature has been removed
- --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:3:12
+ --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:1:12
|
LL | #![feature(external_doc)]
| ^^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.54.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/85457> for more information
+ = note: removed in 1.54.0; see <https://github.com/rust-lang/rust/pull/85457> for more information
= note: use #[doc = include_str!("filename")] instead, which handles macro invocations
error: unknown `doc` attribute `include`
- --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:4:8
+ --> $DIR/removed-features-note-version-and-pr-issue-141619.rs:2:8
|
LL | #![doc(include("README.md"))]
| ^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/macros/macro-reexport-removed.rs b/tests/ui/macros/macro-reexport-removed.rs
index 33e7cab..4a05468 100644
--- a/tests/ui/macros/macro-reexport-removed.rs
+++ b/tests/ui/macros/macro-reexport-removed.rs
@@ -1,5 +1,4 @@
//@ aux-build:two_macros.rs
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
#![feature(macro_reexport)] //~ ERROR feature has been removed
diff --git a/tests/ui/macros/macro-reexport-removed.stderr b/tests/ui/macros/macro-reexport-removed.stderr
index d4940ee..8130fe0 100644
--- a/tests/ui/macros/macro-reexport-removed.stderr
+++ b/tests/ui/macros/macro-reexport-removed.stderr
@@ -1,14 +1,14 @@
error[E0557]: feature has been removed
- --> $DIR/macro-reexport-removed.rs:4:12
+ --> $DIR/macro-reexport-removed.rs:3:12
|
LL | #![feature(macro_reexport)]
| ^^^^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.0.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/49982> for more information
+ = note: removed in 1.0.0; see <https://github.com/rust-lang/rust/pull/49982> for more information
= note: subsumed by `pub use`
error: cannot find attribute `macro_reexport` in this scope
- --> $DIR/macro-reexport-removed.rs:6:3
+ --> $DIR/macro-reexport-removed.rs:5:3
|
LL | #[macro_reexport(macro_one)]
| ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export`
diff --git a/tests/ui/rustdoc/renamed-features-rustdoc_internals.rs b/tests/ui/rustdoc/renamed-features-rustdoc_internals.rs
index c0f3c19..739c624 100644
--- a/tests/ui/rustdoc/renamed-features-rustdoc_internals.rs
+++ b/tests/ui/rustdoc/renamed-features-rustdoc_internals.rs
@@ -1,5 +1,3 @@
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
-
#![feature(doc_keyword)] //~ ERROR
#![feature(doc_primitive)] //~ ERROR
#![crate_type = "lib"]
diff --git a/tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr b/tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr
index 9c664da..0608a8b 100644
--- a/tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr
+++ b/tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr
@@ -1,19 +1,19 @@
error[E0557]: feature has been removed
- --> $DIR/renamed-features-rustdoc_internals.rs:3:12
+ --> $DIR/renamed-features-rustdoc_internals.rs:1:12
|
LL | #![feature(doc_keyword)]
| ^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.58.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/90420> for more information
+ = note: removed in 1.58.0; see <https://github.com/rust-lang/rust/pull/90420> for more information
= note: merged into `#![feature(rustdoc_internals)]`
error[E0557]: feature has been removed
- --> $DIR/renamed-features-rustdoc_internals.rs:4:12
+ --> $DIR/renamed-features-rustdoc_internals.rs:2:12
|
LL | #![feature(doc_primitive)]
| ^^^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.58.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/90420> for more information
+ = note: removed in 1.58.0; see <https://github.com/rust-lang/rust/pull/90420> for more information
= note: merged into `#![feature(rustdoc_internals)]`
error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.rs b/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.rs
index 9a41b9c..f90ff91 100644
--- a/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.rs
+++ b/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.rs
@@ -6,7 +6,6 @@
// Regression test for issue #125877.
//@ compile-flags: -Znext-solver
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
#![feature(const_trait_impl, effects)]
//~^ ERROR feature has been removed
diff --git a/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.stderr b/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.stderr
index a04f98e..566961b 100644
--- a/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.stderr
+++ b/tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.stderr
@@ -1,14 +1,14 @@
error[E0557]: feature has been removed
- --> $DIR/const-trait-impl-parameter-mismatch.rs:11:30
+ --> $DIR/const-trait-impl-parameter-mismatch.rs:10:30
|
LL | #![feature(const_trait_impl, effects)]
| ^^^^^^^ feature has been removed
|
- = note: removed in 1.84.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/132479> for more information
+ = note: removed in 1.84.0; see <https://github.com/rust-lang/rust/pull/132479> for more information
= note: removed, redundant with `#![feature(const_trait_impl)]`
error[E0049]: associated function `compute` has 0 type parameters but its trait declaration has 1 type parameter
- --> $DIR/const-trait-impl-parameter-mismatch.rs:20:16
+ --> $DIR/const-trait-impl-parameter-mismatch.rs:19:16
|
LL | fn compute<T: ~const Aux>() -> u32;
| - expected 1 type parameter
diff --git a/tests/ui/unsized-locals/yote.rs b/tests/ui/unsized-locals/yote.rs
index f09db9d..1de75a6 100644
--- a/tests/ui/unsized-locals/yote.rs
+++ b/tests/ui/unsized-locals/yote.rs
@@ -1,4 +1,2 @@
-//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
-
#![feature(unsized_locals)] //~ERROR feature has been removed
#![crate_type = "lib"]
diff --git a/tests/ui/unsized-locals/yote.stderr b/tests/ui/unsized-locals/yote.stderr
index 4573beb..f08a0b4a 100644
--- a/tests/ui/unsized-locals/yote.stderr
+++ b/tests/ui/unsized-locals/yote.stderr
@@ -1,10 +1,10 @@
error[E0557]: feature has been removed
- --> $DIR/yote.rs:3:12
+ --> $DIR/yote.rs:1:12
|
LL | #![feature(unsized_locals)]
| ^^^^^^^^^^^^^^ feature has been removed
|
- = note: removed in 1.89.0 (you are using $RUSTC_VERSION)
+ = note: removed in 1.89.0
= note: removed due to implementation concerns; see https://github.com/rust-lang/rust/issues/111942
error: aborting due to 1 previous error
|