rust/src/test/ui/traits/negative-impls/negative-specializes-positive.rs

15 lines
342 B
Rust
Raw Normal View History

#![feature(specialization)]
#![feature(optin_builtin_traits)]
// Negative impl for u32 cannot "specialize" the base impl.
trait MyTrait {}
impl<T> MyTrait for T {}
impl !MyTrait for u32 {} //~ ERROR E0748
// The second impl specializes the first, no error.
trait MyTrait2 {}
impl<T> MyTrait2 for T {}
impl MyTrait2 for u32 {}
fn main() {}