File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Auxiliary proc-macro for issue #99173
2+ // Tests that nested proc-macro calls with empty output don't cause ICE
3+
4+ extern crate proc_macro;
5+
6+ use proc_macro:: TokenStream ;
7+
8+ // This macro returns an empty TokenStream
9+ #[ proc_macro]
10+ pub fn ignore ( _input : TokenStream ) -> TokenStream {
11+ TokenStream :: new ( )
12+ }
13+
14+ // This macro generates code that calls the `ignore` macro
15+ #[ proc_macro]
16+ pub fn outer_macro ( _input : TokenStream ) -> TokenStream {
17+ "nested_empty_proc_macro::ignore!(42)" . parse ( ) . unwrap ( )
18+ }
Original file line number Diff line number Diff line change 1+ //@ check-pass
2+ //@ proc-macro: nested-empty-proc-macro.rs
3+
4+ // Regression test for issue #99173
5+ // Tests that nested proc-macro calls where the inner macro returns
6+ // an empty TokenStream don't cause an ICE.
7+
8+ extern crate nested_empty_proc_macro;
9+
10+ fn main ( ) {
11+ nested_empty_proc_macro:: outer_macro!( 1 * 2 * 3 * 7 ) ;
12+ }
You can’t perform that action at this time.
0 commit comments