Upgrade rust/crates/proc-macro2 to 1.0.27

Test: make
Change-Id: I66869c4d506555c12bd054d731e818b2aafa6720
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 1eb63e4..409e220 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "56043a1715cf9c458e5203bdf792668e3b271651"
+    "sha1": "2517d6283f4e6a308519881bf7222f60c785626d"
   }
 }
diff --git a/Android.bp b/Android.bp
index 4c28943..da5134a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -47,13 +47,13 @@
         "proc-macro",
         "span-locations",
     ],
-    flags: [
-        "--cfg hygiene",
-        "--cfg lexerror_display",
-        "--cfg proc_macro_span",
-        "--cfg span_locations",
-        "--cfg use_proc_macro",
-        "--cfg wrap_proc_macro",
+    cfgs: [
+        "hygiene",
+        "lexerror_display",
+        "proc_macro_span",
+        "span_locations",
+        "use_proc_macro",
+        "wrap_proc_macro",
     ],
     rustlibs: [
         "libunicode_xid",
@@ -76,13 +76,13 @@
         "proc-macro",
         "span-locations",
     ],
-    flags: [
-        "--cfg hygiene",
-        "--cfg lexerror_display",
-        "--cfg proc_macro_span",
-        "--cfg span_locations",
-        "--cfg use_proc_macro",
-        "--cfg wrap_proc_macro",
+    cfgs: [
+        "hygiene",
+        "lexerror_display",
+        "proc_macro_span",
+        "span_locations",
+        "use_proc_macro",
+        "wrap_proc_macro",
     ],
     rustlibs: [
         "libquote",
@@ -101,13 +101,13 @@
         "proc-macro",
         "span-locations",
     ],
-    flags: [
-        "--cfg hygiene",
-        "--cfg lexerror_display",
-        "--cfg proc_macro_span",
-        "--cfg span_locations",
-        "--cfg use_proc_macro",
-        "--cfg wrap_proc_macro",
+    cfgs: [
+        "hygiene",
+        "lexerror_display",
+        "proc_macro_span",
+        "span_locations",
+        "use_proc_macro",
+        "wrap_proc_macro",
     ],
     rustlibs: [
         "libproc_macro2",
@@ -162,6 +162,6 @@
 }
 
 // dependent_library ["feature_list"]
-//   proc-macro2-1.0.26
+//   proc-macro2-1.0.27
 //   quote-1.0.9
-//   unicode-xid-0.2.1 "default"
+//   unicode-xid-0.2.2 "default"
diff --git a/Cargo.toml b/Cargo.toml
index 3bb4b8e..57fbf1b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
 [package]
 edition = "2018"
 name = "proc-macro2"
-version = "1.0.26"
+version = "1.0.27"
 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 f229dbe..324c33c 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "proc-macro2"
-version = "1.0.26" # remember to update html_root_url
+version = "1.0.27" # 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 1f73ea0..9b63d5c 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/proc-macro2/proc-macro2-1.0.26.crate"
+    value: "https://static.crates.io/crates/proc-macro2/proc-macro2-1.0.27.crate"
   }
-  version: "1.0.26"
+  version: "1.0.27"
   license_type: NOTICE
   last_upgrade_date {
     year: 2021
-    month: 4
-    day: 1
+    month: 6
+    day: 21
   }
 }
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 2e3c81b..be87033 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -2,9 +2,6 @@
 {
   "presubmit": [
     {
-      "name": "ZipFuseTest"
-    },
-    {
       "name": "anyhow_device_test_src_lib"
     },
     {
@@ -41,9 +38,6 @@
       "name": "anyhow_device_test_tests_test_source"
     },
     {
-      "name": "authfs_device_test_src_lib"
-    },
-    {
       "name": "doh_unit_test"
     },
     {
@@ -56,6 +50,9 @@
       "name": "keystore2_crypto_test_rust"
     },
     {
+      "name": "keystore2_selinux_concurrency_test"
+    },
+    {
       "name": "keystore2_selinux_test"
     },
     {
@@ -98,6 +95,15 @@
       "name": "serde_test_device_test_src_lib"
     },
     {
+      "name": "slab_device_test_src_lib"
+    },
+    {
+      "name": "slab_device_test_tests_serde"
+    },
+    {
+      "name": "slab_device_test_tests_slab"
+    },
+    {
       "name": "tokio-test_device_test_src_lib"
     },
     {
@@ -110,15 +116,33 @@
       "name": "tokio-test_device_test_tests_macros"
     },
     {
+      "name": "tokio_device_test_tests__require_full"
+    },
+    {
       "name": "tokio_device_test_tests_buffered"
     },
     {
+      "name": "tokio_device_test_tests_io_async_fd"
+    },
+    {
       "name": "tokio_device_test_tests_io_async_read"
     },
     {
+      "name": "tokio_device_test_tests_io_chain"
+    },
+    {
+      "name": "tokio_device_test_tests_io_copy"
+    },
+    {
       "name": "tokio_device_test_tests_io_copy_bidirectional"
     },
     {
+      "name": "tokio_device_test_tests_io_driver"
+    },
+    {
+      "name": "tokio_device_test_tests_io_driver_drop"
+    },
+    {
       "name": "tokio_device_test_tests_io_lines"
     },
     {
@@ -131,9 +155,24 @@
       "name": "tokio_device_test_tests_io_read_buf"
     },
     {
+      "name": "tokio_device_test_tests_io_read_exact"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_line"
+    },
+    {
       "name": "tokio_device_test_tests_io_read_to_end"
     },
     {
+      "name": "tokio_device_test_tests_io_read_to_string"
+    },
+    {
+      "name": "tokio_device_test_tests_io_read_until"
+    },
+    {
+      "name": "tokio_device_test_tests_io_split"
+    },
+    {
       "name": "tokio_device_test_tests_io_take"
     },
     {
@@ -152,12 +191,36 @@
       "name": "tokio_device_test_tests_macros_join"
     },
     {
+      "name": "tokio_device_test_tests_macros_pin"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_select"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_test"
+    },
+    {
+      "name": "tokio_device_test_tests_macros_try_join"
+    },
+    {
+      "name": "tokio_device_test_tests_net_bind_resource"
+    },
+    {
+      "name": "tokio_device_test_tests_net_lookup_host"
+    },
+    {
       "name": "tokio_device_test_tests_no_rt"
     },
     {
+      "name": "tokio_device_test_tests_process_kill_on_drop"
+    },
+    {
       "name": "tokio_device_test_tests_rt_basic"
     },
     {
+      "name": "tokio_device_test_tests_rt_common"
+    },
+    {
       "name": "tokio_device_test_tests_rt_threaded"
     },
     {
@@ -173,15 +236,36 @@
       "name": "tokio_device_test_tests_sync_mpsc"
     },
     {
+      "name": "tokio_device_test_tests_sync_mutex"
+    },
+    {
       "name": "tokio_device_test_tests_sync_mutex_owned"
     },
     {
+      "name": "tokio_device_test_tests_sync_notify"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_oneshot"
+    },
+    {
       "name": "tokio_device_test_tests_sync_rwlock"
     },
     {
+      "name": "tokio_device_test_tests_sync_semaphore"
+    },
+    {
+      "name": "tokio_device_test_tests_sync_semaphore_owned"
+    },
+    {
       "name": "tokio_device_test_tests_sync_watch"
     },
     {
+      "name": "tokio_device_test_tests_task_abort"
+    },
+    {
+      "name": "tokio_device_test_tests_task_blocking"
+    },
+    {
       "name": "tokio_device_test_tests_task_local"
     },
     {
@@ -191,24 +275,51 @@
       "name": "tokio_device_test_tests_tcp_accept"
     },
     {
+      "name": "tokio_device_test_tests_tcp_connect"
+    },
+    {
       "name": "tokio_device_test_tests_tcp_echo"
     },
     {
+      "name": "tokio_device_test_tests_tcp_into_split"
+    },
+    {
       "name": "tokio_device_test_tests_tcp_into_std"
     },
     {
+      "name": "tokio_device_test_tests_tcp_peek"
+    },
+    {
       "name": "tokio_device_test_tests_tcp_shutdown"
     },
     {
+      "name": "tokio_device_test_tests_tcp_socket"
+    },
+    {
+      "name": "tokio_device_test_tests_tcp_split"
+    },
+    {
       "name": "tokio_device_test_tests_time_rt"
     },
     {
+      "name": "tokio_device_test_tests_udp"
+    },
+    {
+      "name": "tokio_device_test_tests_uds_cred"
+    },
+    {
       "name": "tokio_device_test_tests_uds_split"
     },
     {
       "name": "unicode-bidi_device_test_src_lib"
     },
     {
+      "name": "unicode-xid_device_test_src_lib"
+    },
+    {
+      "name": "unicode-xid_device_test_tests_exhaustive_tests"
+    },
+    {
       "name": "url_device_test_src_lib"
     },
     {
diff --git a/src/fallback.rs b/src/fallback.rs
index 50d10db..3d2feae 100644
--- a/src/fallback.rs
+++ b/src/fallback.rs
@@ -43,6 +43,12 @@
     pub(crate) fn span(&self) -> Span {
         self.span
     }
+
+    fn call_site() -> Self {
+        LexError {
+            span: Span::call_site(),
+        }
+    }
 }
 
 impl TokenStream {
@@ -887,6 +893,20 @@
     }
 }
 
+impl FromStr for Literal {
+    type Err = LexError;
+
+    fn from_str(repr: &str) -> Result<Self, Self::Err> {
+        let cursor = get_cursor(repr);
+        if let Ok((_rest, literal)) = parse::literal(cursor) {
+            if literal.text.len() == repr.len() {
+                return Ok(literal);
+            }
+        }
+        Err(LexError::call_site())
+    }
+}
+
 impl Display for Literal {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         Display::fmt(&self.text, f)
diff --git a/src/lib.rs b/src/lib.rs
index 9dec309..52d01f2 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.26")]
+#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.27")]
 #![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))]
@@ -1203,6 +1203,17 @@
     }
 }
 
+impl FromStr for Literal {
+    type Err = LexError;
+
+    fn from_str(repr: &str) -> Result<Self, LexError> {
+        repr.parse().map(Literal::_new).map_err(|inner| LexError {
+            inner,
+            _marker: Marker,
+        })
+    }
+}
+
 impl Debug for Literal {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         Debug::fmt(&self.inner, f)
diff --git a/src/parse.rs b/src/parse.rs
index e5caed8..13a05a8 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -59,7 +59,7 @@
     }
 }
 
