Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ declare_features! (
/// Target features on hexagon.
(unstable, hexagon_target_feature, "1.27.0", Some(150250)),
/// Allows `impl(crate) trait Foo` restrictions.
(incomplete, impl_restriction, "1.96.0", Some(105077)),
(unstable, impl_restriction, "CURRENT_RUSTC_VERSION", Some(105077)),
/// Allows `impl Trait` to be used inside associated types (RFC 2515).
(unstable, impl_trait_in_assoc_type, "1.70.0", Some(63063)),
/// Allows `impl Trait` in bindings (`let`).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(impl_restriction)]
#![expect(incomplete_features)]

pub impl(crate) trait TopLevel {}

Expand Down
1 change: 0 additions & 1 deletion tests/ui/impl-restriction/feature-gate-impl-restriction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//@[with_gate] check-pass

#![cfg_attr(with_gate, feature(impl_restriction))]
#![cfg_attr(with_gate, allow(incomplete_features))]
#![feature(auto_traits, const_trait_impl)]

pub impl(crate) trait Bar {} //[without_gate]~ ERROR `impl` restrictions are experimental
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0658]: `impl` restrictions are experimental
--> $DIR/feature-gate-impl-restriction.rs:9:5
--> $DIR/feature-gate-impl-restriction.rs:8:5
|
LL | pub impl(crate) trait Bar {}
| ^^^^^^^^^^^
Expand All @@ -9,7 +9,7 @@ LL | pub impl(crate) trait Bar {}
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

