summaryrefslogtreecommitdiffstats
path: root/tests/ui/where-clauses
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/where-clauses')
-rw-r--r--tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr2
-rw-r--r--tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr2
-rw-r--r--tests/ui/where-clauses/self-in-where-clause-allowed.rs23
-rw-r--r--tests/ui/where-clauses/self-in-where-clause-allowed.stderr15
4 files changed, 40 insertions, 2 deletions
diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
index 30248a7a3..191a8ca8e 100644
--- a/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
+++ b/tests/ui/where-clauses/higher-ranked-fn-type.quiet.stderr
@@ -8,7 +8,7 @@ note: required by a bound in `called`
--> $DIR/higher-ranked-fn-type.rs:12:25
|
LL | fn called()
- | ------ required by a bound in this
+ | ------ required by a bound in this function
LL | where
LL | for<'b> fn(&'b ()): Foo,
| ^^^ required by this bound in `called`
diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
index 268cef6e2..f4c7acd5c 100644
--- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
+++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
@@ -8,7 +8,7 @@ note: required by a bound in `called`
--> $DIR/higher-ranked-fn-type.rs:12:25
|
LL | fn called()
- | ------ required by a bound in this
+ | ------ required by a bound in this function
LL | where
LL | for<'b> fn(&'b ()): Foo,
| ^^^ required by this bound in `called`
diff --git a/tests/ui/where-clauses/self-in-where-clause-allowed.rs b/tests/ui/where-clauses/self-in-where-clause-allowed.rs
new file mode 100644
index 000000000..6cf5ed2e4
--- /dev/null
+++ b/tests/ui/where-clauses/self-in-where-clause-allowed.rs
@@ -0,0 +1,23 @@
+// check-fail
+
+#![feature(auto_traits)]
+#![deny(where_clauses_object_safety)]
+
+auto trait AutoTrait {}
+
+trait Trait {
+ fn static_lifetime_bound(&self) where Self: 'static {}
+
+ fn arg_lifetime_bound<'a>(&self, _arg: &'a ()) where Self: 'a {}
+
+ fn autotrait_bound(&self) where Self: AutoTrait {}
+}
+
+impl Trait for () {}
+
+fn main() {
+ let trait_object = &() as &dyn Trait;
+ trait_object.static_lifetime_bound();
+ trait_object.arg_lifetime_bound(&());
+ trait_object.autotrait_bound(); //~ ERROR: the trait bound `dyn Trait: AutoTrait` is not satisfied
+}
diff --git a/tests/ui/where-clauses/self-in-where-clause-allowed.stderr b/tests/ui/where-clauses/self-in-where-clause-allowed.stderr
new file mode 100644
index 000000000..ea51f5084
--- /dev/null
+++ b/tests/ui/where-clauses/self-in-where-clause-allowed.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `dyn Trait: AutoTrait` is not satisfied
+ --> $DIR/self-in-where-clause-allowed.rs:22:18
+ |
+LL | trait_object.autotrait_bound();
+ | ^^^^^^^^^^^^^^^ the trait `AutoTrait` is not implemented for `dyn Trait`
+ |
+note: required by a bound in `Trait::autotrait_bound`
+ --> $DIR/self-in-where-clause-allowed.rs:13:43
+ |
+LL | fn autotrait_bound(&self) where Self: AutoTrait {}
+ | ^^^^^^^^^ required by this bound in `Trait::autotrait_bound`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.