about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs15
-rw-r--r--src/test/compile-fail/coherence-orphan.rs6
-rw-r--r--src/test/compile-fail/marker-no-send.rs22
-rw-r--r--src/test/compile-fail/marker-no-share.rs22
-rw-r--r--src/test/compile-fail/traits-negative-impls.rs22
5 files changed, 39 insertions, 48 deletions
diff --git a/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs b/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs
index 36c75465910..c9dfb8201a9 100644
--- a/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs
+++ b/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs
@@ -10,11 +10,20 @@
 
 #![feature(optin_builtin_traits)]
 
-struct TestType;
+trait MyTrait {}
 
-unsafe impl Send for TestType {}
+struct TestType<T>;
+
+unsafe impl<T: MyTrait> Send for TestType<T> {}
+//~^ ERROR conflicting implementations for trait `core::marker::Send`
+//~^^ ERROR conflicting implementations for trait `core::marker::Send`
+
+impl<T: MyTrait> !Send for TestType<T> {}
 //~^ ERROR conflicting implementations for trait `core::marker::Send`
 
-impl !Send for TestType {}
+unsafe impl<T> Send for TestType<T> {}
+//~^ ERROR error: conflicting implementations for trait `core::marker::Send`
+
+impl !Send for TestType<i32> {}
 
 fn main() {}
diff --git a/src/test/compile-fail/coherence-orphan.rs b/src/test/compile-fail/coherence-orphan.rs
index 0bd0224b246..f9f965e1ae3 100644
--- a/src/test/compile-fail/coherence-orphan.rs
+++ b/src/test/compile-fail/coherence-orphan.rs
@@ -8,8 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-tidy-linelength
 // aux-build:coherence-orphan-lib.rs
 
+#![feature(optin_builtin_traits)]
+
 extern crate "coherence-orphan-lib" as lib;
 
 use lib::TheTrait;
@@ -22,4 +25,7 @@ impl TheTrait<TheType> for isize { } //~ ERROR E0117
 
 impl TheTrait<isize> for TheType { }
 
+impl !Send for Vec<isize> { } //~ ERROR E0117
+//~^ ERROR conflicting
+
 fn main() { }
diff --git a/src/test/compile-fail/marker-no-send.rs b/src/test/compile-fail/marker-no-send.rs
deleted file mode 100644
index cd253b2f9e5..00000000000
--- a/src/test/compile-fail/marker-no-send.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-stage2
-// ignore-stage3
-
-use std::marker;
-
-fn foo<P:Send>(p: P) { }
-
-fn main()
-{
-    foo(marker::NoSend); //~ ERROR the trait `core::marker::Send` is not implemented
-}
diff --git a/src/test/compile-fail/marker-no-share.rs b/src/test/compile-fail/marker-no-share.rs
deleted file mode 100644
index d86b6a0a674..00000000000
--- a/src/test/compile-fail/marker-no-share.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-stage1
-// ignore-stage2
-// ignore-stage3
-
-use std::marker;
-
-fn foo<P: Sync>(p: P) { }
-
-fn main()
-{
-    foo(marker::NoSync); //~ ERROR the trait `core::marker::Sync` is not implemented
-}
diff --git a/src/test/compile-fail/traits-negative-impls.rs b/src/test/compile-fail/traits-negative-impls.rs
index a7d1d796801..3ef760053c7 100644
--- a/src/test/compile-fail/traits-negative-impls.rs
+++ b/src/test/compile-fail/traits-negative-impls.rs
@@ -8,6 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// The dummy functions are used to avoid adding new cfail files.
+// What happens is that the compiler attempts to squash duplicates and some
+// errors are not reported. This way, we make sure that, for each function, different
+// typeck phases are involved and all errors are reported.
+
 #![feature(optin_builtin_traits)]
 
 use std::marker::Send;
@@ -24,13 +29,28 @@ unsafe impl<T: Send> Sync for Outer2<T> {}
 fn is_send<T: Send>(_: T) {}
 fn is_sync<T: Sync>(_: T) {}
 
-fn main() {
+fn dummy() {
     Outer(TestType);
     //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
 
     is_send(TestType);
     //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
 
+    is_send((8, TestType));
+    //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
+}
+
+fn dummy2() {
+    is_send(Box::new(TestType));
+    //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
+}
+
+fn dummy3() {
+    is_send(Box::new(Outer2(TestType)));
+    //~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
+}
+
+fn main() {
     // This will complain about a missing Send impl because `Sync` is implement *just*
     // for T that are `Send`. Look at #20366 and #19950
     is_sync(Outer2(TestType));