1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Test for RFC 1268: we allow overlapping impls of marker traits,
12 // that is, traits without items. In this case, a type `T` is
13 // `MyMarker` if it is either `Debug` or `Display`. This test just
14 // checks that we don't consider **all** types to be `MyMarker`. See
15 // also the companion test in
16 // `run-pass/overlap-permitted-for-marker-traits.rs`.
18 #![feature(overlapping_marker_traits)]
19 #![feature(optin_builtin_traits)]
21 use std::fmt::{Debug, Display};
25 impl<T: Debug> Marker for T {}
26 impl<T: Display> Marker for T {}
28 fn is_marker<T: Marker>() { }
30 struct NotDebugOrDisplay;
37 is_marker::<Vec<i32>>();
40 is_marker::<NotDebugOrDisplay>(); //~ ERROR