diff options
author | Haibo Huang <hhb@google.com> | 2020-05-12 00:43:28 -0700 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2020-05-12 00:43:28 -0700 |
commit | 71f65d4a36b6a415019b8068d1af02fa9c7418ba (patch) | |
tree | 19f044baff7a9c461651daf4e10832aaf429d998 | |
parent | 2cfca3511b4da5d151e2c0cb3975beabba08dd4c (diff) | |
download | syn-71f65d4a36b6a415019b8068d1af02fa9c7418ba.tar.gz |
Upgrade rust/crates/syn to 1.0.20
Test: None
Change-Id: Iaa0f8b7a33518d375dc43462e38eded50e390b88
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | Cargo.toml.orig | 2 | ||||
-rw-r--r-- | METADATA | 4 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/mac.rs | 19 | ||||
-rw-r--r-- | tests/common/eq.rs | 3 |
7 files changed, 20 insertions, 14 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 7ba3f3c9..1033b816 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "e51bb8b2500aab8d2a62f77c0da7af203a0be6ea" + "sha1": "80c023890747e975a33dcb7af6654170f32cf400" } } @@ -13,7 +13,7 @@ [package] edition = "2018" name = "syn" -version = "1.0.19" +version = "1.0.20" authors = ["David Tolnay <dtolnay@gmail.com>"] include = ["/benches/**", "/build.rs", "/Cargo.toml", "/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"] description = "Parser for Rust source code" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index a1a297aa..8285045d 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "syn" -version = "1.0.19" # don't forget to update html_root_url and syn.json +version = "1.0.20" # don't forget to update html_root_url and syn.json authors = ["David Tolnay <dtolnay@gmail.com>"] license = "MIT OR Apache-2.0" description = "Parser for Rust source code" @@ -9,11 +9,11 @@ third_party { type: GIT value: "https://github.com/dtolnay/syn" } - version: "1.0.19" + version: "1.0.20" license_type: NOTICE last_upgrade_date { year: 2020 month: 5 - day: 6 + day: 12 } } @@ -242,7 +242,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/1.0.19")] +#![doc(html_root_url = "https://docs.rs/syn/1.0.20")] #![deny(clippy::all, clippy::pedantic)] // Ignored clippy lints. #![allow( @@ -2,7 +2,7 @@ use super::*; use crate::token::{Brace, Bracket, Paren}; use proc_macro2::TokenStream; #[cfg(feature = "parsing")] -use proc_macro2::{Delimiter, Span, TokenTree}; +use proc_macro2::{Delimiter, Group, Span, TokenTree}; #[cfg(feature = "parsing")] use crate::parse::{Parse, ParseStream, Parser, Result}; @@ -63,12 +63,19 @@ impl Hash for Macro { } #[cfg(feature = "parsing")] -fn delimiter_span(delimiter: &MacroDelimiter) -> Span { - match delimiter { +fn delimiter_span_close(macro_delimiter: &MacroDelimiter) -> Span { + let delimiter = match macro_delimiter { + MacroDelimiter::Paren(_) => Delimiter::Parenthesis, + MacroDelimiter::Brace(_) => Delimiter::Brace, + MacroDelimiter::Bracket(_) => Delimiter::Bracket, + }; + let mut group = Group::new(delimiter, TokenStream::new()); + group.set_span(match macro_delimiter { MacroDelimiter::Paren(token) => token.span, MacroDelimiter::Brace(token) => token.span, MacroDelimiter::Bracket(token) => token.span, - } + }); + group.span_close() } impl Macro { @@ -163,9 +170,7 @@ impl Macro { /// given parser. #[cfg(feature = "parsing")] pub fn parse_body_with<F: Parser>(&self, parser: F) -> Result<F::Output> { - // TODO: see if we can get a group.span_close() span in here as the - // scope, rather than the span of the whole group. - let scope = delimiter_span(&self.delimiter); + let scope = delimiter_span_close(&self.delimiter); crate::parse::parse_scoped(parser, scope, self.tokens.clone()) } } diff --git a/tests/common/eq.rs b/tests/common/eq.rs index 87ba6bab..1fc1b5ce 100644 --- a/tests/common/eq.rs +++ b/tests/common/eq.rs @@ -11,7 +11,7 @@ use rustc_ast::ast::{ BinOpKind, BindingMode, Block, BlockCheckMode, BorrowKind, CaptureBy, Const, Crate, CrateSugar, Defaultness, EnumDef, Expr, ExprKind, Extern, Field, FieldPat, FloatTy, FnDecl, FnHeader, FnRetTy, FnSig, ForeignItemKind, ForeignMod, GenericArg, GenericArgs, GenericBound, - GenericParam, GenericParamKind, Generics, GlobalAsm, Ident, ImplPolarity, IntTy, IsAuto, Item, + GenericParam, GenericParamKind, Generics, GlobalAsm, ImplPolarity, IntTy, IsAuto, Item, ItemKind, Label, Lifetime, Lit, LitFloatType, LitIntType, LitKind, LlvmAsmDialect, LlvmInlineAsm, LlvmInlineAsmOutput, Local, MacArgs, MacCall, MacDelimiter, MacStmtStyle, MacroDef, Mod, Movability, MutTy, Mutability, NodeId, Param, ParenthesizedArgs, Pat, PatKind, @@ -27,6 +27,7 @@ use rustc_ast::util::comments; use rustc_data_structures::sync::Lrc; use rustc_data_structures::thin_vec::ThinVec; use rustc_span::source_map::Spanned; +use rustc_span::symbol::Ident; use rustc_span::{sym, Span, Symbol, SyntaxContext, DUMMY_SP}; pub trait SpanlessEq { |