Skip to content
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
16 changes: 16 additions & 0 deletions tests/ui/imports/auxiliary/same-res-ambigious-extern-fail.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ edition:2018
//@ proc-macro: same-res-ambigious-extern-macro.rs

macro_rules! globbing{
() => {
pub use same_res_ambigious_extern_macro::*;
}
}

#[macro_use] // this imports the `RustEmbed` macro with `pub(crate)` visibility
extern crate same_res_ambigious_extern_macro;
globbing! {} // this imports the same `RustEmbed` macro with `pub` visibility

pub trait RustEmbed {}

pub use RustEmbed as Embed;
8 changes: 8 additions & 0 deletions tests/ui/imports/auxiliary/same-res-ambigious-extern-macro.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ edition: 2018
extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro_derive(RustEmbed)]
pub fn rust_embed_derive(_input: TokenStream) -> TokenStream {
TokenStream::new()
}
11 changes: 11 additions & 0 deletions tests/ui/imports/auxiliary/same-res-ambigious-extern.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ edition:2018
//@ proc-macro: same-res-ambigious-extern-macro.rs

#[macro_use] // this imports the `RustEmbed` macro with `pub(crate)` visibility
extern crate same_res_ambigious_extern_macro;
// this imports the same `RustEmbed` macro with `pub` visibility
pub use same_res_ambigious_extern_macro::*;

pub trait RustEmbed {}

pub use RustEmbed as Embed;
20 changes: 20 additions & 0 deletions tests/ui/imports/same-res-ambigious.fail.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error[E0603]: derive macro `Embed` is private
--> $DIR/same-res-ambigious.rs:8:28
|
LL | #[derive(ambigious_extern::Embed)]
| ^^^^^ private derive macro
|
note: the derive macro `Embed` is defined here
--> $DIR/auxiliary/same-res-ambigious-extern-fail.rs:16:9
|
LL | pub use RustEmbed as Embed;
| ^^^^^^^^^
help: import `Embed` directly
|
LL - #[derive(ambigious_extern::Embed)]
LL + #[derive(same_res_ambigious_extern_macro::RustEmbed)]
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0603`.
20 changes: 20 additions & 0 deletions tests/ui/imports/same-res-ambigious.nightly-fail.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error[E0603]: derive macro `Embed` is private
--> $DIR/same-res-ambigious.rs:8:28
|
LL | #[derive(ambigious_extern::Embed)]
| ^^^^^ private derive macro
|
note: the derive macro `Embed` is defined here
--> $DIR/auxiliary/same-res-ambigious-extern-fail.rs:16:9
|
LL | pub use RustEmbed as Embed;
| ^^^^^^^^^
help: import `Embed` directly
|
LL - #[derive(ambigious_extern::Embed)]
LL + #[derive(same_res_ambigious_extern_macro::RustEmbed)]
|

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0603`.
11 changes: 11 additions & 0 deletions tests/ui/imports/same-res-ambigious.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//@ edition: 2018
//@ revisions: fail pass
//@[pass] check-pass
//@[pass] aux-crate: ambigious_extern=same-res-ambigious-extern.rs
//@[fail] aux-crate: ambigious_extern=same-res-ambigious-extern-fail.rs
// see https://github.com/rust-lang/rust/pull/147196

#[derive(ambigious_extern::Embed)] //[fail]~ ERROR: derive macro `Embed` is private
struct Foo{}

fn main(){}
Loading