Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "consumer"
version = "0.1.0"

[dependencies]
mylib_v1 = { path = "../mylib_v1", package = "mylib" }
mylib_v2 = { path = "../mylib_v2", package = "mylib" }

# Avoid interference with root workspace when casually testing
[workspace]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
let v1 = mylib_v1::my_macro!();
assert_eq!(v1, "version 1");

let v2 = mylib_v2::my_macro!();
assert_eq!(v2, "version 2");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "mylib"
version = "1.0.0"

# Avoid interference with root workspace when casually testing
[workspace]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#[macro_export]
macro_rules! my_macro {
() => {
"version 1"
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "mylib"
version = "2.0.0"

# Avoid interference with root workspace when casually testing
[workspace]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#[macro_export]
macro_rules! my_macro {
() => {
"version 2"
};
}
13 changes: 13 additions & 0 deletions tests/run-make-cargo/same-crate-name-and-macro-name/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//! Regression test for
//! <https://github.com/rust-lang/rust/issues/71259#issuecomment-615879925>
//! (that particular comment describes the issue well).
//!
//! We test that two library crates with the same name can export macros with
//! the same name without causing interference when both are used in another
//! crate.
use run_make_support::cargo;

fn main() {
cargo().current_dir("consumer").arg("run").run();
}
Loading