Rollup merge of #70233 - petrochenkov:superproc, r=ecstatic-morse
resolve: Do not resolve visibilities on proc macro definitions twice Fixes https://github.com/rust-lang/rust/issues/68921
This commit is contained in:
commit
bb85308ce7
3 changed files with 47 additions and 1 deletions
25
src/test/ui/proc-macro/visibility-path.rs
Normal file
25
src/test/ui/proc-macro/visibility-path.rs
Normal file
|
|
@ -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
|
||||
}
|
||||
}
|
||||
14
src/test/ui/proc-macro/visibility-path.stderr
Normal file
14
src/test/ui/proc-macro/visibility-path.stderr
Normal file
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue