aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-05-07 22:08:54 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-05-07 22:08:54 +0000
commit328fedf73723ec65c03f0be6cd7ce30b53714ad5 (patch)
tree8a967cdb4cefab94d9195c814d6fc7d15c8a8780
parent2cf874a289f3df1c1536ab60b0635ea9ff30f73d (diff)
parent2cfca3511b4da5d151e2c0cb3975beabba08dd4c (diff)
downloadsyn-328fedf73723ec65c03f0be6cd7ce30b53714ad5.tar.gz
Upgrade rust/crates/syn to 1.0.19 am: 2cfca3511b
Change-Id: Iefece4ec8de3052fa2f931a6479460474273c0aa
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Cargo.toml4
-rw-r--r--Cargo.toml.orig5
-rw-r--r--METADATA6
-rw-r--r--README.md2
-rw-r--r--src/item.rs75
-rw-r--r--src/lib.rs3
-rw-r--r--tests/common/mod.rs5
-rw-r--r--tests/repo/mod.rs9
9 files changed, 71 insertions, 40 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 86301050..7ba3f3c9 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "7a44b284afd696b4f5310d15bb299dbd5c6085ab"
+ "sha1": "e51bb8b2500aab8d2a62f77c0da7af203a0be6ea"
}
}
diff --git a/Cargo.toml b/Cargo.toml
index eca9ef81..9ef9382d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "syn"
-version = "1.0.18"
+version = "1.0.19"
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"
@@ -91,5 +91,3 @@ printing = ["quote"]
proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"]
visit = []
visit-mut = []
-[badges.travis-ci]
-repository = "dtolnay/syn"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index d605cab9..a1a297aa 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "syn"
-version = "1.0.18" # don't forget to update html_root_url and syn.json
+version = "1.0.19" # 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"
@@ -66,8 +66,5 @@ targets = ["x86_64-unknown-linux-gnu"]
[package.metadata.playground]
all-features = true
-[badges]
-travis-ci = { repository = "dtolnay/syn" }
-
[workspace]
members = ["dev", "json"]
diff --git a/METADATA b/METADATA
index 94b410f7..0d3f7ccc 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@ third_party {
type: GIT
value: "https://github.com/dtolnay/syn"
}
- version: "1.0.18"
+ version: "1.0.19"
license_type: NOTICE
last_upgrade_date {
year: 2020
- month: 4
- day: 23
+ month: 5
+ day: 6
}
}
diff --git a/README.md b/README.md
index 5e578e52..a7dd97e2 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Parser for Rust source code
===========================
-[![Build Status](https://api.travis-ci.org/dtolnay/syn.svg?branch=master)](https://travis-ci.org/dtolnay/syn)
+[![Build Status](https://img.shields.io/github/workflow/status/dtolnay/syn/CI/master)](https://github.com/dtolnay/syn/actions?query=branch%3Amaster)
[![Latest Version](https://img.shields.io/crates/v/syn.svg)](https://crates.io/crates/syn)
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/syn/1.0/syn/)
[![Rustc Version 1.31+](https://img.shields.io/badge/rustc-1.31+-lightgray.svg)](https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html)
diff --git a/src/item.rs b/src/item.rs
index 83b82fdc..f700b57e 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -1155,7 +1155,7 @@ pub mod parsing {
use crate::ext::IdentExt;
use crate::parse::discouraged::Speculative;
- use crate::parse::{Parse, ParseStream, Result};
+ use crate::parse::{Parse, ParseBuffer, ParseStream, Result};
use crate::token::Brace;
use proc_macro2::{Delimiter, Group, Punct, Spacing, TokenTree};
use std::iter::{self, FromIterator};
@@ -1745,6 +1745,7 @@ pub mod parsing {
impl Parse for ForeignItem {
fn parse(input: ParseStream) -> Result<Self> {
+ let begin = input.fork();
let mut attrs = input.call(Attribute::parse_outer)?;
let ahead = input.fork();
let vis: Visibility = ahead.parse()?;
@@ -1755,7 +1756,7 @@ pub mod parsing {
} else if lookahead.peek(Token![static]) {
input.parse().map(ForeignItem::Static)
} else if lookahead.peek(Token![type]) {
- input.parse().map(ForeignItem::Type)
+ parse_flexible_foreign_item_type(begin, input)
} else if vis.is_inherited()
&& (lookahead.peek(Ident)
|| lookahead.peek(Token![self])
@@ -1769,17 +1770,16 @@ pub mod parsing {
Err(lookahead.error())
}?;
- {
- let item_attrs = match &mut item {
- ForeignItem::Fn(item) => &mut item.attrs,
- ForeignItem::Static(item) => &mut item.attrs,
- ForeignItem::Type(item) => &mut item.attrs,
- ForeignItem::Macro(item) => &mut item.attrs,
- ForeignItem::Verbatim(_) | ForeignItem::__Nonexhaustive => unreachable!(),
- };
- attrs.extend(item_attrs.drain(..));
- *item_attrs = attrs;
- }
+ let item_attrs = match &mut item {
+ ForeignItem::Fn(item) => &mut item.attrs,
+ ForeignItem::Static(item) => &mut item.attrs,
+ ForeignItem::Type(item) => &mut item.attrs,
+ ForeignItem::Macro(item) => &mut item.attrs,
+ ForeignItem::Verbatim(_) => return Ok(item),
+ ForeignItem::__Nonexhaustive => unreachable!(),
+ };
+ attrs.extend(item_attrs.drain(..));
+ *item_attrs = attrs;
Ok(item)
}
@@ -1853,6 +1853,55 @@ pub mod parsing {
}
}
+ fn parse_flexible_foreign_item_type(
+ begin: ParseBuffer,
+ input: ParseStream,
+ ) -> Result<ForeignItem> {
+ let mut extra = false;
+
+ let vis: Visibility = input.parse()?;
+ let type_token: Token![type] = input.parse()?;
+ let ident: Ident = input.parse()?;
+ if input.peek(Token![<]) {
+ extra = true;
+ input.parse::<Generics>()?;
+ }
+ if input.parse::<Option<Token![:]>>()?.is_some() {
+ extra = true;
+ loop {
+ input.parse::<TypeParamBound>()?;
+ if input.peek(Token![where]) || input.peek(Token![;]) {
+ break;
+ }
+ input.parse::<Token![+]>()?;
+ if input.peek(Token![where]) || input.peek(Token![;]) {
+ break;
+ }
+ }
+ }
+ if input.peek(Token![where]) {
+ extra = true;
+ input.parse::<WhereClause>()?;
+ }
+ if input.parse::<Option<Token![=]>>()?.is_some() {
+ extra = true;
+ input.parse::<Type>()?;
+ }
+ let semi_token: Token![;] = input.parse()?;
+
+ if extra {
+ Ok(ForeignItem::Verbatim(verbatim::between(begin, input)))
+ } else {
+ Ok(ForeignItem::Type(ForeignItemType {
+ attrs: Vec::new(),
+ vis,
+ type_token,
+ ident,
+ semi_token,
+ }))
+ }
+ }
+
impl Parse for ForeignItemMacro {
fn parse(input: ParseStream) -> Result<Self> {
let attrs = input.call(Attribute::parse_outer)?;
diff --git a/src/lib.rs b/src/lib.rs
index 132a65cb..6d0a85e4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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.18")]
+#![doc(html_root_url = "https://docs.rs/syn/1.0.19")]
#![deny(clippy::all, clippy::pedantic)]
// Ignored clippy lints.
#![allow(
@@ -252,6 +252,7 @@
clippy::eval_order_dependence,
clippy::inherent_to_string,
clippy::large_enum_variant,
+ clippy::match_on_vec_items,
clippy::needless_doctest_main,
clippy::needless_pass_by_value,
clippy::never_loop,
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index 3dd25527..8b784bee 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -12,8 +12,3 @@ pub fn abort_after() -> usize {
Err(_) => usize::max_value(),
}
}
-
-/// Are we running in travis-ci.org.
-pub fn travis_ci() -> bool {
- env::var_os("TRAVIS").is_some()
-}
diff --git a/tests/repo/mod.rs b/tests/repo/mod.rs
index c1dc7e0a..eb900bc1 100644
--- a/tests/repo/mod.rs
+++ b/tests/repo/mod.rs
@@ -1,7 +1,6 @@
mod progress;
use self::progress::Progress;
-use crate::common;
use anyhow::Result;
use flate2::read::GzDecoder;
use std::fs;
@@ -82,10 +81,6 @@ pub fn base_dir_filter(entry: &DirEntry) -> bool {
// https://github.com/dtolnay/syn/issues/762
"test/ui/parser/foreign-static-syntactic-pass.rs" |
- // TODO: extern type with bound: `extern { type A: Ord; }`
- // https://github.com/dtolnay/syn/issues/763
- "test/ui/parser/foreign-ty-syntactic-pass.rs" |
-
// TODO: top level const/static without value: `const X: u8;`
// https://github.com/dtolnay/syn/issues/764
"test/ui/parser/item-free-const-no-body-syntactic-pass.rs" |
@@ -167,10 +162,6 @@ fn download_and_unpack() -> Result<()> {
let relative = path.strip_prefix(&prefix)?;
let out = tests_rust.join(relative);
entry.unpack(&out)?;
- if common::travis_ci() {
- // Something about this makes the travis build not deadlock...
- errorf!(".");
- }
}
fs::write("tests/rust/COMMIT", REVISION)?;