about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/traits/negative-bounds/associated-constraints.rs4
-rw-r--r--tests/ui/traits/negative-bounds/associated-constraints.stderr20
-rw-r--r--tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs23
-rw-r--r--tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr69
-rw-r--r--tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs9
-rw-r--r--tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr21
-rw-r--r--tests/ui/traits/negative-bounds/simple.rs1
-rw-r--r--tests/ui/traits/negative-bounds/simple.stderr26
-rw-r--r--tests/ui/traits/negative-bounds/supertrait.rs1
-rw-r--r--tests/ui/traits/negative-bounds/supertrait.stderr10
10 files changed, 143 insertions, 41 deletions
diff --git a/tests/ui/traits/negative-bounds/associated-constraints.rs b/tests/ui/traits/negative-bounds/associated-constraints.rs
index bc1a0ef1708..4a7132ccde9 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;
@@ -17,4 +16,7 @@ fn test3<T: !Trait<Assoc: Send>>() {}
 fn test4<T>() where T: !Trait<Assoc: Send> {}
 //~^ ERROR associated type constraints not allowed on negative bounds
 
+fn test5<T>() where T: !Fn() -> i32 {}
+//~^ ERROR parenthetical notation may not be used for negative bounds
+
 fn main() {}
diff --git a/tests/ui/traits/negative-bounds/associated-constraints.stderr b/tests/ui/traits/negative-bounds/associated-constraints.stderr
index 335ac7e5ad9..c1a6d2ca6a2 100644
--- a/tests/ui/traits/negative-bounds/associated-constraints.stderr
+++ b/tests/ui/traits/negative-bounds/associated-constraints.stderr
@@ -1,34 +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<T: !Trait<Assoc = i32>>() {}
    |                   ^^^^^^^^^^^
 
 error: associated type constraints not allowed on negative bounds
-  --> $DIR/associated-constraints.rs:11:31
+  --> $DIR/associated-constraints.rs:10:31
    |
 LL | fn test2<T>() where T: !Trait<Assoc = i32> {}
    |                               ^^^^^^^^^^^
 
 error: associated type constraints not allowed on negative bounds
-  --> $DIR/associated-constraints.rs:14:20
+  --> $DIR/associated-constraints.rs:13:20
    |
 LL | fn test3<T: !Trait<Assoc: Send>>() {}
    |                    ^^^^^^^^^^^
 
 error: associated type constraints not allowed on negative bounds
-  --> $DIR/associated-constraints.rs:17:31
+  --> $DIR/associated-constraints.rs:16:31
    |
 LL | fn test4<T>() where T: !Trait<Assoc: Send> {}
    |                               ^^^^^^^^^^^
 
-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
+error: parenthetical notation may not be used for negative bounds
+  --> $DIR/associated-constraints.rs:19:25
    |
-LL | #![feature(negative_bounds, associated_type_bounds)]
-   |            ^^^^^^^^^^^^^^^
-   |
-   = note: `#[warn(incomplete_features)]` on by default
+LL | fn test5<T>() where T: !Fn() -> i32 {}
+   |                         ^^^^^^^^^^^
 
