2015-02-21 13:28:28 +02:00
|
|
|
use std::fmt::Debug;
|
2014-10-17 09:13:22 -04: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 22:02:42 +11:00
|
|
|
fn get(&self) -> usize;
|
2014-10-17 09:13:22 -04:00
|
|
|
}
|
|
|
|
|
2015-04-17 22:12:20 -07:00
|
|
|
trait Even { }
|
2014-10-17 09:13:22 -04:00
|
|
|
|
2015-04-17 22:12:20 -07:00
|
|
|
trait Odd { }
|
2014-10-17 09:13:22 -04:00
|
|
|
|
2015-01-08 21:54:35 +11:00
|
|
|
impl Even for isize { }
|
2014-10-17 09:13:22 -04:00
|
|
|
|
2015-01-08 22:02:42 +11:00
|
|
|
impl Odd for usize { }
|
2014-10-17 09:13:22 -04:00
|
|
|
|
2015-12-29 21:18:24 -08:00
|
|
|
impl<T:Even> MyTrait for T {
|
2015-01-08 22:02:42 +11:00
|
|
|
fn get(&self) -> usize { 0 }
|
2014-10-17 09:13:22 -04:00
|
|
|
}
|
|
|
|
|
2018-12-29 00:11:13 +01:00
|
|
|
impl<T:Odd> MyTrait for T {
|
2019-10-26 17:28:02 +02:00
|
|
|
//~^ ERROR E0119
|
2018-12-29 00:11:13 +01:00
|
|
|
|
2015-01-08 22:02:42 +11:00
|
|
|
fn get(&self) -> usize { 0 }
|
2014-10-17 09:13:22 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|