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