summaryrefslogtreecommitdiffstats
path: root/vendor/syn/src
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/syn/src')
-rw-r--r--vendor/syn/src/buffer.rs12
-rw-r--r--vendor/syn/src/export.rs5
-rw-r--r--vendor/syn/src/expr.rs35
-rw-r--r--vendor/syn/src/lib.rs20
-rw-r--r--vendor/syn/src/meta.rs8
-rw-r--r--vendor/syn/src/parse.rs10
-rw-r--r--vendor/syn/src/ty.rs5
7 files changed, 50 insertions, 45 deletions
diff --git a/vendor/syn/src/buffer.rs b/vendor/syn/src/buffer.rs
index e16f2adea..564ccc757 100644
--- a/vendor/syn/src/buffer.rs
+++ b/vendor/syn/src/buffer.rs
@@ -5,11 +5,6 @@
// Syn, and caution should be used when editing it. The public-facing interface
// is 100% safe but the implementation is fragile internally.
-#[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "proc-macro"
-))]
-use crate::proc_macro as pm;
use crate::Lifetime;
use proc_macro2::extra::DelimSpan;
use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree};
@@ -60,12 +55,9 @@ impl TokenBuffer {
/// Creates a `TokenBuffer` containing all the tokens from the input
/// `proc_macro::TokenStream`.
- #[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "proc-macro"
- ))]
+ #[cfg(feature = "proc-macro")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "proc-macro")))]
- pub fn new(stream: pm::TokenStream) -> Self {
+ pub fn new(stream: proc_macro::TokenStream) -> Self {
Self::new2(stream.into())
}
diff --git a/vendor/syn/src/export.rs b/vendor/syn/src/export.rs
index c1c16f9ed..5c06ebdd2 100644
--- a/vendor/syn/src/export.rs
+++ b/vendor/syn/src/export.rs
@@ -28,10 +28,7 @@ pub use crate::token::parsing::{peek_punct, punct as parse_punct};
#[cfg(feature = "printing")]
pub use crate::token::printing::punct as print_punct;
-#[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "proc-macro"
-))]
+#[cfg(feature = "proc-macro")]
pub use proc_macro::TokenStream;
#[cfg(feature = "printing")]
diff --git a/vendor/syn/src/expr.rs b/vendor/syn/src/expr.rs
index 8a982021f..0f1a6953e 100644
--- a/vendor/syn/src/expr.rs
+++ b/vendor/syn/src/expr.rs
@@ -964,7 +964,10 @@ pub(crate) mod parsing {
use crate::path;
use std::cmp::Ordering;
- crate::custom_keyword!(raw);
+ mod kw {
+ crate::custom_keyword!(builtin);
+ crate::custom_keyword!(raw);
+ }
// When we're parsing expressions which occur before blocks, like in an if
// statement's condition, we cannot parse a struct literal.
@@ -1361,12 +1364,13 @@ pub(crate) mod parsing {
let attrs = input.call(expr_attrs)?;
if input.peek(Token![&]) {
let and_token: Token![&] = input.parse()?;
- let raw: Option<raw> =
- if input.peek(raw) && (input.peek2(Token![mut]) || input.peek2(Token![const])) {
- Some(input.parse()?)
- } else {
- None
- };
+ let raw: Option<kw::raw> = if input.peek(kw::raw)
+ && (input.peek2(Token![mut]) || input.peek2(Token![const]))
+ {
+ Some(input.parse()?)
+ } else {
+ None
+ };
let mutability: Option<Token![mut]> = input.parse()?;
if raw.is_some() && mutability.is_none() {
input.parse::<Token![const]>()?;
@@ -1591,6 +1595,8 @@ pub(crate) mod parsing {
|| input.peek(Token![async]) && (input.peek2(Token![|]) || input.peek2(Token![move]))
{
expr_closure(input, allow_struct).map(Expr::Closure)
+ } else if input.peek(kw::builtin) && input.peek2(Token![#]) {
+ expr_builtin(input)
} else if input.peek(Ident)
|| input.peek(Token![::])
|| input.peek(Token![<])
@@ -1689,6 +1695,21 @@ pub(crate) mod parsing {
}
}
+ #[cfg(feature = "full")]
+ fn expr_builtin(input: ParseStream) -> Result<Expr> {
+ let begin = input.fork();
+
+ input.parse::<kw::builtin>()?;
+ input.parse::<Token![#]>()?;
+ input.parse::<Ident>()?;
+
+ let args;
+ parenthesized!(args in input);
+ args.parse::<TokenStream>()?;
+
+ Ok(Expr::Verbatim(verbatim::between(begin, input)))
+ }
+
fn path_or_macro_or_struct(
input: ParseStream,
#[cfg(feature = "full")] allow_struct: AllowStruct,
diff --git a/vendor/syn/src/lib.rs b/vendor/syn/src/lib.rs
index 74bd21b41..aeeb37ef9 100644
--- a/vendor/syn/src/lib.rs
+++ b/vendor/syn/src/lib.rs
@@ -249,7 +249,7 @@
//! dynamic library libproc_macro from rustc toolchain.
// Syn types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/syn/2.0.14")]
+#![doc(html_root_url = "https://docs.rs/syn/2.0.18")]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![allow(non_camel_case_types)]
#![allow(
@@ -290,15 +290,13 @@
clippy::too_many_lines,
clippy::trivially_copy_pass_by_ref,
clippy::uninlined_format_args,
+ clippy::unnecessary_box_returns,
clippy::unnecessary_unwrap,
clippy::used_underscore_binding,
clippy::wildcard_imports,
)]
-#[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "proc-macro"
-))]
+#[cfg(feature = "proc-macro")]
extern crate proc_macro;
#[macro_use]
@@ -421,11 +419,7 @@ pub use crate::op::{BinOp, UnOp};
#[cfg_attr(doc_cfg, doc(cfg(feature = "parsing")))]
pub mod parse;
-#[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "parsing",
- feature = "proc-macro"
-))]
+#[cfg(all(feature = "parsing", feature = "proc-macro"))]
mod parse_macro_input;
#[cfg(all(feature = "parsing", feature = "printing"))]
@@ -859,11 +853,7 @@ pub mod __private;
/// expanded.into()
/// }
/// ```
-#[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "parsing",
- feature = "proc-macro"
-))]
+#[cfg(all(feature = "parsing", feature = "proc-macro"))]
#[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "proc-macro"))))]
pub fn parse<T: parse::Parse>(tokens: proc_macro::TokenStream) -> Result<T> {
parse::Parser::parse(T::parse, tokens)
diff --git a/vendor/syn/src/meta.rs b/vendor/syn/src/meta.rs
index b6bcf9830..f17b2802d 100644
--- a/vendor/syn/src/meta.rs
+++ b/vendor/syn/src/meta.rs
@@ -129,7 +129,13 @@ use std::fmt::Display;
/// }
/// ```
pub fn parser(logic: impl FnMut(ParseNestedMeta) -> Result<()>) -> impl Parser<Output = ()> {
- |input: ParseStream| parse_nested_meta(input, logic)
+ |input: ParseStream| {
+ if input.is_empty() {
+ Ok(())
+ } else {
+ parse_nested_meta(input, logic)
+ }
+ }
}
/// Context for parsing a single property in the conventional syntax for
diff --git a/vendor/syn/src/parse.rs b/vendor/syn/src/parse.rs
index 61a10d2bc..5a2aeb628 100644
--- a/vendor/syn/src/parse.rs
+++ b/vendor/syn/src/parse.rs
@@ -185,10 +185,7 @@ pub mod discouraged;
use crate::buffer::{Cursor, TokenBuffer};
use crate::error;
use crate::lookahead;
-#[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "proc-macro"
-))]
+#[cfg(feature = "proc-macro")]
use crate::proc_macro;
use crate::punctuated::Punctuated;
use crate::token::Token;
@@ -1198,10 +1195,7 @@ pub trait Parser: Sized {
///
/// This function will check that the input is fully parsed. If there are
/// any unparsed tokens at the end of the stream, an error is returned.
- #[cfg(all(
- not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))),
- feature = "proc-macro"
- ))]
+ #[cfg(feature = "proc-macro")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "proc-macro")))]
fn parse(self, tokens: proc_macro::TokenStream) -> Result<Self::Output> {
self.parse2(proc_macro2::TokenStream::from(tokens))
diff --git a/vendor/syn/src/ty.rs b/vendor/syn/src/ty.rs
index 9b341dafa..9282ba4e6 100644
--- a/vendor/syn/src/ty.rs
+++ b/vendor/syn/src/ty.rs
@@ -1076,6 +1076,11 @@ mod printing {
fn to_tokens(&self, tokens: &mut TokenStream) {
self.paren_token.surround(tokens, |tokens| {
self.elems.to_tokens(tokens);
+ // If we only have one argument, we need a trailing comma to
+ // distinguish TypeTuple from TypeParen.
+ if self.elems.len() == 1 && !self.elems.trailing_punct() {
+ <Token![,]>::default().to_tokens(tokens);
+ }
});
}
}