Skip to content

Commit ed4f88f

Browse files
authored
Unrolled build for #142943
Rollup merge of #142943 - jieyouxu:no-rustc-version, r=compiler-errors 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 (see #142940 (comment)): - Per-test version string normalization is nasty to maintain, and we need to maintain `n` copies of it. See #142930 where the regex wasn't robust against different release channels. - 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). r? `@workingjubilee` (discussed in #142940)
2 parents 28f1c80 + db11e74 commit ed4f88f

19 files changed

+29
-44
lines changed

compiler/rustc_expand/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ expand_feature_not_allowed =
6262
expand_feature_removed =
6363
feature has been removed
6464
.label = feature has been removed
65-
.note = removed in {$removed_rustc_version} (you are using {$current_rustc_version}){$pull_note}
65+
.note = removed in {$removed_rustc_version}{$pull_note}
6666
.reason = {$reason}
6767
6868
expand_glob_delegation_outside_impls =

compiler/rustc_expand/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
9292
span: mi.span(),
9393
reason: f.reason.map(|reason| FeatureRemovedReason { reason }),
9494
removed_rustc_version: f.feature.since,
95-
current_rustc_version: sess.cfg_version,
9695
pull_note,
9796
});
9897
continue;

compiler/rustc_expand/src/errors.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ pub(crate) struct FeatureRemoved<'a> {
162162
#[subdiagnostic]
163163
pub reason: Option<FeatureRemovedReason<'a>>,
164164
pub removed_rustc_version: &'a str,
165-
pub current_rustc_version: &'a str,
166165
pub pull_note: String,
167166
}
168167

tests/ui/deprecation/deprecated_no_stack_check.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
2-
31
#![deny(warnings)]
42
#![feature(no_stack_check)]
53
//~^ ERROR: feature has been removed [E0557]

tests/ui/deprecation/deprecated_no_stack_check.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0557]: feature has been removed
2-
--> $DIR/deprecated_no_stack_check.rs:4:12
2+
--> $DIR/deprecated_no_stack_check.rs:2:12
33
|
44
LL | #![feature(no_stack_check)]
55
| ^^^^^^^^^^^^^^ feature has been removed
66
|
7-
= note: removed in 1.0.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/40110> for more information
7+
= note: removed in 1.0.0; see <https://github.com/rust-lang/rust/pull/40110> for more information
88

99
error: aborting due to 1 previous error
1010

tests/ui/feature-gates/feature-gate-coverage-attribute.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
2-
31
#![crate_type = "lib"]
42
#![feature(no_coverage)] //~ ERROR feature has been removed [E0557]
53

tests/ui/feature-gates/feature-gate-coverage-attribute.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0557]: feature has been removed
2-
--> $DIR/feature-gate-coverage-attribute.rs:4:12
2+
--> $DIR/feature-gate-coverage-attribute.rs:2:12
33
|
44
LL | #![feature(no_coverage)]
55
| ^^^^^^^^^^^ feature has been removed
66
|
7-
= note: removed in 1.74.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/114656> for more information
7+
= note: removed in 1.74.0; see <https://github.com/rust-lang/rust/pull/114656> for more information
88
= note: renamed to `coverage_attribute`
99

1010
error[E0658]: the `#[coverage]` attribute is an experimental feature
11-
--> $DIR/feature-gate-coverage-attribute.rs:12:1
11+
--> $DIR/feature-gate-coverage-attribute.rs:10:1
1212
|
1313
LL | #[coverage(off)]
1414
| ^^^^^^^^^^^^^^^^

tests/ui/feature-gates/gated-bad-feature.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
21
#![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
32
//~^ ERROR malformed `feature`
43
//~| ERROR malformed `feature`

tests/ui/feature-gates/gated-bad-feature.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
error[E0556]: malformed `feature` attribute input
2-
--> $DIR/gated-bad-feature.rs:2:25
2+
--> $DIR/gated-bad-feature.rs:1:25
33
|
44
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
55
| ^^^^^^^^ help: expected just one word: `foo`
66

