Skip to content

Impl Parse for PatType#1573

Merged
dtolnay merged 1 commit intomasterfrom
pattype
Jan 1, 2024
Merged

Impl Parse for PatType#1573
dtolnay merged 1 commit intomasterfrom
pattype

Conversation

@dtolnay
Copy link
Copy Markdown
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
@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