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

Impl Parse for PatType #1573

Merged
merged 1 commit into from
Jan 1, 2024
Merged

Impl Parse for PatType #1573

merged 1 commit into from
Jan 1, 2024

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Jan 1, 2024

This makes PatType work with parse_quote!. Useful for initializing the left-hand side of a Local, or a FnArg::Typed.

Closes #1554.

// [dependencies]
// syn = { version = "2", features = ["full", "extra-traits"] }

use syn::{parse_quote, PatType};

fn main() {
    let pat: PatType = parse_quote! { ptr: usize };
    println!("{:#?}", pat);
}

@dtolnay dtolnay force-pushed the pattype branch 2 times, most recently from 92950b5 to 969b207 Compare January 1, 2024 19:22
@dtolnay dtolnay merged commit 3ba270b into master Jan 1, 2024
28 checks passed
@dtolnay dtolnay deleted the pattype branch January 1, 2024 19:25
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.

Constructing PatType
1 participant