summaryrefslogtreecommitdiffstats
path: root/tests/ui/trait-bounds
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/trait-bounds')
-rw-r--r--tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs6
-rw-r--r--tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr13
-rw-r--r--tests/ui/trait-bounds/issue-82038.rs9
-rw-r--r--tests/ui/trait-bounds/issue-82038.stderr15
4 files changed, 43 insertions, 0 deletions
diff --git a/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs
new file mode 100644
index 000000000..91525bc90
--- /dev/null
+++ b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.rs
@@ -0,0 +1,6 @@
+// Regression test for one part of issue #105306.
+
+fn main() {
+ let _ = Option::<[u8]>::None;
+ //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
+}
diff --git a/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr
new file mode 100644
index 000000000..32f6b00b2
--- /dev/null
+++ b/tests/ui/trait-bounds/enum-unit-variant-trait-bound.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/enum-unit-variant-trait-bound.rs:4:22
+ |
+LL | let _ = Option::<[u8]>::None;
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `[u8]`
+note: required by a bound in `None`
+ --> $SRC_DIR/core/src/option.rs:LL:COL
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/trait-bounds/issue-82038.rs b/tests/ui/trait-bounds/issue-82038.rs
new file mode 100644
index 000000000..11de714fa
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.rs
@@ -0,0 +1,9 @@
+// Failed bound `bool: Foo` must not point at the `Self: Clone` line
+
+trait Foo {
+ fn my_method() where Self: Clone;
+}
+
+fn main() {
+ <bool as Foo>::my_method(); //~ERROR [E0277]
+}
diff --git a/tests/ui/trait-bounds/issue-82038.stderr b/tests/ui/trait-bounds/issue-82038.stderr
new file mode 100644
index 000000000..30bb4a0a8
--- /dev/null
+++ b/tests/ui/trait-bounds/issue-82038.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `bool: Foo` is not satisfied
+ --> $DIR/issue-82038.rs:8:6
+ |
+LL | <bool as Foo>::my_method();
+ | ^^^^ the trait `Foo` is not implemented for `bool`
+ |
+help: this trait has no implementations, consider adding one
+ --> $DIR/issue-82038.rs:3:1
+ |
+LL | trait Foo {
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.