-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8085228
commit 8668c1a
Showing
3 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/test/ui/proc-macro/auxiliary/derive-helper-shadowing.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
use proc_macro::*; | ||
|
||
#[proc_macro_derive(GenHelperUse)] | ||
pub fn derive_a(_: TokenStream) -> TokenStream { | ||
" | ||
#[empty_helper] | ||
struct Uwu; | ||
".parse().unwrap() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,102 @@ | ||
error: cannot use a derive helper attribute through an import | ||
--> $DIR/derive-helper-shadowing.rs:40:15 | ||
| | ||
LL | #[renamed] | ||
| ^^^^^^^ | ||
| | ||
note: the derive helper attribute imported here | ||
--> $DIR/derive-helper-shadowing.rs:39:17 | ||
| | ||
LL | use empty_helper as renamed; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: cannot find attribute `empty_helper` in this scope | ||
--> $DIR/derive-helper-shadowing.rs:36:22 | ||
| | ||
LL | #[derive(GenHelperUse)] | ||
| ^^^^^^^^^^^^ | ||
|
||
error: cannot find attribute `empty_helper` in this scope | ||
--> $DIR/derive-helper-shadowing.rs:14:11 | ||
| | ||
LL | #[empty_helper] | ||
| ^^^^^^^^^^^^ | ||
... | ||
LL | gen_helper_use!(); | ||
| ------------------ in this macro invocation | ||
|
||
error[E0659]: `empty_helper` is ambiguous (name vs any other name during import resolution) | ||
--> $DIR/derive-helper-shadowing.rs:14:13 | ||
--> $DIR/derive-helper-shadowing.rs:24:13 | ||
| | ||
LL | use empty_helper; | ||
| ^^^^^^^^^^^^ ambiguous name | ||
| | ||
note: `empty_helper` could refer to the derive helper attribute defined here | ||
--> $DIR/derive-helper-shadowing.rs:10:10 | ||
--> $DIR/derive-helper-shadowing.rs:20:10 | ||
| | ||
LL | #[derive(Empty)] | ||
| ^^^^^ | ||
note: `empty_helper` could also refer to the attribute macro imported here | ||
--> $DIR/derive-helper-shadowing.rs:7:5 | ||
--> $DIR/derive-helper-shadowing.rs:10:5 | ||
| | ||
LL | use test_macros::empty_attr as empty_helper; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= help: use `crate::empty_helper` to refer to this attribute macro unambiguously | ||
|
||
error[E0659]: `empty_helper` is ambiguous (derive helper attribute vs any other name) | ||
--> $DIR/derive-helper-shadowing.rs:9:3 | ||
--> $DIR/derive-helper-shadowing.rs:19:3 | ||
| | ||
LL | #[empty_helper] | ||
| ^^^^^^^^^^^^ ambiguous name | ||
| | ||
note: `empty_helper` could refer to the derive helper attribute defined here | ||
--> $DIR/derive-helper-shadowing.rs:10:10 | ||
--> $DIR/derive-helper-shadowing.rs:20:10 | ||
| | ||
LL | #[derive(Empty)] | ||
| ^^^^^ | ||
note: `empty_helper` could also refer to the attribute macro imported here | ||
--> $DIR/derive-helper-shadowing.rs:7:5 | ||
--> $DIR/derive-helper-shadowing.rs:10:5 | ||
| | ||
LL | use test_macros::empty_attr as empty_helper; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= help: use `crate::empty_helper` to refer to this attribute macro unambiguously | ||
|
||
error[E0659]: `empty_helper` is ambiguous (derive helper attribute vs any other name) | ||
--> $DIR/derive-helper-shadowing.rs:12:7 | ||
--> $DIR/derive-helper-shadowing.rs:22:7 | ||
| | ||
LL | #[empty_helper] | ||
| ^^^^^^^^^^^^ ambiguous name | ||
| | ||
note: `empty_helper` could refer to the derive helper attribute defined here | ||
--> $DIR/derive-helper-shadowing.rs:10:10 | ||
--> $DIR/derive-helper-shadowing.rs:20:10 | ||
| | ||
LL | #[derive(Empty)] | ||
| ^^^^^ | ||
note: `empty_helper` could also refer to the attribute macro imported here | ||
--> $DIR/derive-helper-shadowing.rs:7:5 | ||
--> $DIR/derive-helper-shadowing.rs:10:5 | ||
| | ||
LL | use test_macros::empty_attr as empty_helper; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= help: use `crate::empty_helper` to refer to this attribute macro unambiguously | ||
|
||
error[E0659]: `empty_helper` is ambiguous (derive helper attribute vs any other name) | ||
--> $DIR/derive-helper-shadowing.rs:16:11 | ||
--> $DIR/derive-helper-shadowing.rs:26:11 | ||
| | ||
LL | #[empty_helper] | ||
| ^^^^^^^^^^^^ ambiguous name | ||
| | ||
note: `empty_helper` could refer to the derive helper attribute defined here | ||
--> $DIR/derive-helper-shadowing.rs:10:10 | ||
--> $DIR/derive-helper-shadowing.rs:20:10 | ||
| | ||
LL | #[derive(Empty)] | ||
| ^^^^^ | ||
note: `empty_helper` could also refer to the attribute macro imported here | ||
--> $DIR/derive-helper-shadowing.rs:7:5 | ||
--> $DIR/derive-helper-shadowing.rs:10:5 | ||
| | ||
LL | use test_macros::empty_attr as empty_helper; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= help: use `crate::empty_helper` to refer to this attribute macro unambiguously | ||
|
||
error: aborting due to 4 previous errors | ||
error: aborting due to 7 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0659`. |