Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression test for #79148 #100268

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/test/ui/proc-macro/auxiliary/re-export.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro]
pub fn cause_ice(_: TokenStream) -> TokenStream {
"
enum IceCause {
Variant,
}

pub use IceCause::Variant;
".parse().unwrap()
}
10 changes: 10 additions & 0 deletions src/test/ui/proc-macro/issue-79148.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// aux-build:re-export.rs
// edition:2018

extern crate re_export;

use re_export::cause_ice;

cause_ice!(); //~ ERROR `Variant` is only public within the crate, and cannot be re-exported outside

fn main() {}
16 changes: 16 additions & 0 deletions src/test/ui/proc-macro/issue-79148.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
error[E0364]: `Variant` is only public within the crate, and cannot be re-exported outside
--> $DIR/issue-79148.rs:8:1
|
LL | cause_ice!();
| ^^^^^^^^^^^^
|
note: consider marking `Variant` as `pub` in the imported module
--> $DIR/issue-79148.rs:8:1
|
LL | cause_ice!();
| ^^^^^^^^^^^^
= note: this error originates in the macro `cause_ice` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0364`.