rust/src/test/ui/hygiene/assoc_ty_bindings.rs
2018-12-25 21:08:33 -07:00

39 lines
627 B
Rust

// ignore-pretty pretty-printing is unhygienic
#![feature(decl_macro, associated_type_defaults)]
// compile-pass
// skip-codegen
trait Base {
type AssocTy;
fn f();
}
trait Derived: Base {
fn g();
}
macro mac() {
type A = Base<AssocTy = u8>;
type B = 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() {}