Skip to content

Commit

Permalink
Bug 1773399 - Update syn to 1.0.96. r=emilio
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Jun 9, 2022
1 parent 9b5cc41 commit 28b4e8e
Show file tree
Hide file tree
Showing 13 changed files with 205 additions and 77 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ version = "0.4.1"
criteria = "safe-to-deploy"

[[unaudited.syn]]
version = "1.0.94"
version = "1.0.96"
criteria = "safe-to-deploy"

[[unaudited.synstructure]]
Expand Down
2 changes: 1 addition & 1 deletion third_party/rust/syn/.cargo-checksum.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions third_party/rust/syn/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
edition = "2018"
rust-version = "1.31"
name = "syn"
version = "1.0.94"
version = "1.0.96"
authors = ["David Tolnay <[email protected]>"]
include = [
"/benches/**",
Expand Down Expand Up @@ -65,16 +65,16 @@ required-features = [
]

[dependencies.proc-macro2]
version = "1.0.32"
version = "1.0.39"
default-features = false

[dependencies.quote]
version = "1.0"
optional = true
default-features = false

[dependencies.unicode-xid]
version = "0.2"
[dependencies.unicode-ident]
version = "1.0"

[dev-dependencies.anyhow]
version = "1.0"
Expand Down
3 changes: 3 additions & 0 deletions third_party/rust/syn/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub type Result<T> = std::result::Result<T, Error>;
/// When parsing macro input, the [`parse_macro_input!`] macro handles the
/// conversion to `compile_error!` automatically.
///
/// [`parse_macro_input!`]: crate::parse_macro_input!
///
/// ```
/// # extern crate proc_macro;
/// #
Expand Down Expand Up @@ -191,6 +193,7 @@ impl Error {
/// this method correctly in a procedural macro.
///
/// [`compile_error!`]: std::compile_error!
/// [`parse_macro_input!`]: crate::parse_macro_input!
pub fn to_compile_error(&self) -> TokenStream {
self.messages
.iter()
Expand Down
16 changes: 12 additions & 4 deletions third_party/rust/syn/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,8 @@ pub(crate) fn requires_terminator(expr: &Expr) -> bool {
#[cfg(feature = "parsing")]
pub(crate) mod parsing {
use super::*;
#[cfg(feature = "full")]
use crate::parse::ParseBuffer;
use crate::parse::{Parse, ParseStream, Result};
use crate::path;
#[cfg(feature = "full")]
Expand Down Expand Up @@ -1525,7 +1527,7 @@ pub(crate) mod parsing {
} else if input.peek(Token![*]) || input.peek(Token![!]) || input.peek(Token![-]) {
expr_unary(input, attrs, allow_struct).map(Expr::Unary)
} else {
trailer_expr(attrs, input, allow_struct)
trailer_expr(begin, attrs, input, allow_struct)
}
}

Expand All @@ -1550,16 +1552,22 @@ pub(crate) mod parsing {
// <atom> ? ...
#[cfg(feature = "full")]
fn trailer_expr(
begin: ParseBuffer,
mut attrs: Vec<Attribute>,
input: ParseStream,
allow_struct: AllowStruct,
) -> Result<Expr> {
let atom = atom_expr(input, allow_struct)?;
let mut e = trailer_helper(input, atom)?;

let inner_attrs = e.replace_attrs(Vec::new());
attrs.extend(inner_attrs);
e.replace_attrs(attrs);
if let Expr::Verbatim(tokens) = &mut e {
*tokens = verbatim::between(begin, input);
} else {
let inner_attrs = e.replace_attrs(Vec::new());
attrs.extend(inner_attrs);
e.replace_attrs(attrs);
}

Ok(e)
}

Expand Down
5 changes: 2 additions & 3 deletions third_party/rust/syn/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::lookahead;
use crate::parse::{Parse, ParseStream, Result};
#[cfg(feature = "parsing")]
use crate::token::Token;
use unicode_xid::UnicodeXID;

pub use proc_macro2::Ident;

Expand Down Expand Up @@ -90,11 +89,11 @@ impl From<Token![_]> for Ident {
pub fn xid_ok(symbol: &str) -> bool {
let mut chars = symbol.chars();
let first = chars.next().unwrap();
if !(first == '_' || UnicodeXID::is_xid_start(first)) {
if !(first == '_' || unicode_ident::is_xid_start(first)) {
return false;
}
for ch in chars {
if !UnicodeXID::is_xid_continue(ch) {
if !unicode_ident::is_xid_continue(ch) {
return false;
}
}
Expand Down
47 changes: 14 additions & 33 deletions third_party/rust/syn/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,56 +250,38 @@
//! 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/1.0.94")]
#![doc(html_root_url = "https://docs.rs/syn/1.0.96")]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![allow(non_camel_case_types)]
// Ignored clippy lints.
#![allow(
clippy::cast_lossless,
clippy::collapsible_match, // https://github.com/rust-lang/rust-clippy/issues/7575
clippy::cast_possible_truncation,
clippy::default_trait_access,
clippy::doc_markdown,
clippy::eval_order_dependence,
clippy::expl_impl_clone_on_copy,
clippy::if_not_else,
clippy::inherent_to_string,
clippy::large_enum_variant,
clippy::let_underscore_drop,
clippy::manual_assert,
clippy::manual_map, // https://github.com/rust-lang/rust-clippy/issues/6795
clippy::match_on_vec_items,
clippy::missing_panics_doc,
clippy::needless_doctest_main,
clippy::needless_pass_by_value,
clippy::never_loop,
clippy::return_self_not_must_use,
clippy::too_many_arguments,
clippy::trivially_copy_pass_by_ref,
clippy::unnecessary_unwrap,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/6983
clippy::wrong_self_convention
)]
// Ignored clippy_pedantic lints.
#![allow(
clippy::cast_possible_truncation,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/7127
clippy::cloned_instead_of_copied,
clippy::default_trait_access,
clippy::empty_enum,
clippy::expl_impl_clone_on_copy,
clippy::if_not_else,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/8285
clippy::iter_not_returning_iterator,
clippy::match_same_arms,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/6984
clippy::match_wildcard_for_single_variants,
clippy::match_wildcard_for_single_variants, // clippy bug: https://github.com/rust-lang/rust-clippy/issues/6984
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::module_name_repetitions,
clippy::must_use_candidate,
clippy::option_if_let_else,
clippy::needless_doctest_main,
clippy::needless_pass_by_value,
clippy::never_loop,
clippy::redundant_else,
clippy::shadow_unrelated,
clippy::return_self_not_must_use,
clippy::similar_names,
clippy::single_match_else,
clippy::too_many_arguments,
clippy::too_many_lines,
clippy::unseparated_literal_suffix,
clippy::trivially_copy_pass_by_ref,
clippy::unnecessary_unwrap,
clippy::used_underscore_binding,
clippy::wildcard_imports
)]
Expand All @@ -310,7 +292,6 @@
))]
extern crate proc_macro;
extern crate proc_macro2;
extern crate unicode_xid;

#[cfg(feature = "printing")]
extern crate quote;
Expand Down
1 change: 1 addition & 0 deletions third_party/rust/syn/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ pub type ParseStream<'a> = &'a ParseBuffer<'a>;
/// - One of [the `syn::parse*` functions][syn-parse]; or
/// - A method of the [`Parser`] trait.
///
/// [`parse_macro_input!`]: crate::parse_macro_input!
/// [syn-parse]: self#the-synparse-functions
pub struct ParseBuffer<'a> {
scope: Span,
Expand Down
25 changes: 25 additions & 0 deletions third_party/rust/syn/src/punctuated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,31 @@ impl<T, P> Pair<T, P> {
}
}

/// Mutably borrows the punctuation from this punctuated pair, unless the
/// pair is the final one and there is no trailing punctuation.
///
/// # Example
///
/// ```
/// # use proc_macro2::Span;
/// # use syn::punctuated::Punctuated;
/// # use syn::{parse_quote, Token, TypeParamBound};
/// #
/// # let mut punctuated = Punctuated::<TypeParamBound, Token![+]>::new();
/// # let span = Span::call_site();
/// #
/// punctuated.insert(0, parse_quote!('lifetime));
/// if let Some(punct) = punctuated.pairs_mut().next().unwrap().punct_mut() {
/// punct.span = span;
/// }
/// ```
pub fn punct_mut(&mut self) -> Option<&mut P> {
match self {
Pair::Punctuated(_, p) => Some(p),
Pair::End(_) => None,
}
}

/// Creates a punctuated pair out of a syntax tree node and an optional
/// following punctuation.
pub fn new(t: T, p: Option<P>) -> Self {
Expand Down
Loading

0 comments on commit 28b4e8e

Please sign in to comment.