error[E0658]: `impl` restrictions are experimental
--> $DIR/feature-gate-impl-restriction.rs:39:13
--> $DIR/feature-gate-impl-restriction.rs:38:13
|
LL | ... pub impl(in crate::foo::cfged_out_foo) const unsafe trait CfgedOutQuxConstUnsafe {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
32 changes: 16 additions & 16 deletions tests/ui/impl-restriction/impl-restriction-check.e2015.stderr
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
error: trait cannot be implemented outside `external`
--> $DIR/impl-restriction-check.rs:12:1
--> $DIR/impl-restriction-check.rs:11:1
|
LL | impl external::TopLevel for LocalType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/auxiliary/external-impl-restriction.rs:4:5
--> $DIR/auxiliary/external-impl-restriction.rs:3:5
|
LL | pub impl(crate) trait TopLevel {}
| ^^^^^^^^^^^

error: trait cannot be implemented outside `external`
--> $DIR/impl-restriction-check.rs:13:1
--> $DIR/impl-restriction-check.rs:12:1
|
LL | impl external::inner::Inner for LocalType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/auxiliary/external-impl-restriction.rs:7:9
--> $DIR/auxiliary/external-impl-restriction.rs:6:9
|
LL | pub impl(self) trait Inner {}
| ^^^^^^^^^^

error: trait cannot be implemented outside `foo::bar`
--> $DIR/impl-restriction-check.rs:30:5
--> $DIR/impl-restriction-check.rs:29:5
|
LL | impl bar::Foo for i8 {}
| ^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:17:20
--> $DIR/impl-restriction-check.rs:16:20
|
LL | pub(crate) impl(self) trait Foo {}
| ^^^^^^^^^^

error: trait cannot be implemented outside `foo::bar`
--> $DIR/impl-restriction-check.rs:39:1
--> $DIR/impl-restriction-check.rs:38:1
|
LL | impl foo::bar::Foo for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:17:20
--> $DIR/impl-restriction-check.rs:16:20
|
LL | pub(crate) impl(self) trait Foo {}
| ^^^^^^^^^^

error: trait cannot be implemented outside `foo`
--> $DIR/impl-restriction-check.rs:41:1
--> $DIR/impl-restriction-check.rs:40:1
|
LL | impl foo::bar::Bar for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:18:20
--> $DIR/impl-restriction-check.rs:17:20
|
LL | pub(crate) impl(super) trait Bar {}
| ^^^^^^^^^^^

error: trait cannot be implemented outside `foo::bar`
--> $DIR/impl-restriction-check.rs:34:5
--> $DIR/impl-restriction-check.rs:33:5
|
LL | impl bar::Qux for i8 {}
| ^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:20:20
--> $DIR/impl-restriction-check.rs:19:20
|
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: trait cannot be implemented outside `foo::bar`
--> $DIR/impl-restriction-check.rs:44:1
--> $DIR/impl-restriction-check.rs:43:1
|
LL | impl foo::bar::Qux for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:20:20
--> $DIR/impl-restriction-check.rs:19:20
|
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: trait cannot be implemented outside `foo`
--> $DIR/impl-restriction-check.rs:46:1
--> $DIR/impl-restriction-check.rs:45:1
|
LL | impl foo::bar::FooBar for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:21:20
--> $DIR/impl-restriction-check.rs:20:20
|
LL | pub(crate) impl(in crate::foo) trait FooBar {}
| ^^^^^^^^^^^^^^^^^^^
Expand Down
32 changes: 16 additions & 16 deletions tests/ui/impl-restriction/impl-restriction-check.e2018.stderr
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
error: trait cannot be implemented outside `external`
--> $DIR/impl-restriction-check.rs:12:1
--> $DIR/impl-restriction-check.rs:11:1
|
LL | impl external::TopLevel for LocalType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/auxiliary/external-impl-restriction.rs:4:5
--> $DIR/auxiliary/external-impl-restriction.rs:3:5
|
LL | pub impl(crate) trait TopLevel {}
| ^^^^^^^^^^^

error: trait cannot be implemented outside `external`
--> $DIR/impl-restriction-check.rs:13:1
--> $DIR/impl-restriction-check.rs:12:1
|
LL | impl external::inner::Inner for LocalType {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/auxiliary/external-impl-restriction.rs:7:9
--> $DIR/auxiliary/external-impl-restriction.rs:6:9
|
LL | pub impl(self) trait Inner {}
| ^^^^^^^^^^

error: trait cannot be implemented outside `crate::foo::bar`
--> $DIR/impl-restriction-check.rs:30:5
--> $DIR/impl-restriction-check.rs:29:5
|
LL | impl bar::Foo for i8 {}
| ^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:17:20
--> $DIR/impl-restriction-check.rs:16:20
|
LL | pub(crate) impl(self) trait Foo {}
| ^^^^^^^^^^

error: trait cannot be implemented outside `crate::foo::bar`
--> $DIR/impl-restriction-check.rs:39:1
--> $DIR/impl-restriction-check.rs:38:1
|
LL | impl foo::bar::Foo for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:17:20
--> $DIR/impl-restriction-check.rs:16:20
|
LL | pub(crate) impl(self) trait Foo {}
| ^^^^^^^^^^

error: trait cannot be implemented outside `crate::foo`
--> $DIR/impl-restriction-check.rs:41:1
--> $DIR/impl-restriction-check.rs:40:1
|
LL | impl foo::bar::Bar for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:18:20
--> $DIR/impl-restriction-check.rs:17:20
|
LL | pub(crate) impl(super) trait Bar {}
| ^^^^^^^^^^^

error: trait cannot be implemented outside `crate::foo::bar`
--> $DIR/impl-restriction-check.rs:34:5
--> $DIR/impl-restriction-check.rs:33:5
|
LL | impl bar::Qux for i8 {}
| ^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:20:20
--> $DIR/impl-restriction-check.rs:19:20
|
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: trait cannot be implemented outside `crate::foo::bar`
--> $DIR/impl-restriction-check.rs:44:1
--> $DIR/impl-restriction-check.rs:43:1
|
LL | impl foo::bar::Qux for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:20:20
--> $DIR/impl-restriction-check.rs:19:20
|
LL | pub(crate) impl(in crate::foo::bar) trait Qux {}
| ^^^^^^^^^^^^^^^^^^^^^^^^

error: trait cannot be implemented outside `crate::foo`
--> $DIR/impl-restriction-check.rs:46:1
--> $DIR/impl-restriction-check.rs:45:1
|
LL | impl foo::bar::FooBar for u8 {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: trait restricted here
--> $DIR/impl-restriction-check.rs:21:20
--> $DIR/impl-restriction-check.rs:20:20
|
LL | pub(crate) impl(in crate::foo) trait FooBar {}
| ^^^^^^^^^^^^^^^^^^^
Expand Down
Loading
Loading