]> git.proxmox.com Git - rustc.git/blame - src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / ui / coherence / coherence-blanket-conflicts-with-blanket-implemented.rs
CommitLineData
c34b1796 1use std::fmt::Debug;
1a4d82fc
JJ
2use 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
8trait MyTrait {
9 fn get(&self) -> usize;
10}
11
9346a6ac 12trait Even { }
1a4d82fc 13
9346a6ac 14trait Odd { }
1a4d82fc
JJ
15
16impl Even for isize { }
17
18impl Odd for usize { }
19
54a0048b 20impl<T:Even> MyTrait for T {
1a4d82fc
JJ
21 fn get(&self) -> usize { 0 }
22}
23
0731742a 24impl<T:Odd> MyTrait for T {
60c5eb7d 25//~^ ERROR E0119
0731742a 26
1a4d82fc
JJ
27 fn get(&self) -> usize { 0 }
28}
29
30fn main() { }