From 66ab625771f9f9c2a88822fc9389b0c1a271ac28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Wed, 27 Dec 2023 18:53:06 +0100 Subject: [PATCH] Make feature `negative_bounds` internal --- compiler/rustc_feature/src/unstable.rs | 2 +- .../negative-bounds/associated-constraints.rs | 1 - .../associated-constraints.stderr | 20 +++++--------- .../opaque-type-unsatisfied-bound.rs | 1 - .../opaque-type-unsatisfied-bound.stderr | 26 +++++++------------ .../opaque-type-unsatisfied-fn-bound.rs | 1 - .../opaque-type-unsatisfied-fn-bound.stderr | 14 +++------- tests/ui/traits/negative-bounds/simple.rs | 1 - tests/ui/traits/negative-bounds/simple.stderr | 26 +++++++------------ tests/ui/traits/negative-bounds/supertrait.rs | 1 - .../traits/negative-bounds/supertrait.stderr | 10 ------- 11 files changed, 28 insertions(+), 75 deletions(-) delete mode 100644 tests/ui/traits/negative-bounds/supertrait.stderr diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 60586f54fd584..07ec76af1f36c 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -210,7 +210,7 @@ declare_features! ( /// Allows the `multiple_supertrait_upcastable` lint. (unstable, multiple_supertrait_upcastable, "1.69.0", None), /// Allow negative trait bounds. This is an internal-only feature for testing the trait solver! - (incomplete, negative_bounds, "1.71.0", None), + (internal, negative_bounds, "1.71.0", None), /// Allows using `#[omit_gdb_pretty_printer_section]`. (internal, omit_gdb_pretty_printer_section, "1.5.0", None), /// Allows using `#[prelude_import]` on glob `use` items. diff --git a/tests/ui/traits/negative-bounds/associated-constraints.rs b/tests/ui/traits/negative-bounds/associated-constraints.rs index 54785e083541b..4a7132ccde917 100644 --- a/tests/ui/traits/negative-bounds/associated-constraints.rs +++ b/tests/ui/traits/negative-bounds/associated-constraints.rs @@ -1,5 +1,4 @@ #![feature(negative_bounds, associated_type_bounds)] -//~^ WARN the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes trait Trait { type Assoc; diff --git a/tests/ui/traits/negative-bounds/associated-constraints.stderr b/tests/ui/traits/negative-bounds/associated-constraints.stderr index c49bb70d4d50b..c1a6d2ca6a2e2 100644 --- a/tests/ui/traits/negative-bounds/associated-constraints.stderr +++ b/tests/ui/traits/negative-bounds/associated-constraints.stderr @@ -1,40 +1,32 @@ error: associated type constraints not allowed on negative bounds - --> $DIR/associated-constraints.rs:8:19 + --> $DIR/associated-constraints.rs:7:19 | LL | fn test>() {} | ^^^^^^^^^^^ error: associated type constraints not allowed on negative bounds - --> $DIR/associated-constraints.rs:11:31 + --> $DIR/associated-constraints.rs:10:31 | LL | fn test2() where T: !Trait {} | ^^^^^^^^^^^ error: associated type constraints not allowed on negative bounds - --> $DIR/associated-constraints.rs:14:20 + --> $DIR/associated-constraints.rs:13:20 | LL | fn test3>() {} | ^^^^^^^^^^^ error: associated type constraints not allowed on negative bounds - --> $DIR/associated-constraints.rs:17:31 + --> $DIR/associated-constraints.rs:16:31 | LL | fn test4() where T: !Trait {} | ^^^^^^^^^^^ error: parenthetical notation may not be used for negative bounds - --> $DIR/associated-constraints.rs:20:25 + --> $DIR/associated-constraints.rs:19:25 | LL | fn test5() where T: !Fn() -> i32 {} | ^^^^^^^^^^^ -warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/associated-constraints.rs:1:12 - | -LL | #![feature(negative_bounds, associated_type_bounds)] - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 5 previous errors diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs index 55a8c93283cc1..890b5a66fba65 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs @@ -1,7 +1,6 @@ // compile-flags: -Znext-solver #![feature(negative_bounds, negative_impls)] -//~^ WARN the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes trait Trait {} impl !Trait for () {} diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr index 9355f098c3800..ceb0bc3e1b722 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr @@ -1,13 +1,5 @@ -warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/opaque-type-unsatisfied-bound.rs:3:12 - | -LL | #![feature(negative_bounds, negative_impls)] - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0308]: mismatched types - --> $DIR/opaque-type-unsatisfied-bound.rs:16:36 + --> $DIR/opaque-type-unsatisfied-bound.rs:15:36 | LL | fn weird0() -> impl Sized + !Sized {} | ------------------- ^^ types differ @@ -18,13 +10,13 @@ LL | fn weird0() -> impl Sized + !Sized {} found unit type `()` error[E0271]: type mismatch resolving `() == impl !Sized` - --> $DIR/opaque-type-unsatisfied-bound.rs:16:16 + --> $DIR/opaque-type-unsatisfied-bound.rs:15:16 | LL | fn weird0() -> impl Sized + !Sized {} | ^^^^^^^^^^^^^^^^^^^ types differ error[E0308]: mismatched types - --> $DIR/opaque-type-unsatisfied-bound.rs:19:36 + --> $DIR/opaque-type-unsatisfied-bound.rs:18:36 | LL | fn weird1() -> impl Sized + !Sized {} | ------------------- ^^ types differ @@ -35,13 +27,13 @@ LL | fn weird1() -> impl Sized + !Sized {} found unit type `()` error[E0271]: type mismatch resolving `() == impl !Sized` - --> $DIR/opaque-type-unsatisfied-bound.rs:19:16 + --> $DIR/opaque-type-unsatisfied-bound.rs:18:16 | LL | fn weird1() -> impl Sized + !Sized {} | ^^^^^^^^^^^^^^^^^^^ types differ error[E0308]: mismatched types - --> $DIR/opaque-type-unsatisfied-bound.rs:22:36 + --> $DIR/opaque-type-unsatisfied-bound.rs:21:36 | LL | fn weird2() -> impl !Sized + Sized {} | ------------------- ^^ types differ @@ -52,13 +44,13 @@ LL | fn weird2() -> impl !Sized + Sized {} found unit type `()` error[E0271]: type mismatch resolving `() == impl !Sized` - --> $DIR/opaque-type-unsatisfied-bound.rs:22:16 + --> $DIR/opaque-type-unsatisfied-bound.rs:21:16 | LL | fn weird2() -> impl !Sized + Sized {} | ^^^^^^^^^^^^^^^^^^^ types differ error[E0277]: the trait bound `impl !Trait: Trait` is not satisfied - --> $DIR/opaque-type-unsatisfied-bound.rs:13:13 + --> $DIR/opaque-type-unsatisfied-bound.rs:12:13 | LL | consume(produce()); | ------- ^^^^^^^^^ the trait `Trait` is not implemented for `impl !Trait` @@ -66,12 +58,12 @@ LL | consume(produce()); | required by a bound introduced by this call | note: required by a bound in `consume` - --> $DIR/opaque-type-unsatisfied-bound.rs:10:20 + --> $DIR/opaque-type-unsatisfied-bound.rs:9:20 | LL | fn consume(_: impl Trait) {} | ^^^^^ required by this bound in `consume` -error: aborting due to 7 previous errors; 1 warning emitted +error: aborting due to 7 previous errors Some errors have detailed explanations: E0271, E0277, E0308. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs index 87a7d41e62d9c..72bca1a8910b5 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs @@ -1,7 +1,6 @@ // compile-flags: -Znext-solver #![feature(negative_bounds, unboxed_closures)] -//~^ WARN the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes fn produce() -> impl !Fn<(u32,)> {} //~^ ERROR mismatched types diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr index 571f5db315323..a4fb4b2b5c47f 100644 --- a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr +++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr @@ -1,13 +1,5 @@ -warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/opaque-type-unsatisfied-fn-bound.rs:3:12 - | -LL | #![feature(negative_bounds, unboxed_closures)] - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0308]: mismatched types - --> $DIR/opaque-type-unsatisfied-fn-bound.rs:6:34 + --> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:34 | LL | fn produce() -> impl !Fn<(u32,)> {} | ---------------- ^^ types differ @@ -18,12 +10,12 @@ LL | fn produce() -> impl !Fn<(u32,)> {} found unit type `()` error[E0271]: type mismatch resolving `() == impl !Fn<(u32,)>` - --> $DIR/opaque-type-unsatisfied-fn-bound.rs:6:17 + --> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17 | LL | fn produce() -> impl !Fn<(u32,)> {} | ^^^^^^^^^^^^^^^^ types differ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors Some errors have detailed explanations: E0271, E0308. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/negative-bounds/simple.rs b/tests/ui/traits/negative-bounds/simple.rs index f6d1d5169c4fc..a2febf353f6d3 100644 --- a/tests/ui/traits/negative-bounds/simple.rs +++ b/tests/ui/traits/negative-bounds/simple.rs @@ -1,5 +1,4 @@ #![feature(negative_bounds, negative_impls)] -//~^ WARN the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes fn not_copy() {} diff --git a/tests/ui/traits/negative-bounds/simple.stderr b/tests/ui/traits/negative-bounds/simple.stderr index a3cab41a2ce0f..6d750739e197c 100644 --- a/tests/ui/traits/negative-bounds/simple.stderr +++ b/tests/ui/traits/negative-bounds/simple.stderr @@ -1,44 +1,36 @@ -warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/simple.rs:1:12 - | -LL | #![feature(negative_bounds, negative_impls)] - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `T: !Copy` is not satisfied - --> $DIR/simple.rs:11:16 + --> $DIR/simple.rs:10:16 | LL | not_copy::(); | ^ the trait `!Copy` is not implemented for `T` | note: required by a bound in `not_copy` - --> $DIR/simple.rs:4:16 + --> $DIR/simple.rs:3:16 | LL | fn not_copy() {} | ^^^^^ required by this bound in `not_copy` error[E0277]: the trait bound `T: !Copy` is not satisfied - --> $DIR/simple.rs:16:16 + --> $DIR/simple.rs:15:16 | LL | not_copy::(); | ^ the trait `!Copy` is not implemented for `T` | note: required by a bound in `not_copy` - --> $DIR/simple.rs:4:16 + --> $DIR/simple.rs:3:16 | LL | fn not_copy() {} | ^^^^^ required by this bound in `not_copy` error[E0277]: the trait bound `Copyable: !Copy` is not satisfied - --> $DIR/simple.rs:31:16 + --> $DIR/simple.rs:30:16 | LL | not_copy::(); | ^^^^^^^^ the trait `!Copy` is not implemented for `Copyable` | = help: the trait `Copy` is implemented for `Copyable` note: required by a bound in `not_copy` - --> $DIR/simple.rs:4:16 + --> $DIR/simple.rs:3:16 | LL | fn not_copy() {} | ^^^^^ required by this bound in `not_copy` @@ -49,13 +41,13 @@ LL | struct Copyable; | error[E0277]: the trait bound `NotNecessarilyCopyable: !Copy` is not satisfied - --> $DIR/simple.rs:38:16 + --> $DIR/simple.rs:37:16 | LL | not_copy::(); | ^^^^^^^^^^^^^^^^^^^^^^ the trait `!Copy` is not implemented for `NotNecessarilyCopyable` | note: required by a bound in `not_copy` - --> $DIR/simple.rs:4:16 + --> $DIR/simple.rs:3:16 | LL | fn not_copy() {} | ^^^^^ required by this bound in `not_copy` @@ -65,6 +57,6 @@ LL + #[derive(Copy)] LL | struct NotNecessarilyCopyable; | -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/negative-bounds/supertrait.rs b/tests/ui/traits/negative-bounds/supertrait.rs index df0884b8b9f16..a66bc4a60a08e 100644 --- a/tests/ui/traits/negative-bounds/supertrait.rs +++ b/tests/ui/traits/negative-bounds/supertrait.rs @@ -1,7 +1,6 @@ // check-pass #![feature(negative_bounds)] -//~^ WARN the feature `negative_bounds` is incomplete trait A: !B {} trait B: !A {} diff --git a/tests/ui/traits/negative-bounds/supertrait.stderr b/tests/ui/traits/negative-bounds/supertrait.stderr deleted file mode 100644 index f44753b624e3f..0000000000000 --- a/tests/ui/traits/negative-bounds/supertrait.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/supertrait.rs:3:12 - | -LL | #![feature(negative_bounds)] - | ^^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted -