]> git.lizzy.rs Git - rust.git/blob - tests/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / ui / coherence / coherence-blanket-conflicts-with-blanket-implemented.rs
1 use std::fmt::Debug;
2 use std::default::Default;
3
4 // Test that two blanket impls conflict (at least without negative
5 // bounds).  After all, some other crate could implement Even or Odd
6 // for the same type (though this crate doesn't).
7
8 trait MyTrait {
9     fn get(&self) -> usize;
10 }
11
12 trait Even { }
13
14 trait Odd { }
15
16 impl Even for isize { }
17
18 impl Odd for usize { }
19
20 impl<T:Even> MyTrait for T {
21     fn get(&self) -> usize { 0 }
22 }
23
24 impl<T:Odd> MyTrait for T {
25 //~^ ERROR E0119
26
27     fn get(&self) -> usize { 0 }
28 }
29
30 fn main() { }