aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-07-21 02:54:47 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-21 02:54:47 +0000
commitda261394318d64aebfda07f2311752988e17d0f1 (patch)
treef0ec3c0b0335603b4c45731ffd0cc124d65512c8
parent28c696453000d7fd61cef59b07c6202b54c5e5e7 (diff)
parentfd22193c64882715bacb76eba22b5069b1889834 (diff)
downloadplatform_external_rust_crates_syn-da261394318d64aebfda07f2311752988e17d0f1.tar.gz
platform_external_rust_crates_syn-da261394318d64aebfda07f2311752988e17d0f1.tar.bz2
platform_external_rust_crates_syn-da261394318d64aebfda07f2311752988e17d0f1.zip
Upgrade rust/crates/syn to 1.0.35 am: c7557ca951 am: 18d4b71f48 am: 2078dd5c69 am: fd22193c64
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/syn/+/1367956 Change-Id: If51b2327a626e45717666ba253f20374258d102a
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA4
-rw-r--r--README.md4
-rw-r--r--benches/rust.rs2
-rw-r--r--src/expr.rs2
-rw-r--r--src/file.rs2
-rw-r--r--src/lib.rs4
-rw-r--r--src/parse_macro_input.rs24
-rw-r--r--tests/common/eq.rs6
-rw-r--r--tests/test_precedence.rs2
-rw-r--r--tests/test_round_trip.rs2
13 files changed, 41 insertions, 17 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 70d33e9a..bd0c7077 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "ab00f4841e5cdd463891fd4612cf1230bd69f613"
+ "sha1": "ba2b69a32471f0ca86981dc4f8ea88b0e9e58da5"
}
}
diff --git a/Cargo.toml b/Cargo.toml
index 67fac010..f677ff82 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "syn"
-version = "1.0.33"
+version = "1.0.35"
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 51d629dd..606ef950 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "syn"
-version = "1.0.33" # don't forget to update html_root_url and syn.json
+version = "1.0.35" # 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"
diff --git a/METADATA b/METADATA
index f3a01c65..4f6d6e55 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@ third_party {
type: GIT
value: "https://github.com/dtolnay/syn"
}
- version: "1.0.33"
+ version: "1.0.35"
license_type: NOTICE
last_upgrade_date {
year: 2020
month: 7
- day: 10
+ day: 20
}
}
diff --git a/README.md b/README.md
index e24b2ce4..12b5f45b 100644
--- a/README.md
+++ b/README.md
@@ -46,10 +46,6 @@ contains some APIs that may be useful more generally.
[`syn::DeriveInput`]: https://docs.rs/syn/1.0/syn/struct.DeriveInput.html
[parser functions]: https://docs.rs/syn/1.0/syn/parse/index.html
-If you get stuck with anything involving procedural macros in Rust I am happy to
-provide help even if the issue is not related to Syn. Please file a ticket in
-this repo.
-
*Version requirement: Syn supports rustc 1.31 and up.*
[*Release notes*](https://github.com/dtolnay/syn/releases)
diff --git a/benches/rust.rs b/benches/rust.rs
index ab37e684..ba9a3d4c 100644
--- a/benches/rust.rs
+++ b/benches/rust.rs
@@ -59,7 +59,7 @@ mod librustc_parse {
}
}
- rustc_ast::with_globals(Edition::Edition2018, || {
+ rustc_ast::with_session_globals(Edition::Edition2018, || {
let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let emitter = Box::new(SilentEmitter);
let handler = Handler::with_emitter(false, None, emitter);
diff --git a/src/expr.rs b/src/expr.rs
index 2b51dfbc..8a832e07 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -1774,7 +1774,7 @@ pub(crate) mod parsing {
e = Expr::Field(ExprField {
attrs: Vec::new(),
base: Box::new(e),
- dot_token: input.parse()?,
+ dot_token,
member: input.parse()?,
});
}
diff --git a/src/file.rs b/src/file.rs
index 29a4a146..c8fab63c 100644
--- a/src/file.rs
+++ b/src/file.rs
@@ -37,6 +37,8 @@ ast_struct! {
/// file.read_to_string(&mut src).expect("Unable to read file");
///
/// let syntax = syn::parse_file(&src).expect("Unable to parse file");
+ ///
+ /// // Debug impl is available if Syn is built with "extra-traits" feature.
/// println!("{:#?}", syntax);
/// }
/// ```
diff --git a/src/lib.rs b/src/lib.rs
index 1e941a07..0c4a6e00 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -250,7 +250,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.33")]
+#![doc(html_root_url = "https://docs.rs/syn/1.0.35")]
#![deny(clippy::all, clippy::pedantic)]
// Ignored clippy lints.
#![allow(
@@ -261,6 +261,7 @@
clippy::inherent_to_string,
clippy::large_enum_variant,
clippy::manual_non_exhaustive,
+ clippy::match_like_matches_macro,
clippy::match_on_vec_items,
clippy::needless_doctest_main,
clippy::needless_pass_by_value,
@@ -280,6 +281,7 @@
clippy::missing_errors_doc,
clippy::module_name_repetitions,
clippy::must_use_candidate,
+ clippy::option_if_let_else,
clippy::shadow_unrelated,
clippy::similar_names,
clippy::single_match_else,
diff --git a/src/parse_macro_input.rs b/src/parse_macro_input.rs
index fbf92701..c8fc1cea 100644
--- a/src/parse_macro_input.rs
+++ b/src/parse_macro_input.rs
@@ -43,6 +43,30 @@
/// # "".parse().unwrap()
/// }
/// ```
+///
+/// <br>
+///
+/// # Expansion
+///
+/// `parse_macro_input!($variable as $Type)` expands to something like:
+///
+/// ```no_run
+/// # extern crate proc_macro;
+/// #
+/// # macro_rules! doc_test {
+/// # ($variable:ident as $Type:ty) => {
+/// match syn::parse::<$Type>($variable) {
+/// Ok(syntax_tree) => syntax_tree,
+/// Err(err) => return proc_macro::TokenStream::from(err.to_compile_error()),
+/// }
+/// # };
+/// # }
+/// #
+/// # fn test(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
+/// # let _ = doc_test!(input as syn::Ident);
+/// # proc_macro::TokenStream::new()
+/// # }
+/// ```
#[macro_export]
macro_rules! parse_macro_input {
($tokenstream:ident as $ty:ty) => {
diff --git a/tests/common/eq.rs b/tests/common/eq.rs
index 794fe4a2..247a58b7 100644
--- a/tests/common/eq.rs
+++ b/tests/common/eq.rs
@@ -335,7 +335,7 @@ spanless_eq_enum!(ForeignItemKind; Static(0 1 2) Fn(0 1 2 3) TyAlias(0 1 2 3) Ma
spanless_eq_enum!(GenericArg; Lifetime(0) Type(0) Const(0));
spanless_eq_enum!(GenericArgs; AngleBracketed(0) Parenthesized(0));
spanless_eq_enum!(GenericBound; Trait(0 1) Outlives(0));
-spanless_eq_enum!(GenericParamKind; Lifetime Type(default) Const(ty));
+spanless_eq_enum!(GenericParamKind; Lifetime Type(default) Const(ty kw_span));
spanless_eq_enum!(ImplPolarity; Positive Negative(0));
spanless_eq_enum!(InlineAsmRegOrRegClass; Reg(0) RegClass(0));
spanless_eq_enum!(InlineAsmTemplatePiece; String(0) Placeholder(operand_idx modifier span));
@@ -442,8 +442,8 @@ fn expand_tts(tts: &TokenStream) -> Vec<TokenTree> {
continue;
}
};
- let contents = comments::strip_doc_comment_decoration(&c.as_str());
- let style = comments::doc_comment_style(&c.as_str());
+ let contents = comments::strip_doc_comment_decoration(c);
+ let style = comments::doc_comment_style(c);
tokens.push(TokenTree::token(TokenKind::Pound, DUMMY_SP));
if style == AttrStyle::Inner {
tokens.push(TokenTree::token(TokenKind::Not, DUMMY_SP));
diff --git a/tests/test_precedence.rs b/tests/test_precedence.rs
index 835a44d9..d74d96d2 100644
--- a/tests/test_precedence.rs
+++ b/tests/test_precedence.rs
@@ -156,7 +156,7 @@ fn test_expressions(edition: Edition, exprs: Vec<syn::Expr>) -> (usize, usize) {
let mut passed = 0;
let mut failed = 0;
- rustc_ast::with_globals(edition, || {
+ rustc_ast::with_session_globals(edition, || {
for expr in exprs {
let raw = quote!(#expr).to_string();
diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs
index 26d36dae..99268a7c 100644
--- a/tests/test_round_trip.rs
+++ b/tests/test_round_trip.rs
@@ -79,7 +79,7 @@ fn test_round_trip() {
let edition = repo::edition(path).parse().unwrap();
let equal = panic::catch_unwind(|| {
- rustc_ast::with_globals(edition, || {
+ rustc_ast::with_session_globals(edition, || {
let sess = ParseSess::new(FilePathMapping::empty());
let before = match librustc_parse(content, &sess) {
Ok(before) => before,