2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
|
|
|
|
2019-03-13 16:24:42 -05:00
|
|
|
#![feature(trait_alias)]
|
|
|
|
|
|
|
|
mod inner {
|
|
|
|
pub trait Foo {
|
|
|
|
fn foo(&self);
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Qux;
|
|
|
|
|
|
|
|
impl Foo for Qux {
|
|
|
|
fn foo(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Bar = Foo;
|
|
|
|
}
|
|
|
|
|
2019-03-15 16:55:04 -05:00
|
|
|
mod two {
|
|
|
|
pub trait A {
|
|
|
|
fn foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
impl A for u8 {
|
|
|
|
fn foo() {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-13 16:24:42 -05:00
|
|
|
// Import only the alias, not the `Foo` trait.
|
|
|
|
use inner::{Bar, Qux};
|
|
|
|
|
2019-03-15 16:55:04 -05:00
|
|
|
// Declaring an alias also brings in aliased methods.
|
|
|
|
trait Two = two::A;
|
|
|
|
|
2019-03-13 16:24:42 -05:00
|
|
|
fn main() {
|
|
|
|
let q = Qux;
|
2019-03-15 16:55:04 -05:00
|
|
|
q.foo(); // From Bar.
|
|
|
|
|
|
|
|
u8::foo(); // From A.
|
2019-03-13 16:24:42 -05:00
|
|
|
}
|