2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2015-03-26 19:06:26 +00:00
|
|
|
|
2015-03-22 10:38:42 +00:00
|
|
|
struct MyType;
|
|
|
|
|
|
|
|
impl MyType {
|
|
|
|
const IMPL_IS_INHERENT: bool = true;
|
|
|
|
}
|
|
|
|
|
2015-04-25 04:58:40 +00:00
|
|
|
trait MyTrait {
|
2015-03-22 10:38:42 +00:00
|
|
|
const IMPL_IS_INHERENT: bool;
|
|
|
|
const IMPL_IS_ON_TRAIT: bool;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MyTrait for MyType {
|
|
|
|
const IMPL_IS_INHERENT: bool = false;
|
|
|
|
const IMPL_IS_ON_TRAIT: bool = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Check that the inherent impl is used before the trait, but that the trait
|
|
|
|
// can still be accessed.
|
|
|
|
assert!(<MyType>::IMPL_IS_INHERENT);
|
|
|
|
assert!(!<MyType as MyTrait>::IMPL_IS_INHERENT);
|
|
|
|
assert!(<MyType>::IMPL_IS_ON_TRAIT);
|
|
|
|
}
|