-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested ?
matchers can cause the compiler to infinite loop/crash
#57597
Comments
The fix should be very easy, since this was already fixed for rust/src/libsyntax/ext/tt/macro_rules.rs Lines 435 to 440 in 1a3a3df
Looks like |
cc @mark-i-m |
Note that with |
The behaviour in my previous comment is because the check for "repetition matches empty token tree" is done at definition time, but does not catch |
Hmm... I don't really remember how most of this code works... Just grepping, but it looks like there are a couple of other places we might want to look at: rust/src/libsyntax/ext/tt/macro_rules.rs Lines 545 to 554 in 03acbd7
rust/src/libsyntax/ext/tt/macro_rules.rs Lines 594 to 604 in 03acbd7
|
I've opened #57610 |
…enkov Fix nested `?` matchers fix rust-lang#57597 I'm not 100% if this works yet... cc @alercah When this is ready (but perhaps not yet):
…enkov Fix nested `?` matchers fix rust-lang#57597 I'm not 100% if this works yet... cc @alercah When this is ready (but perhaps not yet):
…enkov Fix nested `?` matchers fix rust-lang#57597 I'm not 100% if this works yet... cc @alercah When this is ready (but perhaps not yet):
…enkov Fix nested `?` matchers fix rust-lang#57597 I'm not 100% if this works yet... cc @alercah When this is ready (but perhaps not yet):
…enkov Fix nested `?` matchers fix rust-lang#57597 I'm not 100% if this works yet... cc @alercah When this is ready (but perhaps not yet):
…enkov Fix nested `?` matchers fix rust-lang#57597 I'm not 100% if this works yet... cc @alercah When this is ready (but perhaps not yet):
The following code will cause the compiler to fail:
Playground link: https://play.rust-lang.org/?version=beta&mode=debug&edition=2018&gist=acce7614d74028b67c92a79b50b93522
It should error that the inner matcher can match an empty string and reject it, just as it does if
*
is used in place of?
.The text was updated successfully, but these errors were encountered: