Add test for use of $crate in nested foreign macro_rules!
This commit is contained in:
parent
0caebfabe6
commit
5cd1b5dd79
2 changed files with 23 additions and 0 deletions
14
src/test/ui/hygiene/auxiliary/nested-dollar-crate.rs
Normal file
14
src/test/ui/hygiene/auxiliary/nested-dollar-crate.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
pub const IN_DEF_CRATE: &str = "In def crate!";
|
||||
|
||||
macro_rules! make_it {
|
||||
() => {
|
||||
#[macro_export]
|
||||
macro_rules! inner {
|
||||
() => {
|
||||
$crate::IN_DEF_CRATE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
make_it!();
|
9
src/test/ui/hygiene/nested-dollar-crate.rs
Normal file
9
src/test/ui/hygiene/nested-dollar-crate.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// aux-build:nested-dollar-crate.rs
|
||||
// edition:2018
|
||||
// run-pass
|
||||
|
||||
extern crate nested_dollar_crate;
|
||||
|
||||
fn main() {
|
||||
assert_eq!(nested_dollar_crate::inner!(), "In def crate!");
|
||||
}
|
Loading…
Add table
Reference in a new issue