about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-03-17 14:16:29 -0400
committerCorey Farwell <coreyf@rwell.org>2017-04-14 22:05:11 -0400
commitadcdd605be9cbdb338d4ecc2410cde87272f2191 (patch)
treeb078c4e2b4196dff490db3318824b1693a0a2ef0 /src/test/compile-fail
parentc81c958e984b92222909e2ba5c74a2260a44bdae (diff)
downloadrust-adcdd605be9cbdb338d4ecc2410cde87272f2191.tar.gz
rust-adcdd605be9cbdb338d4ecc2410cde87272f2191.zip
Put overlapping impls behind feature gate, add tests
I've added some explicit tests that negative impls are allowed to
overlap, and also to make sure that the feature doesn't interfere with
specialization. I've not added an explicit test for positive overlapping
with negative, as that's already tested elsewhere.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs1
-rw-r--r--src/test/compile-fail/coherence-impls-send.rs1
-rw-r--r--src/test/compile-fail/overlapping-impls-requires-feature-gate.rs17
3 files changed, 19 insertions, 0 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 d841e8c41d9..8e9d1eff345 100644
--- a/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs
+++ b/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(optin_builtin_traits)]
+#![feature(overlapping_marker_traits)]
 
 trait MyTrait {}
 
diff --git a/src/test/compile-fail/coherence-impls-send.rs b/src/test/compile-fail/coherence-impls-send.rs
index d0e6bc6a1c6..9caaee41aeb 100644
--- a/src/test/compile-fail/coherence-impls-send.rs
+++ b/src/test/compile-fail/coherence-impls-send.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 #![feature(optin_builtin_traits)]
+#![feature(overlapping_marker_traits)]
 
 use std::marker::Copy;
 
diff --git a/src/test/compile-fail/overlapping-impls-requires-feature-gate.rs b/src/test/compile-fail/overlapping-impls-requires-feature-gate.rs
new file mode 100644
index 00000000000..bf2b06dd8ba
--- /dev/null
+++ b/src/test/compile-fail/overlapping-impls-requires-feature-gate.rs
@@ -0,0 +1,17 @@
+// Copyright 2017 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.
+
+trait MyMarker {}
+
+impl<T> MyMarker for T {}
+impl<T> MyMarker for Vec<T> {}
+//~^ ERROR E0119
+
+fn main() {}