-error: aborting due to 4 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
new file mode 100644
index 00000000000..e1e93f79920
--- /dev/null
+++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.rs
@@ -0,0 +1,23 @@
+// compile-flags: -Znext-solver
+
+#![feature(negative_bounds, negative_impls)]
+
+trait Trait {}
+impl !Trait for () {}
+
+fn produce() -> impl !Trait {}
+fn consume(_: impl Trait) {}
+
+fn main() {
+    consume(produce()); //~ ERROR the trait bound `impl !Trait: Trait` is not satisfied
+}
+
+fn weird0() -> impl Sized + !Sized {}
+//~^ ERROR mismatched types
+//~| ERROR type mismatch resolving `() == impl !Sized + Sized`
+fn weird1() -> impl !Sized + Sized {}
+//~^ ERROR mismatched types
+//~| ERROR type mismatch resolving `() == impl !Sized + Sized`
+fn weird2() -> impl !Sized {}
+//~^ ERROR mismatched types
+//~| ERROR type mismatch resolving `() == impl !Sized`
diff --git a/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr
new file mode 100644
index 00000000000..62792761870
--- /dev/null
+++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-bound.stderr
@@ -0,0 +1,69 @@
+error[E0308]: mismatched types
+  --> $DIR/opaque-type-unsatisfied-bound.rs:15:36
+   |
+LL | fn weird0() -> impl Sized + !Sized {}
+   |                ------------------- ^^ types differ
+   |                |
+   |                the expected opaque type
+   |
+   = note: expected opaque type `impl !Sized + Sized`
+                found unit type `()`
+
+error[E0271]: type mismatch resolving `() == impl !Sized + Sized`
+  --> $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:18:36
+   |
+LL | fn weird1() -> impl !Sized + Sized {}
+   |                ------------------- ^^ types differ
+   |                |
+   |                the expected opaque type
+   |
+   = note: expected opaque type `impl !Sized + Sized`
+                found unit type `()`
+
+error[E0271]: type mismatch resolving `() == impl !Sized + Sized`
+  --> $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:21:28
+   |
+LL | fn weird2() -> impl !Sized {}
+   |                ----------- ^^ types differ
+   |                |
+   |                the expected opaque type
+   |
+   = note: expected opaque type `impl !Sized`
+                found unit type `()`
+
+error[E0271]: type mismatch resolving `() == impl !Sized`
+  --> $DIR/opaque-type-unsatisfied-bound.rs:21:16
+   |
+LL | fn weird2() -> impl !Sized {}
+   |                ^^^^^^^^^^^ types differ
+
+error[E0277]: the trait bound `impl !Trait: Trait` is not satisfied
+  --> $DIR/opaque-type-unsatisfied-bound.rs:12:13
+   |
+LL |     consume(produce());
+   |     ------- ^^^^^^^^^ the trait `Trait` is not implemented for `impl !Trait`
+   |     |
+   |     required by a bound introduced by this call
+   |
+note: required by a bound in `consume`
+  --> $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
+
+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
new file mode 100644
index 00000000000..72bca1a8910
--- /dev/null
+++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.rs
@@ -0,0 +1,9 @@
+// compile-flags: -Znext-solver
+
+#![feature(negative_bounds, unboxed_closures)]
+
+fn produce() -> impl !Fn<(u32,)> {}
+//~^ ERROR mismatched types
+//~| ERROR type mismatch resolving `() == impl !Fn<(u32,)>`
+
+fn main() {}
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
new file mode 100644
index 00000000000..a4fb4b2b5c4
--- /dev/null
+++ b/tests/ui/traits/negative-bounds/opaque-type-unsatisfied-fn-bound.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+  --> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:34
+   |
+LL | fn produce() -> impl !Fn<(u32,)> {}
+   |                 ---------------- ^^ types differ
+   |                 |
+   |                 the expected opaque type
+   |
+   = note: expected opaque type `impl !Fn<(u32,)>`
+                found unit type `()`
+
+error[E0271]: type mismatch resolving `() == impl !Fn<(u32,)>`
+  --> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17
+   |
+LL | fn produce() -> impl !Fn<(u32,)> {}
+   |                 ^^^^^^^^^^^^^^^^ types differ
+
+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 f6d1d5169c4..a2febf353f6 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<T: !Copy>() {}
 
diff --git a/tests/ui/traits/negative-bounds/simple.stderr b/tests/ui/traits/negative-bounds/simple.stderr
index a3cab41a2ce..6d750739e19 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::<T>();
    |                ^ 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<T: !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::<T>();
    |                ^ 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<T: !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::<Copyable>();
    |                ^^^^^^^^ 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<T: !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::<NotNecessarilyCopyable>();
    |                ^^^^^^^^^^^^^^^^^^^^^^ 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<T: !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 df0884b8b9f..a66bc4a60a0 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 f44753b624e..00000000000
--- 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
-