Skip to content

Commit f26806a

Browse files
Edit feature gate message of impl_restriction to show impl keyword
1 parent 1d4a984 commit f26806a

3 files changed

Lines changed: 35 additions & 35 deletions

File tree

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
576576
gate_all!(coroutines, "coroutine syntax is experimental");
577577
gate_all!(const_block_items, "const block items are experimental");
578578
gate_all!(final_associated_functions, "`final` on trait functions is experimental");
579-
gate_all!(impl_restriction, "impl restrictions are experimental");
579+
gate_all!(impl_restriction, "`impl` restrictions are experimental");
580580

581581
if !visitor.features.never_patterns() {
582582
if let Some(spans) = spans.get(&sym::never_patterns) {

tests/ui/impl-restriction/feature-gate-impl-restriction.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,37 @@
66
#![cfg_attr(with_gate, allow(incomplete_features))]
77
#![feature(auto_traits, const_trait_impl)]
88

9-
pub impl(crate) trait Bar {} //[without_gate]~ ERROR impl restrictions are experimental
10-
pub impl(in crate) trait BarInCrate {} //[without_gate]~ ERROR impl restrictions are experimental
9+
pub impl(crate) trait Bar {} //[without_gate]~ ERROR `impl` restrictions are experimental
10+
pub impl(in crate) trait BarInCrate {} //[without_gate]~ ERROR `impl` restrictions are experimental
1111

1212
mod foo {
13-
pub impl(in crate::foo) trait Baz {} //[without_gate]~ ERROR impl restrictions are experimental
14-
pub unsafe impl(super) trait BazUnsafeSuper {} //[without_gate]~ ERROR impl restrictions are experimental
15-
pub auto impl(self) trait BazAutoSelf {} //[without_gate]~ ERROR impl restrictions are experimental
16-
pub const impl(in self) trait BazConst {} //[without_gate]~ ERROR impl restrictions are experimental
13+
pub impl(in crate::foo) trait Baz {} //[without_gate]~ ERROR `impl` restrictions are experimental
14+
pub unsafe impl(super) trait BazUnsafeSuper {} //[without_gate]~ ERROR `impl` restrictions are experimental
15+
pub auto impl(self) trait BazAutoSelf {} //[without_gate]~ ERROR `impl` restrictions are experimental
16+
pub const impl(in self) trait BazConst {} //[without_gate]~ ERROR `impl` restrictions are experimental
1717

1818
mod foo_inner {
19-
pub impl(in crate::foo::foo_inner) trait Qux {} //[without_gate]~ ERROR impl restrictions are experimental
20-
pub unsafe auto impl(in crate::foo::foo_inner) trait QuxAutoUnsafe {} //[without_gate]~ ERROR impl restrictions are experimental
21-
pub const unsafe impl(in crate::foo::foo_inner) trait QuxConstAuto {} //[without_gate]~ ERROR impl restrictions are experimental
19+
pub impl(in crate::foo::foo_inner) trait Qux {} //[without_gate]~ ERROR `impl` restrictions are experimental
20+
pub unsafe auto impl(in crate::foo::foo_inner) trait QuxAutoUnsafe {} //[without_gate]~ ERROR `impl` restrictions are experimental
21+
pub const unsafe impl(in crate::foo::foo_inner) trait QuxConstAuto {} //[without_gate]~ ERROR `impl` restrictions are experimental
2222
}
2323

2424
#[cfg(false)]
25-
pub impl(crate) trait Bar {} //[without_gate]~ ERROR impl restrictions are experimental
25+
pub impl(crate) trait Bar {} //[without_gate]~ ERROR `impl` restrictions are experimental
2626
#[cfg(false)]
27-
pub impl(in crate) trait BarInCrate {} //[without_gate]~ ERROR impl restrictions are experimental
27+
pub impl(in crate) trait BarInCrate {} //[without_gate]~ ERROR `impl` restrictions are experimental
2828
#[cfg(false)]
29-
pub unsafe impl(self) trait BazUnsafeSelf {} //[without_gate]~ ERROR impl restrictions are experimental
29+
pub unsafe impl(self) trait BazUnsafeSelf {} //[without_gate]~ ERROR `impl` restrictions are experimental
3030
#[cfg(false)]
31-
pub auto impl(in super) trait BazAutoSuper {} //[without_gate]~ ERROR impl restrictions are experimental
31+
pub auto impl(in super) trait BazAutoSuper {} //[without_gate]~ ERROR `impl` restrictions are experimental
3232
#[cfg(false)]
33-
pub const impl(super) trait BazConstSuper {} //[without_gate]~ ERROR impl restrictions are experimental
33+
pub const impl(super) trait BazConstSuper {} //[without_gate]~ ERROR `impl` restrictions are experimental
3434

3535
#[cfg(false)]
3636
mod cfged_out_foo {
37-
pub impl(in crate::foo::cfged_out_foo) trait CfgedOutQux {} //[without_gate]~ ERROR impl restrictions are experimental
38-
pub unsafe auto impl(in crate::foo::cfged_out_foo) trait CfgedOutQuxAutoUnsafe {} //[without_gate]~ ERROR impl restrictions are experimental
39-
pub const unsafe impl(in crate::foo::cfged_out_foo) trait CfgedOutQuxConstAuto {} //[without_gate]~ ERROR impl restrictions are experimental
37+
pub impl(in crate::foo::cfged_out_foo) trait CfgedOutQux {} //[without_gate]~ ERROR `impl` restrictions are experimental
38+
pub unsafe auto impl(in crate::foo::cfged_out_foo) trait CfgedOutQuxAutoUnsafe {} //[without_gate]~ ERROR `impl` restrictions are experimental
39+
pub const unsafe impl(in crate::foo::cfged_out_foo) trait CfgedOutQuxConstAuto {} //[without_gate]~ ERROR `impl` restrictions are experimental
4040
}
4141

4242
// auto traits cannot be const, so we do not include these combinations in the test.

tests/ui/impl-restriction/feature-gate-impl-restriction.without_gate.stderr

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0658]: impl restrictions are experimental
1+
error[E0658]: `impl` restrictions are experimental
22
--> $DIR/feature-gate-impl-restriction.rs:9:5
33
|
44
LL | pub impl(crate) trait Bar {}
@@ -8,7 +8,7 @@ LL | pub impl(crate) trait Bar {}
88
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

11-
error[E0658]: impl restrictions are experimental
11+
error[E0658]: `impl` restrictions are experimental
1212
--> $DIR/feature-gate-impl-restriction.rs:10:5
1313
|
1414
LL | pub impl(in crate) trait BarInCrate {}
@@ -18,7 +18,7 @@ LL | pub impl(in crate) trait BarInCrate {}
1818
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

21-
error[E0658]: impl restrictions are experimental
21+
error[E0658]: `impl` restrictions are experimental
2222
--> $DIR/feature-gate-impl-restriction.rs:13:9
2323
|
2424
LL | pub impl(in crate::foo) trait Baz {}
@@ -28,7 +28,7 @@ LL | pub impl(in crate::foo) trait Baz {}
2828
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

31-
error[E0658]: impl restrictions are experimental
31+
error[E0658]: `impl` restrictions are experimental
3232
--> $DIR/feature-gate-impl-restriction.rs:14:16
3333
|
3434
LL | pub unsafe impl(super) trait BazUnsafeSuper {}
@@ -38,7 +38,7 @@ LL | pub unsafe impl(super) trait BazUnsafeSuper {}
3838
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

41-
error[E0658]: impl restrictions are experimental
41+
error[E0658]: `impl` restrictions are experimental
4242
--> $DIR/feature-gate-impl-restriction.rs:15:14
4343
|
4444
LL | pub auto impl(self) trait BazAutoSelf {}
@@ -48,7 +48,7 @@ LL | pub auto impl(self) trait BazAutoSelf {}
4848
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
4949
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5050

51-
error[E0658]: impl restrictions are experimental
51+
error[E0658]: `impl` restrictions are experimental
5252
--> $DIR/feature-gate-impl-restriction.rs:16:15
5353
|
5454
LL | pub const impl(in self) trait BazConst {}
@@ -58,7 +58,7 @@ LL | pub const impl(in self) trait BazConst {}
5858
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
5959
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6060

61-
error[E0658]: impl restrictions are experimental
61+
error[E0658]: `impl` restrictions are experimental
6262
--> $DIR/feature-gate-impl-restriction.rs:19:13
6363
|
6464
LL | pub impl(in crate::foo::foo_inner) trait Qux {}
@@ -68,7 +68,7 @@ LL | pub impl(in crate::foo::foo_inner) trait Qux {}
6868
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
6969
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7070

71-
error[E0658]: impl restrictions are experimental
71+
error[E0658]: `impl` restrictions are experimental
7272
--> $DIR/feature-gate-impl-restriction.rs:20:25
7373
|
7474
LL | ... pub unsafe auto impl(in crate::foo::foo_inner) trait QuxAutoUnsafe {}
@@ -78,7 +78,7 @@ LL | ... pub unsafe auto impl(in crate::foo::foo_inner) trait QuxAutoUnsafe {}
7878
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
7979
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
8080

81-
error[E0658]: impl restrictions are experimental
81+
error[E0658]: `impl` restrictions are experimental
8282
--> $DIR/feature-gate-impl-restriction.rs:21:26
8383
|
8484
LL | ... pub const unsafe impl(in crate::foo::foo_inner) trait QuxConstAuto {}
@@ -88,7 +88,7 @@ LL | ... pub const unsafe impl(in crate::foo::foo_inner) trait QuxConstAuto {}
8888
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
8989
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9090

91-
error[E0658]: impl restrictions are experimental
91+
error[E0658]: `impl` restrictions are experimental
9292
--> $DIR/feature-gate-impl-restriction.rs:25:9
9393
|
9494
LL | pub impl(crate) trait Bar {}
@@ -98,7 +98,7 @@ LL | pub impl(crate) trait Bar {}
9898
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
9999
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
100100

101-
error[E0658]: impl restrictions are experimental
101+
error[E0658]: `impl` restrictions are experimental
102102
--> $DIR/feature-gate-impl-restriction.rs:27:9
103103
|
104104
LL | pub impl(in crate) trait BarInCrate {}
@@ -108,7 +108,7 @@ LL | pub impl(in crate) trait BarInCrate {}
108108
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
109109
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
110110

111-
error[E0658]: impl restrictions are experimental
111+
error[E0658]: `impl` restrictions are experimental
112112
--> $DIR/feature-gate-impl-restriction.rs:29:16
113113
|
114114
LL | pub unsafe impl(self) trait BazUnsafeSelf {}
@@ -118,7 +118,7 @@ LL | pub unsafe impl(self) trait BazUnsafeSelf {}
118118
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
119119
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
120120

121-
error[E0658]: impl restrictions are experimental
121+
error[E0658]: `impl` restrictions are experimental
122122
--> $DIR/feature-gate-impl-restriction.rs:31:14
123123
|
124124
LL | pub auto impl(in super) trait BazAutoSuper {}
@@ -128,7 +128,7 @@ LL | pub auto impl(in super) trait BazAutoSuper {}
128128
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
129129
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
130130

131-
error[E0658]: impl restrictions are experimental
131+
error[E0658]: `impl` restrictions are experimental
132132
--> $DIR/feature-gate-impl-restriction.rs:33:15
133133
|
134134
LL | pub const impl(super) trait BazConstSuper {}
@@ -138,7 +138,7 @@ LL | pub const impl(super) trait BazConstSuper {}
138138
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
139139
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
140140

141-
error[E0658]: impl restrictions are experimental
141+
error[E0658]: `impl` restrictions are experimental
142142
--> $DIR/feature-gate-impl-restriction.rs:37:13
143143
|
144144
LL | pub impl(in crate::foo::cfged_out_foo) trait CfgedOutQux {}
@@ -148,7 +148,7 @@ LL | pub impl(in crate::foo::cfged_out_foo) trait CfgedOutQux {}
148148
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
149149
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
150150

151-
error[E0658]: impl restrictions are experimental
151+
error[E0658]: `impl` restrictions are experimental
152152
--> $DIR/feature-gate-impl-restriction.rs:38:25
153153
|
154154
LL | ... pub unsafe auto impl(in crate::foo::cfged_out_foo) trait CfgedOutQuxAutoUnsafe {}
@@ -158,7 +158,7 @@ LL | ... pub unsafe auto impl(in crate::foo::cfged_out_foo) trait CfgedOutQuxA
158158
= help: add `#![feature(impl_restriction)]` to the crate attributes to enable
159159
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
160160

161-
error[E0658]: impl restrictions are experimental
161+
error[E0658]: `impl` restrictions are experimental
162162
--> $DIR/feature-gate-impl-restriction.rs:39:26
163163
|
164164
LL | ... pub const unsafe impl(in crate::foo::cfged_out_foo) trait CfgedOutQuxConstAuto {}

0 commit comments

Comments
 (0)