302f8c97ea
See #29864 This has been replaced by `#[feature(marker_trait_attr)]` A few notes: * Due to PR #68057 not yet being in the bootstrap compiler, it's necessary to continue using `#![feature(overlapping_marker_traits)]` under `#[cfg(bootstrap)]` to work around type inference issues. * I've updated tests that used `overlapping_marker_traits` to now use `marker_trait_attr` where applicable The test `src/test/ui/overlap-marker-trait.rs` doesn't make any sense now that `overlapping_marker_traits`, so I removed it. The test `src/test/ui/traits/overlap-permitted-for-marker-traits-neg.rs` now fails, since it's no longer possible to have multiple overlapping negative impls of `Send`. I believe that this is the behavior we want (assuming that `Send` is not going to become a `#[marker]` trait, so I renamed the test to `overlap-permitted-for-marker-traits-neg`
21 lines
313 B
Rust
21 lines
313 B
Rust
// run-pass
|
|
|
|
#![feature(marker_trait_attr)]
|
|
#![feature(specialization)]
|
|
|
|
#[marker]
|
|
trait MyMarker {}
|
|
|
|
impl<T> MyMarker for T {}
|
|
impl<T> MyMarker for Vec<T> {}
|
|
|
|
fn foo<T: MyMarker>(t: T) -> T {
|
|
t
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(1, foo(1));
|
|
assert_eq!(2.0, foo(2.0));
|
|
assert_eq!(vec![1], foo(vec![1]));
|
|
}
|