Skip to content

Commit b227d45

Browse files
Rollup merge of #155806 - CoCo-Japan-pan:impl-restriction-mark-unstable, r=jhpratt,Urgau
Remove the incomplete marker from `impl` restrictions Following the discussion on Zulip ([#gsoc > Idea: Implementing impl and mut restrictions @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/421156-gsoc/topic/Idea.3A.20Implementing.20impl.20and.20mut.20restrictions/near/590562763)),this PR removes the incomplete marker from `#[feature(impl_restriction)]`. Tracking issue for restrictions: #105077. r? @Urgau cc @jhpratt
2 parents c96f7d2 + 79e10fd commit b227d45

13 files changed

Lines changed: 88 additions & 94 deletions

compiler/rustc_feature/src/unstable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ declare_features! (
549549
/// Target features on hexagon.
550550
(unstable, hexagon_target_feature, "1.27.0", Some(150250)),
551551
/// Allows `impl(crate) trait Foo` restrictions.
552-
(incomplete, impl_restriction, "1.96.0", Some(105077)),
552+
(unstable, impl_restriction, "CURRENT_RUSTC_VERSION", Some(105077)),
553553
/// Allows `impl Trait` to be used inside associated types (RFC 2515).
554554
(unstable, impl_trait_in_assoc_type, "1.70.0", Some(63063)),
555555
/// Allows `impl Trait` in bindings (`let`).

tests/ui/impl-restriction/auxiliary/external-impl-restriction.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(impl_restriction)]
2-
#![expect(incomplete_features)]
32

43
pub impl(crate) trait TopLevel {}
54

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//@[with_gate] check-pass
44

55
#![cfg_attr(with_gate, feature(impl_restriction))]
6-
#![cfg_attr(with_gate, allow(incomplete_features))]
76
#![feature(auto_traits, const_trait_impl)]
87

98
pub impl(crate) trait Bar {} //[without_gate]~ ERROR `impl` restrictions are experimental

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,5 +1,5 @@
11
error[E0658]: `impl` restrictions are experimental
2-
--> $DIR/feature-gate-impl-restriction.rs:9:5
2+
--> $DIR/feature-gate-impl-restriction.rs:8:5
33
|
44
LL | pub impl(crate) trait Bar {}
55
| ^^^^^^^^^^^
@@ -9,7 +9,7 @@ LL | pub impl(crate) trait Bar {}
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: `impl` restrictions are experimental
12-
--> $DIR/feature-gate-impl-restriction.rs:10:5
12+
--> $DIR/feature-gate-impl-restriction.rs:9:5
1313
|
1414
LL | pub impl(in crate) trait BarInCrate {}
1515
| ^^^^^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | pub impl(in crate) trait BarInCrate {}
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0658]: `impl` restrictions are experimental
22-
--> $DIR/feature-gate-impl-restriction.rs:13:9
22+
--> $DIR/feature-gate-impl-restriction.rs:12:9
2323
|
2424
LL | pub impl(in crate::foo) trait Baz {}
2525
| ^^^^^^^^^^^^^^^^^^^
@@ -29,7 +29,7 @@ LL | pub impl(in crate::foo) trait Baz {}
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

3131
error[E0658]: `impl` restrictions are experimental
32-
--> $DIR/feature-gate-impl-restriction.rs:14:9
32+
--> $DIR/feature-gate-impl-restriction.rs:13:9
3333
|
3434
LL | pub impl(super) unsafe trait BazUnsafeSuper {}
3535
| ^^^^^^^^^^^
@@ -39,7 +39,7 @@ LL | pub impl(super) unsafe trait BazUnsafeSuper {}
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: `impl` restrictions are experimental
42-
--> $DIR/feature-gate-impl-restriction.rs:15:9
42+
--> $DIR/feature-gate-impl-restriction.rs:14:9
4343
|
4444
LL | pub impl(self) auto trait BazAutoSelf {}
4545
| ^^^^^^^^^^
@@ -49,7 +49,7 @@ LL | pub impl(self) auto trait BazAutoSelf {}
4949
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5050

5151
error[E0658]: `impl` restrictions are experimental
52-
--> $DIR/feature-gate-impl-restriction.rs:16:9
52+
--> $DIR/feature-gate-impl-restriction.rs:15:9
5353
|
5454
LL | pub impl(in self) const trait BazConst {}
5555
| ^^^^^^^^^^^^^
@@ -59,7 +59,7 @@ LL | pub impl(in self) const trait BazConst {}
5959
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
6060

6161
error[E0658]: `impl` restrictions are experimental
62-
--> $DIR/feature-gate-impl-restriction.rs:19:13
62+
--> $DIR/feature-gate-impl-restriction.rs:18:13
6363
|
6464
LL | pub impl(in crate::foo::foo_inner) trait Qux {}
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -69,7 +69,7 @@ LL | pub impl(in crate::foo::foo_inner) trait Qux {}
6969
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
7070

7171
error[E0658]: `impl` restrictions are experimental
72-
--> $DIR/feature-gate-impl-restriction.rs:20:13
72+
--> $DIR/feature-gate-impl-restriction.rs:19:13
7373
|
7474
LL | ... pub impl(in crate::foo::foo_inner) unsafe auto trait QuxAutoUnsafe {}
7575
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -79,7 +79,7 @@ LL | ... pub impl(in crate::foo::foo_inner) unsafe auto trait QuxAutoUnsafe {}
7979
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
8080

8181
error[E0658]: `impl` restrictions are experimental
82-
--> $DIR/feature-gate-impl-restriction.rs:21:13
82+
--> $DIR/feature-gate-impl-restriction.rs:20:13
8383
|
8484
LL | ... pub impl(in crate::foo::foo_inner) const unsafe trait QuxConstUnsafe {}
8585
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -89,7 +89,7 @@ LL | ... pub impl(in crate::foo::foo_inner) const unsafe trait QuxConstUnsafe
8989
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
9090

9191
error[E0658]: `impl` restrictions are experimental
92-
--> $DIR/feature-gate-impl-restriction.rs:25:9
92+
--> $DIR/feature-gate-impl-restriction.rs:24:9
9393
|
9494
LL | pub impl(crate) trait Bar {}
9595
| ^^^^^^^^^^^
@@ -99,7 +99,7 @@ LL | pub impl(crate) trait Bar {}
9999
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
100100

101101
error[E0658]: `impl` restrictions are experimental
102-
--> $DIR/feature-gate-impl-restriction.rs:27:9
102+
--> $DIR/feature-gate-impl-restriction.rs:26:9
103103
|
104104
LL | pub impl(in crate) trait BarInCrate {}
105105
| ^^^^^^^^^^^^^^
@@ -109,7 +109,7 @@ LL | pub impl(in crate) trait BarInCrate {}
109109
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
110110

111111
error[E0658]: `impl` restrictions are experimental
112-
--> $DIR/feature-gate-impl-restriction.rs:29:9
112+
--> $DIR/feature-gate-impl-restriction.rs:28:9
113113
|
114114
LL | pub impl(self) unsafe trait BazUnsafeSelf {}
115115
| ^^^^^^^^^^
@@ -119,7 +119,7 @@ LL | pub impl(self) unsafe trait BazUnsafeSelf {}
119119
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
120120

121121
error[E0658]: `impl` restrictions are experimental
122-
--> $DIR/feature-gate-impl-restriction.rs:31:9
122+
--> $DIR/feature-gate-impl-restriction.rs:30:9
123123
|
124124
LL | pub impl(in super) auto trait BazAutoSuper {}
125125
| ^^^^^^^^^^^^^^
@@ -129,7 +129,7 @@ LL | pub impl(in super) auto trait BazAutoSuper {}
129129
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
130130

131131
error[E0658]: `impl` restrictions are experimental
132-
--> $DIR/feature-gate-impl-restriction.rs:33:9
132+
--> $DIR/feature-gate-impl-restriction.rs:32:9
133133
|
134134
LL | pub impl(super) const trait BazConstSuper {}
135135
| ^^^^^^^^^^^
@@ -139,7 +139,7 @@ LL | pub impl(super) const trait BazConstSuper {}
139139
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
140140

141141
error[E0658]: `impl` restrictions are experimental
142-
--> $DIR/feature-gate-impl-restriction.rs:37:13
142+
--> $DIR/feature-gate-impl-restriction.rs:36:13
143143
|
144144
LL | pub impl(in crate::foo::cfged_out_foo) trait CfgedOutQux {}
145145
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -149,7 +149,7 @@ LL | pub impl(in crate::foo::cfged_out_foo) trait CfgedOutQux {}
149149
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
150150

151151
error[E0658]: `impl` restrictions are experimental
152-
--> $DIR/feature-gate-impl-restriction.rs:38:13
152+
--> $DIR/feature-gate-impl-restriction.rs:37:13
153153
|
154154
LL | ... pub impl(in crate::foo::cfged_out_foo) unsafe auto trait CfgedOutQuxUnsafeAuto {}
155155
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -159,7 +159,7 @@ LL | ... pub impl(in crate::foo::cfged_out_foo) unsafe auto trait CfgedOutQuxU
159159
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
160160

161161
error[E0658]: `impl` restrictions are experimental
162-
--> $DIR/feature-gate-impl-restriction.rs:39:13
162+
--> $DIR/feature-gate-impl-restriction.rs:38:13
163163
|
164164
LL | ... pub impl(in crate::foo::cfged_out_foo) const unsafe trait CfgedOutQuxConstUnsafe {}
165165
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/impl-restriction/impl-restriction-check.e2015.stderr

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,95 @@
11
error: trait cannot be implemented outside `external`
2-
--> $DIR/impl-restriction-check.rs:12:1
2+
--> $DIR/impl-restriction-check.rs:11:1
33
|
44
LL | impl external::TopLevel for LocalType {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: trait restricted here
8-
--> $DIR/auxiliary/external-impl-restriction.rs:4:5
8+
--> $DIR/auxiliary/external-impl-restriction.rs:3:5
99
|
1010
LL | pub impl(crate) trait TopLevel {}
1111
| ^^^^^^^^^^^
1212

1313
error: trait cannot be implemented outside `external`
14-
--> $DIR/impl-restriction-check.rs:13:1
14+
--> $DIR/impl-restriction-check.rs:12:1
1515
|
1616
LL | impl external::inner::Inner for LocalType {}
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818
|
1919
note: trait restricted here
20-
--> $DIR/auxiliary/external-impl-restriction.rs:7:9
20+
--> $DIR/auxiliary/external-impl-restriction.rs:6:9
2121
|
2222
LL | pub impl(self) trait Inner {}
2323
| ^^^^^^^^^^
2424

2525
error: trait cannot be implemented outside `foo::bar`
26-
--> $DIR/impl-restriction-check.rs:30:5
26+
--> $DIR/impl-restriction-check.rs:29:5
2727
|
2828
LL | impl bar::Foo for i8 {}
2929
| ^^^^^^^^^^^^^^^^^^^^
3030
|
3131
note: trait restricted here
32-
--> $DIR/impl-restriction-check.rs:17:20
32+
--> $DIR/impl-restriction-check.rs:16:20
3333
|
3434
LL | pub(crate) impl(self) trait Foo {}
3535
| ^^^^^^^^^^
3636

3737
error: trait cannot be implemented outside `foo::bar`
38-
--> $DIR/impl-restriction-check.rs:39:1
38+
--> $DIR/impl-restriction-check.rs:38:1
3939
|
4040
LL | impl foo::bar::Foo for u8 {}
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^
4242
|
4343
note: trait restricted here
44-
--> $DIR/impl-restriction-check.rs:17:20
44+
--> $DIR/impl-restriction-check.rs:16:20
4545
|
4646
LL | pub(crate) impl(self) trait Foo {}
4747
| ^^^^^^^^^^
4848

4949
error: trait cannot be implemented outside `foo`
50-
--> $DIR/impl-restriction-check.rs:41:1
50+
--> $DIR/impl-restriction-check.rs:40:1
5151
|
5252
LL | impl foo::bar::Bar for u8 {}
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5454
|
5555
note: trait restricted here
56-
--> $DIR/impl-restriction-check.rs:18:20
56+
--> $DIR/impl-restriction-check.rs:17:20
5757
|
5858
LL | pub(crate) impl(super) trait Bar {}
5959
| ^^^^^^^^^^^
6060

6161
error: trait cannot be implemented outside `foo::bar`
62-
--> $DIR/impl-restriction-check.rs:34:5
62+
--> $DIR/impl-restriction-check.rs:33:5
6363
|
6464
LL | impl bar::Qux for i8 {}
6565
| ^^^^^^^^^^^^^^^^^^^^
6666
|
6767
note: trait restricted here
68-
--> $DIR/impl-restriction-check.rs:20:20
68+
--> $DIR/impl-restriction-check.rs:19:20
6969
|
7070
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^
7272

7373
error: trait cannot be implemented outside `foo::bar`
74-
--> $DIR/impl-restriction-check.rs:44:1
74+
--> $DIR/impl-restriction-check.rs:43:1
7575
|
7676
LL | impl foo::bar::Qux for u8 {}
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^
7878
|
7979
note: trait restricted here
80-
--> $DIR/impl-restriction-check.rs:20:20
80+
--> $DIR/impl-restriction-check.rs:19:20
8181
|
8282
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^
8484

8585
error: trait cannot be implemented outside `foo`
86-
--> $DIR/impl-restriction-check.rs:46:1
86+
--> $DIR/impl-restriction-check.rs:45:1
8787
|
8888
LL | impl foo::bar::FooBar for u8 {}
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9090
|
9191
note: trait restricted here
92-
--> $DIR/impl-restriction-check.rs:21:20
92+
--> $DIR/impl-restriction-check.rs:20:20
9393
|
9494
LL | pub(crate) impl(in crate::foo) trait FooBar {}
9595
| ^^^^^^^^^^^^^^^^^^^

tests/ui/impl-restriction/impl-restriction-check.e2018.stderr

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,95 @@
11
error: trait cannot be implemented outside `external`
2-
--> $DIR/impl-restriction-check.rs:12:1
2+
--> $DIR/impl-restriction-check.rs:11:1
33
|
44
LL | impl external::TopLevel for LocalType {}
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
77
note: trait restricted here
8-
--> $DIR/auxiliary/external-impl-restriction.rs:4:5
8+
--> $DIR/auxiliary/external-impl-restriction.rs:3:5
99
|
1010
LL | pub impl(crate) trait TopLevel {}
1111
| ^^^^^^^^^^^
1212

1313
error: trait cannot be implemented outside `external`
14-
--> $DIR/impl-restriction-check.rs:13:1
14+
--> $DIR/impl-restriction-check.rs:12:1
1515
|
1616
LL | impl external::inner::Inner for LocalType {}
1717
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1818
|
1919
note: trait restricted here
20-
--> $DIR/auxiliary/external-impl-restriction.rs:7:9
20+
--> $DIR/auxiliary/external-impl-restriction.rs:6:9
2121
|
2222
LL | pub impl(self) trait Inner {}
2323
| ^^^^^^^^^^
2424

2525
error: trait cannot be implemented outside `crate::foo::bar`
26-
--> $DIR/impl-restriction-check.rs:30:5
26+
--> $DIR/impl-restriction-check.rs:29:5
2727
|
2828
LL | impl bar::Foo for i8 {}
2929
| ^^^^^^^^^^^^^^^^^^^^
3030
|
3131
note: trait restricted here
32-
--> $DIR/impl-restriction-check.rs:17:20
32+
--> $DIR/impl-restriction-check.rs:16:20
3333
|
3434
LL | pub(crate) impl(self) trait Foo {}
3535
| ^^^^^^^^^^
3636

3737
error: trait cannot be implemented outside `crate::foo::bar`
38-
--> $DIR/impl-restriction-check.rs:39:1
38+
--> $DIR/impl-restriction-check.rs:38:1
3939
|
4040
LL | impl foo::bar::Foo for u8 {}
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^
4242
|
4343
note: trait restricted here
44-
--> $DIR/impl-restriction-check.rs:17:20
44+
--> $DIR/impl-restriction-check.rs:16:20
4545
|
4646
LL | pub(crate) impl(self) trait Foo {}
4747
| ^^^^^^^^^^
4848

4949
error: trait cannot be implemented outside `crate::foo`
50-
--> $DIR/impl-restriction-check.rs:41:1
50+
--> $DIR/impl-restriction-check.rs:40:1
5151
|
5252
LL | impl foo::bar::Bar for u8 {}
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^
5454
|
5555
note: trait restricted here
56-
--> $DIR/impl-restriction-check.rs:18:20
56+
--> $DIR/impl-restriction-check.rs:17:20
5757
|
5858
LL | pub(crate) impl(super) trait Bar {}
5959
| ^^^^^^^^^^^
6060

6161
error: trait cannot be implemented outside `crate::foo::bar`
62-
--> $DIR/impl-restriction-check.rs:34:5
62+
--> $DIR/impl-restriction-check.rs:33:5
6363
|
6464
LL | impl bar::Qux for i8 {}
6565
| ^^^^^^^^^^^^^^^^^^^^
6666
|
6767
note: trait restricted here
68-
--> $DIR/impl-restriction-check.rs:20:20
68+
--> $DIR/impl-restriction-check.rs:19:20
6969
|
7070
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
7171
| ^^^^^^^^^^^^^^^^^^^^^^^^
7272

7373
error: trait cannot be implemented outside `crate::foo::bar`
74-
--> $DIR/impl-restriction-check.rs:44:1
74+
--> $DIR/impl-restriction-check.rs:43:1
7575
|
7676
LL | impl foo::bar::Qux for u8 {}
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^
7878
|
7979
note: trait restricted here
80-
--> $DIR/impl-restriction-check.rs:20:20
80+
--> $DIR/impl-restriction-check.rs:19:20
8181
|
8282
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
8383
| ^^^^^^^^^^^^^^^^^^^^^^^^
8484

8585
error: trait cannot be implemented outside `crate::foo`
86-
--> $DIR/impl-restriction-check.rs:46:1
86+
--> $DIR/impl-restriction-check.rs:45:1
8787
|
8888
LL | impl foo::bar::FooBar for u8 {}
8989
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9090
|
9191
note: trait restricted here
92-
--> $DIR/impl-restriction-check.rs:21:20
92+
--> $DIR/impl-restriction-check.rs:20:20
9393
|
9494
LL | pub(crate) impl(in crate::foo) trait FooBar {}
9595
| ^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)