rust/tests/ui/traits/negative-impls/negative-specializes-positive.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
388 B
Rust
Raw Normal View History

2020-05-17 08:22:48 +00:00
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete
#![feature(negative_impls)]
// Negative impl for u32 cannot "specialize" the base impl.
trait MyTrait {}
impl<T> MyTrait for T {}
2020-04-22 12:18:22 +00:00
impl !MyTrait for u32 {} //~ ERROR E0751
// The second impl specializes the first, no error.
trait MyTrait2 {}
impl<T> MyTrait2 for T {}
impl MyTrait2 for u32 {}
fn main() {}