diff options
| author | Michael Howell <michael@notriddle.com> | 2022-09-20 10:12:56 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-20 10:12:56 -0700 |
| commit | 14b27cfd11be4285d61415015d0d38e42d401ae3 (patch) | |
| tree | 2855557d30c69ddce907dc3e88da132831bdd420 /compiler/rustc_parse | |
| parent | 4136b59b7da8866762761ed29405a5c5f58a5e3d (diff) | |
| parent | cb5ea8d0b67e4a46f9f30aa93107035d9a1dadf0 (diff) | |
| download | rust-14b27cfd11be4285d61415015d0d38e42d401ae3.tar.gz rust-14b27cfd11be4285d61415015d0d38e42d401ae3.zip | |
Rollup merge of #100250 - cjgillot:recover-token-stream, r=Aaron1011
Manually cleanup token stream when macro expansion aborts. In case of syntax error in macro expansion, the expansion code can decide to stop processing anything. In that case, the token stream is malformed. This makes downstream users, like derive macros, ICE. In this case, this PR manually cleans up the token stream by closing all currently open delimiters. Fixes https://github.com/rust-lang/rust/issues/96818. Fixes https://github.com/rust-lang/rust/issues/80447. Fixes https://github.com/rust-lang/rust/issues/81920. Fixes https://github.com/rust-lang/rust/issues/91023.
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr_wrapper.rs | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs index 5fdafd187c6..86c386b94c8 100644 --- a/compiler/rustc_parse/src/parser/attr_wrapper.rs +++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs @@ -459,6 +459,5 @@ fn make_token_stream( panic!("Unexpected last token {:?}", last_token) } } - assert!(stack.is_empty(), "Stack should be empty: final_buf={:?} stack={:?}", final_buf, stack); AttrTokenStream::new(final_buf.inner) } |
