mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-28 03:07:24 +03:00
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:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user