aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2021-10-05 03:29:17 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-10-05 03:29:17 +0000
commit22688df941e4beae12664a218dad224989cdfea1 (patch)
treeb0cb732cb0c2c548b98c132b869c0cef62c5b60c
parent5afc11ef8dd88c1bfa8121d923217f611d2bf19c (diff)
parent9c9387fa4162bde2ed37bd145b85871c15dfeee5 (diff)
downloadproc-macro2-22688df941e4beae12664a218dad224989cdfea1.tar.gz
Merge "Upgrade rust/crates/proc-macro2 to 1.0.29" am: 8129d0cb0c am: f2619ed659 am: 9c9387fa41
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/proc-macro2/+/1833322 Change-Id: Ib48845d67ba778d9138e4051e1e65b591739bca4
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp16
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA8
-rw-r--r--build.rs4
-rw-r--r--src/lib.rs2
-rw-r--r--src/wrapper.rs25
8 files changed, 38 insertions, 23 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 0b4ad97..b4a0dce 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "93c4df24e2d5ef9ddff484a7086f2e0018a13507"
+ "sha1": "4fc89676e7bdef2ba68e8a1383d07df0bb7bbeb0"
}
}
diff --git a/Android.bp b/Android.bp
index 3118612..8933a44 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,4 @@
-// This file is generated by cargo2android.py --run --dependencies --tests --host-first-multilib --features=default,span-locations.
+// This file is generated by cargo2android.py --run --tests --host-first-multilib --features=default,span-locations.
// Do not modify this file as changes will be overridden on upgrade.
package {
@@ -40,6 +40,8 @@ license {
rust_library_host {
name: "libproc_macro2",
crate_name: "proc_macro2",
+ cargo_env_compat: true,
+ cargo_pkg_version: "1.0.29",
srcs: ["src/lib.rs"],
edition: "2018",
features: [
@@ -50,6 +52,7 @@ rust_library_host {
cfgs: [
"hygiene",
"lexerror_display",
+ "literal_from_str",
"proc_macro_span",
"span_locations",
"use_proc_macro",
@@ -64,6 +67,8 @@ rust_library_host {
rust_test_host {
name: "proc-macro2_host_test_src_lib",
crate_name: "proc_macro2",
+ cargo_env_compat: true,
+ cargo_pkg_version: "1.0.29",
srcs: ["src/lib.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
@@ -79,6 +84,7 @@ rust_test_host {
cfgs: [
"hygiene",
"lexerror_display",
+ "literal_from_str",
"proc_macro_span",
"span_locations",
"use_proc_macro",
@@ -93,6 +99,8 @@ rust_test_host {
rust_defaults {
name: "proc-macro2_test_defaults",
crate_name: "proc_macro2",
+ cargo_env_compat: true,
+ cargo_pkg_version: "1.0.29",
test_suites: ["general-tests"],
auto_gen_config: true,
edition: "2018",
@@ -104,6 +112,7 @@ rust_defaults {
cfgs: [
"hygiene",
"lexerror_display",
+ "literal_from_str",
"proc_macro_span",
"span_locations",
"use_proc_macro",
@@ -160,8 +169,3 @@ rust_test_host {
unit_test: true,
},
}
-
-// dependent_library ["feature_list"]
-// proc-macro2-1.0.28
-// quote-1.0.9
-// unicode-xid-0.2.2 "default"
diff --git a/Cargo.toml b/Cargo.toml
index 4285fc8..901c787 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@
[package]
edition = "2018"
name = "proc-macro2"
-version = "1.0.28"
+version = "1.0.29"
authors = ["Alex Crichton <alex@alexcrichton.com>", "David Tolnay <dtolnay@gmail.com>"]
description = "A substitute implementation of the compiler's `proc_macro` API to decouple\ntoken-based libraries from the procedural macro use case.\n"
documentation = "https://docs.rs/proc-macro2"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 254063e..543dca5 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "proc-macro2"
-version = "1.0.28" # remember to update html_root_url
+version = "1.0.29" # remember to update html_root_url
authors = ["Alex Crichton <alex@alexcrichton.com>", "David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0"
readme = "README.md"
diff --git a/METADATA b/METADATA
index fee70d5..e87d081 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/proc-macro2/proc-macro2-1.0.28.crate"
+ value: "https://static.crates.io/crates/proc-macro2/proc-macro2-1.0.29.crate"
}
- version: "1.0.28"
+ version: "1.0.29"
license_type: NOTICE
last_upgrade_date {
year: 2021
- month: 8
- day: 9
+ month: 9
+ day: 22
}
}
diff --git a/build.rs b/build.rs
index 815292e..f32d5c8 100644
--- a/build.rs
+++ b/build.rs
@@ -78,6 +78,10 @@ fn main() {
println!("cargo:rustc-cfg=hygiene");
}
+ if version.minor >= 54 {
+ println!("cargo:rustc-cfg=literal_from_str");
+ }
+
let target = env::var("TARGET").unwrap();
if !enable_use_proc_macro(&target) {
return;
diff --git a/src/lib.rs b/src/lib.rs
index d494ce8..1d35bfd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -78,7 +78,7 @@
//! a different thread.
// Proc-macro2 types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.28")]
+#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.29")]
#![cfg_attr(any(proc_macro_span, super_unstable), feature(proc_macro_span))]
#![cfg_attr(super_unstable, feature(proc_macro_raw_ident, proc_macro_def_site))]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
diff --git a/src/wrapper.rs b/src/wrapper.rs
index 2829dd7..dc93873 100644
--- a/src/wrapper.rs
+++ b/src/wrapper.rs
@@ -921,18 +921,25 @@ impl FromStr for Literal {
fn from_str(repr: &str) -> Result<Self, Self::Err> {
if inside_proc_macro() {
- // TODO: use libproc_macro's FromStr impl once it is available in
- // rustc. https://github.com/rust-lang/rust/pull/84717
- let tokens = proc_macro_parse(repr)?;
- let mut iter = tokens.into_iter();
- if let (Some(proc_macro::TokenTree::Literal(literal)), None) =
- (iter.next(), iter.next())
+ #[cfg(literal_from_str)]
{
- if literal.to_string().len() == repr.len() {
- return Ok(Literal::Compiler(literal));
+ proc_macro::Literal::from_str(repr)
+ .map(Literal::Compiler)
+ .map_err(LexError::Compiler)
+ }
+ #[cfg(not(literal_from_str))]
+ {
+ let tokens = proc_macro_parse(repr)?;
+ let mut iter = tokens.into_iter();
+ if let (Some(proc_macro::TokenTree::Literal(literal)), None) =
+ (iter.next(), iter.next())
+ {
+ if literal.to_string().len() == repr.len() {
+ return Ok(Literal::Compiler(literal));
+ }
}
+ Err(LexError::call_site())
}
- Err(LexError::call_site())
} else {
let literal = fallback::Literal::from_str(repr)?;
Ok(Literal::Fallback(literal))