2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-03-26 14:06:26 -05:00
|
|
|
|
2015-03-22 05:38:42 -05:00
|
|
|
struct MyType;
|
|
|
|
|
|
|
|
impl MyType {
|
|
|
|
const IMPL_IS_INHERENT: bool = true;
|
|
|
|
}
|
|
|
|
|
2015-04-24 23:58:40 -05:00
|
|
|
trait MyTrait {
|
2015-03-22 05:38:42 -05: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);
|
|
|
|
}
|