77
error[E0556]: malformed `feature` attribute input
8-
--> $DIR/gated-bad-feature.rs:2:35
8+
--> $DIR/gated-bad-feature.rs:1:35
99
|
1010
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
1111
| ^^^^^^^^^^^ help: expected just one word: `foo`
1212

1313
error[E0557]: feature has been removed
14-
--> $DIR/gated-bad-feature.rs:9:12
14+
--> $DIR/gated-bad-feature.rs:8:12
1515
|
1616
LL | #![feature(test_removed_feature)]
1717
| ^^^^^^^^^^^^^^^^^^^^ feature has been removed
1818
|
19-
= note: removed in 1.0.0 (you are using $RUSTC_VERSION)
19+
= note: removed in 1.0.0
2020

2121
error: malformed `feature` attribute input
22-
--> $DIR/gated-bad-feature.rs:7:1
22+
--> $DIR/gated-bad-feature.rs:6:1
2323
|
2424
LL | #![feature]
2525
| ^^^^^^^^^^^ help: must be of the form: `#![feature(name1, name2, ...)]`
2626

2727
error: malformed `feature` attribute input
28-
--> $DIR/gated-bad-feature.rs:8:1
28+
--> $DIR/gated-bad-feature.rs:7:1
2929
|
3030
LL | #![feature = "foo"]
3131
| ^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![feature(name1, name2, ...)]`
3232

3333
error[E0635]: unknown feature `foo_bar_baz`
34-
--> $DIR/gated-bad-feature.rs:2:12
34+
--> $DIR/gated-bad-feature.rs:1:12
3535
|
3636
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
3737
| ^^^^^^^^^^^
3838

3939
error[E0635]: unknown feature `foo`
40-
--> $DIR/gated-bad-feature.rs:2:48
40+
--> $DIR/gated-bad-feature.rs:1:48
4141
|
4242
LL | #![feature(foo_bar_baz, foo(bar), foo = "baz", foo)]
4343
| ^^^

tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
2-
31
#![feature(external_doc)] //~ ERROR feature has been removed
42
#![doc(include("README.md"))] //~ ERROR unknown `doc` attribute `include`
53

tests/ui/feature-gates/removed-features-note-version-and-pr-issue-141619.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0557]: feature has been removed
2-
--> $DIR/removed-features-note-version-and-pr-issue-141619.rs:3:12
2+
--> $DIR/removed-features-note-version-and-pr-issue-141619.rs:1:12
33
|
44
LL | #![feature(external_doc)]
55
| ^^^^^^^^^^^^ feature has been removed
66
|
7-
= note: removed in 1.54.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/85457> for more information
7+
= note: removed in 1.54.0; see <https://github.com/rust-lang/rust/pull/85457> for more information
88
= note: use #[doc = include_str!("filename")] instead, which handles macro invocations
99

1010
error: unknown `doc` attribute `include`
11-
--> $DIR/removed-features-note-version-and-pr-issue-141619.rs:4:8
11+
--> $DIR/removed-features-note-version-and-pr-issue-141619.rs:2:8
1212
|
1313
LL | #![doc(include("README.md"))]
1414
| ^^^^^^^^^^^^^^^^^^^^

tests/ui/macros/macro-reexport-removed.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ aux-build:two_macros.rs
2-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
32

43
#![feature(macro_reexport)] //~ ERROR feature has been removed
54

tests/ui/macros/macro-reexport-removed.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0557]: feature has been removed
2-
--> $DIR/macro-reexport-removed.rs:4:12
2+
--> $DIR/macro-reexport-removed.rs:3:12
33
|
44
LL | #![feature(macro_reexport)]
55
| ^^^^^^^^^^^^^^ feature has been removed
66
|
7-
= note: removed in 1.0.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/49982> for more information
7+
= note: removed in 1.0.0; see <https://github.com/rust-lang/rust/pull/49982> for more information
88
= note: subsumed by `pub use`
99

1010
error: cannot find attribute `macro_reexport` in this scope
11-
--> $DIR/macro-reexport-removed.rs:6:3
11+
--> $DIR/macro-reexport-removed.rs:5:3
1212
|
1313
LL | #[macro_reexport(macro_one)]
1414
| ^^^^^^^^^^^^^^ help: a built-in attribute with a similar name exists: `macro_export`

tests/ui/rustdoc/renamed-features-rustdoc_internals.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
2-
31
#![feature(doc_keyword)] //~ ERROR
42
#![feature(doc_primitive)] //~ ERROR
53
#![crate_type = "lib"]

tests/ui/rustdoc/renamed-features-rustdoc_internals.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error[E0557]: feature has been removed
2-
--> $DIR/renamed-features-rustdoc_internals.rs:3:12
2+
--> $DIR/renamed-features-rustdoc_internals.rs:1:12
33
|
44
LL | #![feature(doc_keyword)]
55
| ^^^^^^^^^^^ feature has been removed
66
|
7-
= note: removed in 1.58.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/90420> for more information
7+
= note: removed in 1.58.0; see <https://github.com/rust-lang/rust/pull/90420> for more information
88
= note: merged into `#![feature(rustdoc_internals)]`
99

