-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Re-add macro nr2.0 test cases
- Loading branch information
1 parent
a79665e
commit bf97c5e
Showing
3 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// { dg-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } | ||
|
||
#![feature(decl_macro)] | ||
|
||
pub mod foo { | ||
pub mod bar { | ||
pub mod baz { | ||
// macros 2.0 get inserted in Ribs like items | ||
pub macro boof() {} | ||
} | ||
} | ||
} | ||
|
||
#[macro_export] | ||
fn main() { | ||
foo::bar::baz::boof!(); | ||
crate::foo::bar::baz::boof!(); | ||
self::foo::bar::baz::boof!(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// { dg-options "-frust-name-resolution-2.0 -frust-compile-until=lowering" } | ||
|
||
pub mod foo { | ||
pub mod bar { | ||
pub mod baz { | ||
pub mod qux { | ||
#[macro_export] | ||
macro_rules! foo { | ||
(one) => {}; | ||
} | ||
|
||
pub fn foo() {} | ||
} | ||
} | ||
|
||
fn f() { | ||
fn inner() { | ||
macro_rules! foo { | ||
(two) => {}; | ||
} | ||
|
||
foo!(two); // ok, textual scope | ||
crate::foo!(one); // ok, path res | ||
super::super::foo!(one); // ok, path res | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// { dg-options "-frust-name-resolution-2.0" } | ||
|
||
// check that macros by example get exported to the crate's root with #[macro_export] | ||
pub mod foo { | ||
pub mod bar { | ||
pub mod baz { | ||
pub mod qux { | ||
#[macro_export] | ||
macro_rules! foo { | ||
(one) => {}; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
crate::foo!(one); // ok | ||
foo!(one); // ok | ||
|
||
mod a { | ||
mod b { | ||
mod c { | ||
super::super::super::foo!(one); // ok | ||
} | ||
} | ||
} |