mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
38 lines
571 B
Rust
38 lines
571 B
Rust
//@ check-pass
|
|
|
|
#![feature(decl_macro, associated_type_defaults)]
|
|
|
|
trait Base {
|
|
type AssocTy;
|
|
fn f();
|
|
}
|
|
trait Derived: Base {
|
|
fn g();
|
|
}
|
|
|
|
macro mac() {
|
|
type A = dyn Base<AssocTy = u8>;
|
|
type B = dyn Derived<AssocTy = u8>;
|
|
|
|
impl Base for u8 {
|
|
type AssocTy = u8;
|
|
fn f() {
|
|
let _: Self::AssocTy;
|
|
}
|
|
}
|
|
impl Derived for u8 {
|
|
fn g() {
|
|
let _: Self::AssocTy;
|
|
}
|
|
}
|
|
|
|
fn h<T: Base, U: Derived>() {
|
|
let _: T::AssocTy;
|
|
let _: U::AssocTy;
|
|
}
|
|
}
|
|
|
|
mac!();
|
|
|
|
fn main() {}
|