Skip to content

Commit db11e74

Browse files
committed
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).
1 parent 36b2163 commit db11e74

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

0 commit comments

Comments
 (0)