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

Check valid punctuation character in Punct::new #471

Merged
merged 1 commit into from
Oct 7, 2024
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Oct 7, 2024

Closes #470.

Valid punctuation characters generated by:

use proc_macro::{Punct, Spacing, TokenStream};
use std::panic;

#[proc_macro]
pub fn punct_chars(_input: TokenStream) -> TokenStream {
    for ch in '\0'..=char::MAX {
        if let Ok(_) = panic::catch_unwind(|| {
            let _ = Punct::new(ch, Spacing::Alone);
        }) {
            eprintln!("{:?}", ch);
        }
    }
    TokenStream::new()
}

Valid punctuation characters generated by:

    use proc_macro::{Punct, Spacing, TokenStream};
    use std::panic;

    #[proc_macro]
    pub fn punct_chars(_input: TokenStream) -> TokenStream {
        for ch in '\0'..=char::MAX {
            if let Ok(_) = panic::catch_unwind(|| {
                let _ = Punct::new(ch, Spacing::Alone);
            }) {
                eprintln!("{:?}", ch);
            }
        }
        TokenStream::new()
    }
@dtolnay dtolnay merged commit f0b6802 into master Oct 7, 2024
26 checks passed
@dtolnay dtolnay deleted the punctnew branch October 7, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant