Add regression test for issue 99173

Adds a test for nested proc-macro calls where the inner macro returns an
empty TokenStream.
This previously caused an ICE in rustc_resolve.
This commit is contained in:
AprilNEA
2025-12-30 17:51:49 +08:00
parent 0850949213
commit b3c3604f62
2 changed files with 30 additions and 0 deletions
@@ -0,0 +1,18 @@
// Auxiliary proc-macro for issue #99173
// Tests that nested proc-macro calls with empty output don't cause ICE
extern crate proc_macro;
use proc_macro::TokenStream;
// This macro returns an empty TokenStream
#[proc_macro]
pub fn ignore(_input: TokenStream) -> TokenStream {
TokenStream::new()
}
// This macro generates code that calls the `ignore` macro
#[proc_macro]
pub fn outer_macro(_input: TokenStream) -> TokenStream {
"nested_empty_proc_macro::ignore!(42)".parse().unwrap()
}
@@ -0,0 +1,12 @@
//@ check-pass
//@ proc-macro: nested-empty-proc-macro.rs
// Regression test for issue #99173
// Tests that nested proc-macro calls where the inner macro returns
// an empty TokenStream don't cause an ICE.
extern crate nested_empty_proc_macro;
fn main() {
nested_empty_proc_macro::outer_macro!(1 * 2 * 3 * 7);
}