From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/hygiene/assoc_ty_bindings.rs | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/ui/hygiene/assoc_ty_bindings.rs (limited to 'tests/ui/hygiene/assoc_ty_bindings.rs') diff --git a/tests/ui/hygiene/assoc_ty_bindings.rs b/tests/ui/hygiene/assoc_ty_bindings.rs new file mode 100644 index 000000000..0567beab9 --- /dev/null +++ b/tests/ui/hygiene/assoc_ty_bindings.rs @@ -0,0 +1,38 @@ +// check-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro, associated_type_defaults)] + +trait Base { + type AssocTy; + fn f(); +} +trait Derived: Base { + fn g(); +} + +macro mac() { + type A = dyn Base; + type B = dyn Derived; + + impl Base for u8 { + type AssocTy = u8; + fn f() { + let _: Self::AssocTy; + } + } + impl Derived for u8 { + fn g() { + let _: Self::AssocTy; + } + } + + fn h() { + let _: T::AssocTy; + let _: U::AssocTy; + } +} + +mac!(); + +fn main() {} -- cgit v1.2.3