2014-10-17 08:13:22 -05:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2015-02-21 05:28:28 -06:00
|
|
|
use std::fmt::Debug;
|
2014-10-17 08:13:22 -05:00
|
|
|
use std::default::Default;
|
2015-02-12 09:29:52 -06:00
|
|
|
use std::marker::MarkerTrait;
|
2014-10-17 08:13:22 -05:00
|
|
|
|
|
|
|
// 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-02-12 09:29:52 -06:00
|
|
|
trait Even : MarkerTrait { }
|
2014-10-17 08:13:22 -05:00
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
trait Odd : MarkerTrait { }
|
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
|
|
|
|
|
|
|
impl<T:Even> 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
|
|
|
}
|
|
|
|
|
|
|
|
impl<T:Odd> MyTrait for T {
|
2015-01-08 05:02:42 -06:00
|
|
|
fn get(&self) -> usize { 0 }
|
2014-10-17 08:13:22 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|