X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftest%2Fui%2Fproc-macro%2Fderive-helper-shadowing.rs;h=f0ca34db414d441b539f851363813f9f4ff1b83c;hb=8668c1a19015148821c37255922f9a9b603dd148;hp=fe324ae63cd33b6e1092a2f66bf83398e52653b3;hpb=808522894b612bca8273f20ba4cfa328622c5a97;p=rust.git diff --git a/src/test/ui/proc-macro/derive-helper-shadowing.rs b/src/test/ui/proc-macro/derive-helper-shadowing.rs index fe324ae63cd..f0ca34db414 100644 --- a/src/test/ui/proc-macro/derive-helper-shadowing.rs +++ b/src/test/ui/proc-macro/derive-helper-shadowing.rs @@ -1,11 +1,21 @@ // edition:2018 // aux-build:test-macros.rs +// aux-build:derive-helper-shadowing.rs #[macro_use] extern crate test_macros; +#[macro_use] +extern crate derive_helper_shadowing; use test_macros::empty_attr as empty_helper; +macro_rules! gen_helper_use { + () => { + #[empty_helper] //~ ERROR cannot find attribute `empty_helper` in this scope + struct W; + } +} + #[empty_helper] //~ ERROR `empty_helper` is ambiguous #[derive(Empty)] struct S { @@ -20,12 +30,25 @@ mod inner { // OK, no ambiguity, the non-helper attribute is not in scope here, only the helper. #[empty_helper] struct V; + + gen_helper_use!(); + + #[derive(GenHelperUse)] //~ ERROR cannot find attribute `empty_helper` in this scope + struct Owo; + + use empty_helper as renamed; + #[renamed] //~ ERROR cannot use a derive helper attribute through an import + struct Wow; } 0 }] } +// OK, no ambiguity, only the non-helper attribute is in scope. +#[empty_helper] +struct Z; + fn main() { let s = S { field: [] }; }