Skip to content
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

Fix infinite loop on attr surrounded by None-delimited group #1541

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Dec 11, 2023

The infinite loop can be reproduced like this:

use proc_macro2::{Delimiter, Group};
use quote::quote;

fn main() {
    let attr = Group::new(Delimiter::None, quote!(#[attr]));
    let tokens = quote!(#attr 0);
    syn::parse2::<syn::Expr>(tokens).unwrap();
}

The bug is from #853. Given nothing has hit this in 3.5 years, probably a group in that position does not need to be supported. But it should return an error instead of looping.

@dtolnay dtolnay merged commit 9f29f05 into master Dec 11, 2023
28 checks passed
@dtolnay dtolnay deleted the groupedattr branch December 11, 2023 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant