-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve: Do not resolve visibilities on proc macro definitions twice
- Loading branch information
1 parent
37c945d
commit c3c0a09
Showing
3 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Proc macro defined with `pub(path)` doesn't ICEs due to resolving the `path` (issue #68921). | ||
|
||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
use proc_macro::*; | ||
|
||
#[proc_macro] | ||
pub(self) fn outer(input: TokenStream) -> TokenStream { | ||
//~^ ERROR functions tagged with `#[proc_macro]` must be `pub` | ||
input | ||
} | ||
|
||
mod m { | ||
use proc_macro::*; | ||
|
||
#[proc_macro] | ||
pub(super) fn inner(input: TokenStream) -> TokenStream { | ||
//~^ ERROR functions tagged with `#[proc_macro]` must currently reside in the root | ||
input | ||
} | ||
} |
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,14 @@ | ||
error: functions tagged with `#[proc_macro]` must be `pub` | ||
--> $DIR/visibility-path.rs:12:1 | ||
| | ||
LL | pub(self) fn outer(input: TokenStream) -> TokenStream { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: functions tagged with `#[proc_macro]` must currently reside in the root of the crate | ||
--> $DIR/visibility-path.rs:21:5 | ||
| | ||
LL | pub(super) fn inner(input: TokenStream) -> TokenStream { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|