Skip to content

Commit 8442380

Browse files
Add regression test for #148184
1 parent 3e2c614 commit 8442380

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ force-host
2+
//@ no-prefer-dynamic
3+
//@ compile-flags: --crate-type proc-macro
4+
5+
#![crate_type = "proc-macro"]
6+
#![crate_name = "just_some_proc"]
7+
8+
extern crate proc_macro;
9+
10+
use proc_macro::TokenStream;
11+
12+
#[proc_macro_attribute]
13+
pub fn repro(_args: TokenStream, _input: TokenStream) -> TokenStream {
14+
"struct Repro;".parse().unwrap()
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Regression test for <https://github.com/rust-lang/rust/issues/148184>.
2+
// It ensures that the macro expansion correctly handles its "class stack".
3+
4+
//@ compile-flags: -Zunstable-options --generate-macro-expansion
5+
//@ aux-build:one-line-expand.rs
6+
7+
#![crate_name = "foo"]
8+
9+
extern crate just_some_proc;
10+
11+
//@ has 'src/foo/one-line-expand.rs.html'
12+
//@ has - '//*[@class="comment"]' '//'
13+
//@ has - '//*[@class="original"]' '#[just_some_proc::repro]'
14+
//@ has - '//*[@class="original"]/*[@class="attr"]' '#[just_some_proc::repro]'
15+
//@ has - '//code/*[@class="kw"]' 'struct '
16+
17+
//
18+
#[just_some_proc::repro]
19+
struct Repro;

0 commit comments

Comments
 (0)