diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-03-23 10:29:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-23 10:29:16 +0100 |
| commit | bb85308ce73a730a5f0f7014490cb9335f5096d2 (patch) | |
| tree | f7e7a6e83b75e4ba6fe930ebd9d76170046ed620 /src/test | |
| parent | edbbb4908c818115bfea05e2fb05bc473de7d8c0 (diff) | |
| parent | c3c0a097a7c6a68c0fcaee3cc3b8fda119f3c5a4 (diff) | |
| download | rust-bb85308ce73a730a5f0f7014490cb9335f5096d2.tar.gz rust-bb85308ce73a730a5f0f7014490cb9335f5096d2.zip | |
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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/proc-macro/visibility-path.rs | 25 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/visibility-path.stderr | 14 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/test/ui/proc-macro/visibility-path.rs b/src/test/ui/proc-macro/visibility-path.rs new file mode 100644 index 00000000000..a73430db2c1 --- /dev/null +++ b/src/test/ui/proc-macro/visibility-path.rs @@ -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 + } +} diff --git a/src/test/ui/proc-macro/visibility-path.stderr b/src/test/ui/proc-macro/visibility-path.stderr new file mode 100644 index 00000000000..1a73cc1963f --- /dev/null +++ b/src/test/ui/proc-macro/visibility-path.stderr @@ -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 + |
