2 // Tests for RFC 1268: we allow overlapping impls of marker traits,
3 // that is, traits without items. In this case, a type `T` is
4 // `MyMarker` if it is either `Debug` or `Display`.
6 #![feature(marker_trait_attr)]
7 #![feature(negative_impls)]
9 use std::fmt::{Debug, Display};
14 impl<T: Debug> MyMarker for T {}
15 impl<T: Display> MyMarker for T {}
17 fn foo<T: MyMarker>(t: T) -> T {
23 assert_eq!(1, foo(1));
24 assert_eq!(2.0, foo(2.0));
27 assert_eq!(vec![1], foo(vec![1]));