about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-26 01:42:14 +0000
committerbors <bors@rust-lang.org>2018-06-26 01:42:14 +0000
commitfdd9cdc8792d8fa4a64956c7d3263fa5ce18e335 (patch)
tree34deb6049374a320b66e7ded0ce3704334bfcd32 /src/test/compile-fail
parent2a1c4eec40527de45b9d9b81672c8b9220d554fc (diff)
parentcc60e01581d3bb290a2299a6c2474aa29bf6a15f (diff)
downloadrust-fdd9cdc8792d8fa4a64956c7d3263fa5ce18e335.tar.gz
rust-fdd9cdc8792d8fa4a64956c7d3263fa5ce18e335.zip
Auto merge of #50966 - leodasvacas:self-in-where-clauses-is-not-object-safe, r=nikomatsakis
`Self` in where clauses may not be object safe

Needs crater, virtually certain to cause regressions.

In #50781 it was discovered that our object safety rules are not sound because we allow `Self` in where clauses without restrain. This PR is a direct fix to the rules so that we disallow methods with unsound where clauses.

This currently uses hard error to measure impact, but we will want to downgrade it to a future compat error.

Part of #50781.

r? @nikomatsakis
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/issue-43431.rs2
-rw-r--r--src/test/compile-fail/wf-trait-fn-where-clause.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/test/compile-fail/issue-43431.rs b/src/test/compile-fail/issue-43431.rs
index e9f62152888..1e6366e068a 100644
--- a/src/test/compile-fail/issue-43431.rs
+++ b/src/test/compile-fail/issue-43431.rs
@@ -11,7 +11,7 @@
 #![feature(fn_traits)]
 
 trait CallSingle<A, B> {
-    fn call(&self, a: A) -> B where Self: Fn(A) -> B;
+    fn call(&self, a: A) -> B where Self: Sized, Self: Fn(A) -> B;
 }
 
 impl<A, B, F: Fn(A) -> B> CallSingle<A, B> for F {
diff --git a/src/test/compile-fail/wf-trait-fn-where-clause.rs b/src/test/compile-fail/wf-trait-fn-where-clause.rs
index f59dca93bb9..f46a54504a0 100644
--- a/src/test/compile-fail/wf-trait-fn-where-clause.rs
+++ b/src/test/compile-fail/wf-trait-fn-where-clause.rs
@@ -17,7 +17,7 @@
 struct Bar<T:Eq+?Sized> { value: Box<T> }
 
 trait Foo {
-    fn bar(&self) where Bar<Self>: Copy;
+    fn bar(&self) where Self: Sized, Bar<Self>: Copy;
         //~^ ERROR E0277
         //
         // Here, Eq ought to be implemented.