2015-02-21 11:28:28 +00:00
|
|
|
use std::fmt::Debug;
|
2014-10-17 13:13:22 +00:00
|
|
|
use std::default::Default;
|
|
|
|
|
|
|
|
// Test that two blanket impls conflict (at least without negative
|
|
|
|
// bounds). After all, some other crate could implement Even or Odd
|
|
|
|
// for the same type (though this crate doesn't).
|
|
|
|
|
|
|
|
trait MyTrait {
|
2015-01-08 11:02:42 +00:00
|
|
|
fn get(&self) -> usize;
|
2014-10-17 13:13:22 +00:00
|
|
|
}
|
|
|
|
|
2015-04-18 05:12:20 +00:00
|
|
|
trait Even { }
|
2014-10-17 13:13:22 +00:00
|
|
|
|
2015-04-18 05:12:20 +00:00
|
|
|
trait Odd { }
|
2014-10-17 13:13:22 +00:00
|
|
|
|
2015-01-08 10:54:35 +00:00
|
|
|
impl Even for isize { }
|
2014-10-17 13:13:22 +00:00
|
|
|
|
2015-01-08 11:02:42 +00:00
|
|
|
impl Odd for usize { }
|
2014-10-17 13:13:22 +00:00
|
|
|
|
2015-12-30 05:18:24 +00:00
|
|
|
impl<T:Even> MyTrait for T {
|
2015-01-08 11:02:42 +00:00
|
|
|
fn get(&self) -> usize { 0 }
|
2014-10-17 13:13:22 +00:00
|
|
|
}
|
|
|
|
|
2018-12-28 23:11:13 +00:00
|
|
|
impl<T:Odd> MyTrait for T {
|
2019-10-26 15:28:02 +00:00
|
|
|
//~^ ERROR E0119
|
2018-12-28 23:11:13 +00:00
|
|
|
|
2015-01-08 11:02:42 +00:00
|
|
|
fn get(&self) -> usize { 0 }
|
2014-10-17 13:13:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|