From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/syn/src/parse_macro_input.rs | 57 ++----------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) (limited to 'vendor/syn/src/parse_macro_input.rs') diff --git a/vendor/syn/src/parse_macro_input.rs b/vendor/syn/src/parse_macro_input.rs index 6163cd70a..6f1562f4b 100644 --- a/vendor/syn/src/parse_macro_input.rs +++ b/vendor/syn/src/parse_macro_input.rs @@ -40,7 +40,7 @@ /// let input = parse_macro_input!(tokens as MyMacroInput); /// /// /* ... */ -/// # "".parse().unwrap() +/// # TokenStream::new() /// } /// ``` /// @@ -76,7 +76,7 @@ /// let input = parse_macro_input!(tokens with MyMacroInput::parse_alternate); /// /// /* ... */ -/// # "".parse().unwrap() +/// # TokenStream::new() /// } /// ``` /// @@ -107,7 +107,7 @@ #[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "proc-macro"))))] macro_rules! parse_macro_input { ($tokenstream:ident as $ty:ty) => { - match $crate::parse_macro_input::parse::<$ty>($tokenstream) { + match $crate::parse::<$ty>($tokenstream) { $crate::__private::Ok(data) => data, $crate::__private::Err(err) => { return $crate::__private::TokenStream::from(err.to_compile_error()); @@ -126,54 +126,3 @@ macro_rules! parse_macro_input { $crate::parse_macro_input!($tokenstream as _) }; } - -//////////////////////////////////////////////////////////////////////////////// -// Can parse any type that implements Parse. - -use crate::parse::{Parse, ParseStream, Parser, Result}; -use proc_macro::TokenStream; - -// Not public API. -#[doc(hidden)] -pub fn parse(token_stream: TokenStream) -> Result { - T::parse.parse(token_stream) -} - -// Not public API. -#[doc(hidden)] -pub trait ParseMacroInput: Sized { - fn parse(input: ParseStream) -> Result; -} - -impl ParseMacroInput for T { - fn parse(input: ParseStream) -> Result { - ::parse(input) - } -} - -//////////////////////////////////////////////////////////////////////////////// -// Any other types that we want `parse_macro_input!` to be able to parse. - -#[cfg(any(feature = "full", feature = "derive"))] -use crate::AttributeArgs; - -#[cfg(any(feature = "full", feature = "derive"))] -impl ParseMacroInput for AttributeArgs { - fn parse(input: ParseStream) -> Result { - let mut metas = Vec::new(); - - loop { - if input.is_empty() { - break; - } - let value = input.parse()?; - metas.push(value); - if input.is_empty() { - break; - } - input.parse::()?; - } - - Ok(metas) - } -} -- cgit v1.2.3