about summary refs log tree commit diff
path: root/tests/ui/traits
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/traits')
-rw-r--r--tests/ui/traits/negative-bounds/negative-metasized.current.stderr39
-rw-r--r--tests/ui/traits/negative-bounds/negative-metasized.next.stderr39
-rw-r--r--tests/ui/traits/negative-bounds/negative-metasized.rs21
3 files changed, 99 insertions, 0 deletions
diff --git a/tests/ui/traits/negative-bounds/negative-metasized.current.stderr b/tests/ui/traits/negative-bounds/negative-metasized.current.stderr
new file mode 100644
index 00000000000..4ff51651336
--- /dev/null
+++ b/tests/ui/traits/negative-bounds/negative-metasized.current.stderr
@@ -0,0 +1,39 @@
+error[E0277]: the trait bound `T: !MetaSized` is not satisfied
+  --> $DIR/negative-metasized.rs:12:11
+   |
+LL |     foo::<T>();
+   |           ^ the trait bound `T: !MetaSized` is not satisfied
+   |
+note: required by a bound in `foo`
+  --> $DIR/negative-metasized.rs:9:11
+   |
+LL | fn foo<T: !MetaSized>() {}
+   |           ^^^^^^^^^^ required by this bound in `foo`
+
+error[E0277]: the trait bound `(): !MetaSized` is not satisfied
+  --> $DIR/negative-metasized.rs:17:11
+   |
+LL |     foo::<()>();
+   |           ^^ the trait bound `(): !MetaSized` is not satisfied
+   |
+note: required by a bound in `foo`
+  --> $DIR/negative-metasized.rs:9:11
+   |
+LL | fn foo<T: !MetaSized>() {}
+   |           ^^^^^^^^^^ required by this bound in `foo`
+
+error[E0277]: the trait bound `str: !MetaSized` is not satisfied
+  --> $DIR/negative-metasized.rs:19:11
+   |
+LL |     foo::<str>();
+   |           ^^^ the trait bound `str: !MetaSized` is not satisfied
+   |
+note: required by a bound in `foo`
+  --> $DIR/negative-metasized.rs:9:11
+   |
+LL | fn foo<T: !MetaSized>() {}
+   |           ^^^^^^^^^^ required by this bound in `foo`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/negative-bounds/negative-metasized.next.stderr b/tests/ui/traits/negative-bounds/negative-metasized.next.stderr
new file mode 100644
index 00000000000..4ff51651336
--- /dev/null
+++ b/tests/ui/traits/negative-bounds/negative-metasized.next.stderr
@@ -0,0 +1,39 @@
+error[E0277]: the trait bound `T: !MetaSized` is not satisfied
+  --> $DIR/negative-metasized.rs:12:11
+   |
+LL |     foo::<T>();
+   |           ^ the trait bound `T: !MetaSized` is not satisfied
+   |
+note: required by a bound in `foo`
+  --> $DIR/negative-metasized.rs:9:11
+   |
+LL | fn foo<T: !MetaSized>() {}
+   |           ^^^^^^^^^^ required by this bound in `foo`
+
+error[E0277]: the trait bound `(): !MetaSized` is not satisfied
+  --> $DIR/negative-metasized.rs:17:11
+   |
+LL |     foo::<()>();
+   |           ^^ the trait bound `(): !MetaSized` is not satisfied
+   |
+note: required by a bound in `foo`
+  --> $DIR/negative-metasized.rs:9:11
+   |
+LL | fn foo<T: !MetaSized>() {}
+   |           ^^^^^^^^^^ required by this bound in `foo`
+
+error[E0277]: the trait bound `str: !MetaSized` is not satisfied
+  --> $DIR/negative-metasized.rs:19:11
+   |
+LL |     foo::<str>();
+   |           ^^^ the trait bound `str: !MetaSized` is not satisfied
+   |
+note: required by a bound in `foo`
+  --> $DIR/negative-metasized.rs:9:11
+   |
+LL | fn foo<T: !MetaSized>() {}
+   |           ^^^^^^^^^^ required by this bound in `foo`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/traits/negative-bounds/negative-metasized.rs b/tests/ui/traits/negative-bounds/negative-metasized.rs
new file mode 100644
index 00000000000..479037be852
--- /dev/null
+++ b/tests/ui/traits/negative-bounds/negative-metasized.rs
@@ -0,0 +1,21 @@
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+#![feature(negative_bounds)]
+#![feature(sized_hierarchy)]
+
+use std::marker::MetaSized;
+
+fn foo<T: !MetaSized>() {}
+
+fn bar<T: !Sized + MetaSized>() {
+    foo::<T>();
+    //~^ ERROR the trait bound `T: !MetaSized` is not satisfied
+}
+
+fn main() {
+    foo::<()>();
+    //~^ ERROR the trait bound `(): !MetaSized` is not satisfied
+    foo::<str>();
+    //~^ ERROR the trait bound `str: !MetaSized` is not satisfied
+}