1010
error[E0557]: feature has been removed
11-
--> $DIR/renamed-features-rustdoc_internals.rs:4:12
11+
--> $DIR/renamed-features-rustdoc_internals.rs:2:12
1212
|
1313
LL | #![feature(doc_primitive)]
1414
| ^^^^^^^^^^^^^ feature has been removed
1515
|
16-
= note: removed in 1.58.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/90420> for more information
16+
= note: removed in 1.58.0; see <https://github.com/rust-lang/rust/pull/90420> for more information
1717
= note: merged into `#![feature(rustdoc_internals)]`
1818

1919
error: aborting due to 2 previous errors

tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// Regression test for issue #125877.
77

88
//@ compile-flags: -Znext-solver
9-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
109

1110
#![feature(const_trait_impl, effects)]
1211
//~^ ERROR feature has been removed

tests/ui/traits/const-traits/const-trait-impl-parameter-mismatch.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0557]: feature has been removed
2-
--> $DIR/const-trait-impl-parameter-mismatch.rs:11:30
2+
--> $DIR/const-trait-impl-parameter-mismatch.rs:10:30
33
|
44
LL | #![feature(const_trait_impl, effects)]
55
| ^^^^^^^ feature has been removed
66
|
7-
= note: removed in 1.84.0 (you are using $RUSTC_VERSION); see <https://github.com/rust-lang/rust/pull/132479> for more information
7+
= note: removed in 1.84.0; see <https://github.com/rust-lang/rust/pull/132479> for more information
88
= note: removed, redundant with `#![feature(const_trait_impl)]`
99

1010
error[E0049]: associated function `compute` has 0 type parameters but its trait declaration has 1 type parameter
11-
--> $DIR/const-trait-impl-parameter-mismatch.rs:20:16
11+
--> $DIR/const-trait-impl-parameter-mismatch.rs:19:16
1212
|
1313
LL | fn compute<T: ~const Aux>() -> u32;
1414
| - expected 1 type parameter

tests/ui/unsized-locals/yote.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
2-
31
#![feature(unsized_locals)] //~ERROR feature has been removed
42
#![crate_type = "lib"]

tests/ui/unsized-locals/yote.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
error[E0557]: feature has been removed
2-
--> $DIR/yote.rs:3:12
2+
--> $DIR/yote.rs:1:12
33
|
44
LL | #![feature(unsized_locals)]
55
| ^^^^^^^^^^^^^^ feature has been removed
66
|
7-
= note: removed in CURRENT_RUSTC_VERSION (you are using $RUSTC_VERSION)
7+
= note: removed in CURRENT_RUSTC_VERSION
88
= note: removed due to implementation concerns; see https://github.com/rust-lang/rust/issues/111942
99

1010
error: aborting due to 1 previous error

0 commit comments

Comments
 (0)