Skip to content

Commit

Permalink
Merge pull request #1573 from dtolnay/pattype
Browse files Browse the repository at this point in the history
Impl Parse for PatType
  • Loading branch information
dtolnay authored Jan 1, 2024
2 parents a0fcd83 + 969b207 commit 3ba270b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ ast_struct! {
pub(crate) mod parsing {
use super::*;
use crate::ext::IdentExt as _;
use crate::parse::{ParseBuffer, ParseStream, Result};
use crate::parse::{Parse, ParseBuffer, ParseStream, Result};
use crate::path;

#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
Expand Down Expand Up @@ -355,6 +355,18 @@ pub(crate) mod parsing {
}
}

#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
impl Parse for PatType {
fn parse(input: ParseStream) -> Result<Self> {
Ok(PatType {
attrs: Vec::new(),
pat: Box::new(Pat::parse_single(input)?),
colon_token: input.parse()?,
ty: input.parse()?,
})
}
}

fn multi_pat_impl(input: ParseStream, leading_vert: Option<Token![|]>) -> Result<Pat> {
let mut pat = Pat::parse_single(input)?;
if leading_vert.is_some()
Expand Down

0 comments on commit 3ba270b

Please sign in to comment.