-struct Reject;
+pub(crate) struct Reject;
 type PResult<'a, O> = Result<(Cursor<'a>, O), Reject>;
 
 fn skip_whitespace(input: Cursor) -> Cursor {
@@ -310,7 +310,7 @@
     Ok((input.advance(end), &input.rest[..end]))
 }
 
-fn literal(input: Cursor) -> PResult<Literal> {
+pub(crate) fn literal(input: Cursor) -> PResult<Literal> {
     let rest = literal_nocapture(input)?;
     let end = input.len() - rest.len();
     Ok((rest, Literal::_new(input.rest[..end].to_string())))
diff --git a/src/wrapper.rs b/src/wrapper.rs
index 24d86e8..2829dd7 100644
--- a/src/wrapper.rs
+++ b/src/wrapper.rs
@@ -29,6 +29,14 @@
     Fallback(fallback::LexError),
 }
 
+impl LexError {
+    fn call_site() -> Self {
+        LexError::Fallback(fallback::LexError {
+            span: fallback::Span::call_site(),
+        })
+    }
+}
+
 fn mismatch() -> ! {
     panic!("stable/nightly mismatch")
 }
@@ -108,11 +116,7 @@
 // Work around https://github.com/rust-lang/rust/issues/58736.
 fn proc_macro_parse(src: &str) -> Result<proc_macro::TokenStream, LexError> {
     let result = panic::catch_unwind(|| src.parse().map_err(LexError::Compiler));
-    result.unwrap_or_else(|_| {
-        Err(LexError::Fallback(fallback::LexError {
-            span: fallback::Span::call_site(),
-        }))
-    })
+    result.unwrap_or_else(|_| Err(LexError::call_site()))
 }
 
 impl Display for TokenStream {
@@ -912,6 +916,30 @@
     }
 }
 
