From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/hygiene/impl_items.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/ui/hygiene/impl_items.rs (limited to 'tests/ui/hygiene/impl_items.rs') diff --git a/tests/ui/hygiene/impl_items.rs b/tests/ui/hygiene/impl_items.rs new file mode 100644 index 000000000..ddb25c06b --- /dev/null +++ b/tests/ui/hygiene/impl_items.rs @@ -0,0 +1,34 @@ +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] + +mod foo { + struct S; + impl S { + fn f(&self) {} + } + + pub macro m() { + let _: () = S.f(); //~ ERROR type `for<'a> fn(&'a foo::S) {foo::S::f}` is private + } +} + +struct S; + +macro m($f:ident) { + impl S { + fn f(&self) -> u32 { 0 } + fn $f(&self) -> i32 { 0 } + } + fn f() { + let _: u32 = S.f(); + let _: i32 = S.$f(); + } +} + +m!(f); + +fn main() { + let _: i32 = S.f(); + foo::m!(); +} -- cgit v1.2.3