diff options
author | Haibo Huang <hhb@google.com> | 2020-12-22 18:16:25 -0800 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2020-12-22 18:16:25 -0800 |
commit | 4c4795d72b5c020bc64c0552f3b800b4c8595ea7 (patch) | |
tree | 4bf3dfbd52502d726e0f5d5c34ce60b60a53efc7 | |
parent | dfd8868c297b98b503e80bf6e9a744dd6e653d4c (diff) | |
download | platform_external_rust_crates_quote-4c4795d72b5c020bc64c0552f3b800b4c8595ea7.tar.gz platform_external_rust_crates_quote-4c4795d72b5c020bc64c0552f3b800b4c8595ea7.tar.bz2 platform_external_rust_crates_quote-4c4795d72b5c020bc64c0552f3b800b4c8595ea7.zip |
Upgrade rust/crates/quote to 1.0.8
Test: make
Change-Id: Ib9916006424df7991cf6495e5dd15ade26ce5a80
-rw-r--r-- | .cargo_vcs_info.json | 2 | ||||
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | Cargo.toml.orig | 4 | ||||
-rw-r--r-- | METADATA | 8 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/runtime.rs | 18 | ||||
-rw-r--r-- | tests/test.rs | 28 | ||||
-rw-r--r-- | tests/ui/not-repeatable.rs | 5 |
9 files changed, 36 insertions, 39 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index e5a01fc..0471c91 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "9de44cd86e7feae4abba33c3392a2c37725527f9" + "sha1": "8294929b39387e6eab18173fef7d28f66071e973" } } @@ -16,5 +16,5 @@ rust_library_host { } // dependent_library ["feature_list"] -// proc-macro2-1.0.18 "default,proc-macro" +// proc-macro2-1.0.24 "default,proc-macro" // unicode-xid-0.2.1 "default" @@ -13,7 +13,7 @@ [package] edition = "2018" name = "quote" -version = "1.0.7" +version = "1.0.8" authors = ["David Tolnay <dtolnay@gmail.com>"] include = ["Cargo.toml", "src/**/*.rs", "tests/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] description = "Quasi-quoting macro quote!(...)" @@ -26,7 +26,7 @@ repository = "https://github.com/dtolnay/quote" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] [dependencies.proc-macro2] -version = "1.0" +version = "1.0.20" default-features = false [dev-dependencies.rustversion] version = "1.0" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index 6c418fe..4b4a185 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "quote" -version = "1.0.7" # don't forget to update html_root_url, version in readme for breaking changes +version = "1.0.8" # don't forget to update html_root_url, version in readme for breaking changes authors = ["David Tolnay <dtolnay@gmail.com>"] license = "MIT OR Apache-2.0" description = "Quasi-quoting macro quote!(...)" @@ -13,7 +13,7 @@ include = ["Cargo.toml", "src/**/*.rs", "tests/**/*.rs", "README.md", "LICENSE-A edition = "2018" [dependencies] -proc-macro2 = { version = "1.0", default-features = false } +proc-macro2 = { version = "1.0.20", default-features = false } [dev-dependencies] rustversion = "1.0" @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/quote/quote-1.0.7.crate" + value: "https://static.crates.io/crates/quote/quote-1.0.8.crate" } - version: "1.0.7" + version: "1.0.8" license_type: NOTICE last_upgrade_date { year: 2020 - month: 7 - day: 10 + month: 12 + day: 22 } } @@ -82,7 +82,7 @@ #![forbid(unsafe_code)] // Quote types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/quote/1.0.7")] +#![doc(html_root_url = "https://docs.rs/quote/1.0.8")] #[cfg(all( not(all(target_arch = "wasm32", target_os = "unknown")), @@ -564,7 +564,7 @@ macro_rules! quote { /// ``` /// /// If the assertion fails, the user will see an error like the following. The -/// input span of their type is hightlighted in the error. +/// input span of their type is highlighted in the error. /// /// ```text /// error[E0277]: the trait bound `*const (): std::marker::Sync` is not satisfied diff --git a/src/runtime.rs b/src/runtime.rs index fe72687..db3b6a9 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -345,19 +345,15 @@ pub fn mk_ident(id: &str, span: Option<Span>) -> Ident { // // FIXME: When `Ident::new_raw` becomes stable, this method should be // updated to call it when available. - match id.parse::<TokenStream>() { - Ok(ts) => { - let mut iter = ts.into_iter(); - match (iter.next(), iter.next()) { - (Some(TokenTree::Ident(mut id)), None) => { - id.set_span(span); - id - } - _ => unreachable!("valid raw ident fails to parse"), - } + if let Ok(ts) = id.parse::<TokenStream>() { + let mut iter = ts.into_iter(); + if let (Some(TokenTree::Ident(mut id)), None) = (iter.next(), iter.next()) { + id.set_span(span); + return id; } - Err(_) => unreachable!("valid raw ident fails to parse"), } + + panic!("not allowed as a raw identifier: `{}`", id); } // Adapts from `IdentFragment` to `fmt::Display` for use by the `format_ident!` diff --git a/tests/test.rs b/tests/test.rs index 6580bcd..d5a3490 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -26,8 +26,8 @@ fn test_quote_impl() { let expected = concat!( "impl < 'a , T : ToTokens > ToTokens for & 'a T { ", - "fn to_tokens ( & self , tokens : & mut TokenStream ) { ", - "( * * self ) . to_tokens ( tokens ) ", + "fn to_tokens (& self , tokens : & mut TokenStream) { ", + "(* * self) . to_tokens (tokens) ", "} ", "}" ); @@ -48,8 +48,8 @@ fn test_quote_spanned_impl() { let expected = concat!( "impl < 'a , T : ToTokens > ToTokens for & 'a T { ", - "fn to_tokens ( & self , tokens : & mut TokenStream ) { ", - "( * * self ) . to_tokens ( tokens ) ", + "fn to_tokens (& self , tokens : & mut TokenStream) { ", + "(* * self) . to_tokens (tokens) ", "} ", "}" ); @@ -62,7 +62,7 @@ fn test_substitution() { let x = X; let tokens = quote!(#x <#x> (#x) [#x] {#x}); - let expected = "X < X > ( X ) [ X ] { X }"; + let expected = "X < X > (X) [X] { X }"; assert_eq!(expected, tokens.to_string()); } @@ -118,10 +118,10 @@ fn test_advanced() { "phantom : :: std :: marker :: PhantomData < Cow < 'a , str > > , ", "} ", "impl < 'a , T > :: serde :: Serialize for SerializeWith < 'a , T > where T : Serialize { ", - "fn serialize < S > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > ", + "fn serialize < S > (& self , s : & mut S) -> Result < () , S :: Error > ", "where S : :: serde :: Serializer ", "{ ", - "SomeTrait :: serialize_with ( self . value , s ) ", + "SomeTrait :: serialize_with (self . value , s) ", "} ", "} ", "SerializeWith { ", @@ -389,7 +389,7 @@ fn test_outer_line_comment() { let tokens = quote! { /// doc }; - let expected = "# [ doc = r\" doc\" ]"; + let expected = "# [doc = r\" doc\"]"; assert_eq!(expected, tokens.to_string()); } @@ -398,7 +398,7 @@ fn test_inner_line_comment() { let tokens = quote! { //! doc }; - let expected = "# ! [ doc = r\" doc\" ]"; + let expected = "# ! [doc = r\" doc\"]"; assert_eq!(expected, tokens.to_string()); } @@ -407,7 +407,7 @@ fn test_outer_block_comment() { let tokens = quote! { /** doc */ }; - let expected = "# [ doc = r\" doc \" ]"; + let expected = "# [doc = r\" doc \"]"; assert_eq!(expected, tokens.to_string()); } @@ -416,7 +416,7 @@ fn test_inner_block_comment() { let tokens = quote! { /*! doc */ }; - let expected = "# ! [ doc = r\" doc \" ]"; + let expected = "# ! [doc = r\" doc \"]"; assert_eq!(expected, tokens.to_string()); } @@ -425,7 +425,7 @@ fn test_outer_attr() { let tokens = quote! { #[inline] }; - let expected = "# [ inline ]"; + let expected = "# [inline]"; assert_eq!(expected, tokens.to_string()); } @@ -434,7 +434,7 @@ fn test_inner_attr() { let tokens = quote! { #![no_std] }; - let expected = "# ! [ no_std ]"; + let expected = "# ! [no_std]"; assert_eq!(expected, tokens.to_string()); } @@ -448,7 +448,7 @@ fn test_star_after_repetition() { )* *out = None; }; - let expected = "f ( '0' ) ; f ( '1' ) ; * out = None ;"; + let expected = "f ('0') ; f ('1') ; * out = None ;"; assert_eq!(expected, tokens.to_string()); } diff --git a/tests/ui/not-repeatable.rs b/tests/ui/not-repeatable.rs index ff18060..a8f0fe7 100644 --- a/tests/ui/not-repeatable.rs +++ b/tests/ui/not-repeatable.rs @@ -1,7 +1,8 @@ use quote::quote; -use std::net::Ipv4Addr; + +struct Ipv4Addr; fn main() { - let ip = Ipv4Addr::LOCALHOST; + let ip = Ipv4Addr; let _ = quote! { #(#ip)* }; } |