+impl FromStr for Literal {
+    type Err = LexError;
+
+    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())
+            {
+                if literal.to_string().len() == repr.len() {
+                    return Ok(Literal::Compiler(literal));
+                }
+            }
+            Err(LexError::call_site())
+        } else {
+            let literal = fallback::Literal::from_str(repr)?;
+            Ok(Literal::Fallback(literal))
+        }
+    }
+}
+
 impl Display for Literal {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match self {
diff --git a/tests/test.rs b/tests/test.rs
index 6d0a93e..75a880f 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -164,6 +164,20 @@
 }
 
 #[test]
+fn literal_parse() {
+    assert!("1".parse::<Literal>().is_ok());
+    assert!("1.0".parse::<Literal>().is_ok());
+    assert!("'a'".parse::<Literal>().is_ok());
+    assert!("\"\n\"".parse::<Literal>().is_ok());
+    assert!("0 1".parse::<Literal>().is_err());
+    assert!(" 0".parse::<Literal>().is_err());
+    assert!("0 ".parse::<Literal>().is_err());
+    assert!("/* comment */0".parse::<Literal>().is_err());
+    assert!("0/* comment */".parse::<Literal>().is_err());
+    assert!("0// comment".parse::<Literal>().is_err());
+}
+
+#[test]
 fn roundtrip() {
     fn roundtrip(p: &str) {
         println!("parse: {}", p);