2 // Tests for RFC 1268: we allow overlapping impls of marker traits,
3 // that is, traits with #[marker]. In this case, a type `T` is
4 // `MyMarker` if it is either `Debug` or `Display`.
6 #![feature(marker_trait_attr)]
8 use std::fmt::{Debug, Display};
10 #[marker] trait MyMarker {}
12 impl<T: Debug> MyMarker for T {}
13 impl<T: Display> MyMarker for T {}
15 fn foo<T: MyMarker>(t: T) -> T {
21 assert_eq!(1, foo(1));
22 assert_eq!(2.0, foo(2.0));
25 assert_eq!(vec![1], foo(vec![1]));