Merge "Upgrade rust/crates/regex-syntax to 0.6.18" am: 9a23c1d0f4 am: 7095120865 am: d5e042312c

Original change: undetermined

Change-Id: Ia4437ff6ef6465303c0df379123be016e685bc82
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 41dbfee..9e8f89f 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "7174f158bdb01a8e60eef28c3676429eae024882"
+    "sha1": "95047166acfbf49446a3b9e3633e353cf95c678c"
   }
 }
diff --git a/Cargo.toml b/Cargo.toml
index 46fafd0..a0e2849 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@
 
 [package]
 name = "regex-syntax"
-version = "0.6.17"
+version = "0.6.18"
 authors = ["The Rust Project Developers"]
 description = "A regular expression parser."
 homepage = "https://github.com/rust-lang/regex"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index c21b35d..a3d4187 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "regex-syntax"
-version = "0.6.17"  #:version
+version = "0.6.18"  #:version
 authors = ["The Rust Project Developers"]
 license = "MIT/Apache-2.0"
 repository = "https://github.com/rust-lang/regex"
diff --git a/METADATA b/METADATA
index e071c39..5bf8bef 100644
--- a/METADATA
+++ b/METADATA
@@ -9,11 +9,11 @@
     type: GIT
     value: "https://github.com/rust-lang/regex"
   }
-  version: "0.6.17"
+  version: "0.6.18"
   license_type: NOTICE
   last_upgrade_date {
     year: 2020
-    month: 3
-    day: 31
+    month: 5
+    day: 28
   }
 }
diff --git a/src/hir/mod.rs b/src/hir/mod.rs
index a2f166c..53d90b8 100644
--- a/src/hir/mod.rs
+++ b/src/hir/mod.rs
@@ -241,8 +241,8 @@
         info.set_any_anchored_start(false);
         info.set_any_anchored_end(false);
         info.set_match_empty(true);
-        info.set_literal(true);
-        info.set_alternation_literal(true);
+        info.set_literal(false);
+        info.set_alternation_literal(false);
         Hir { kind: HirKind::Empty, info: info }
     }
 
@@ -671,8 +671,8 @@
     /// true when this HIR expression is either itself a `Literal` or a
     /// concatenation of only `Literal`s.
     ///
-    /// For example, `f` and `foo` are literals, but `f+`, `(foo)`, `foo()`
-    /// are not (even though that contain sub-expressions that are literals).
+    /// For example, `f` and `foo` are literals, but `f+`, `(foo)`, `foo()`,
+    /// `` are not (even though that contain sub-expressions that are literals).
     pub fn is_literal(&self) -> bool {
         self.info.is_literal()
     }
@@ -682,8 +682,8 @@
     /// true when this HIR expression is either itself a `Literal` or a
     /// concatenation of only `Literal`s or an alternation of only `Literal`s.
     ///
-    /// For example, `f`, `foo`, `a|b|c`, and `foo|bar|baz` are alternaiton
-    /// literals, but `f+`, `(foo)`, `foo()`
+    /// For example, `f`, `foo`, `a|b|c`, and `foo|bar|baz` are alternation
+    /// literals, but `f+`, `(foo)`, `foo()`, ``
     /// are not (even though that contain sub-expressions that are literals).
     pub fn is_alternation_literal(&self) -> bool {
         self.info.is_alternation_literal()
@@ -1496,7 +1496,7 @@
                 self.bools &= !(1 << $bit);
             }
         }
-    }
+    };
 }
 
 impl HirInfo {
diff --git a/src/hir/translate.rs b/src/hir/translate.rs
index 2469890..72f3f9a 100644
--- a/src/hir/translate.rs
+++ b/src/hir/translate.rs
@@ -3105,13 +3105,13 @@
     #[test]
     fn analysis_is_literal() {
         // Positive examples.
-        assert!(t(r"").is_literal());
         assert!(t(r"a").is_literal());
         assert!(t(r"ab").is_literal());
         assert!(t(r"abc").is_literal());
         assert!(t(r"(?m)abc").is_literal());
 
         // Negative examples.
+        assert!(!t(r"").is_literal());
         assert!(!t(r"^").is_literal());
         assert!(!t(r"a|b").is_literal());
         assert!(!t(r"(a)").is_literal());
@@ -3124,7 +3124,6 @@
     #[test]
     fn analysis_is_alternation_literal() {
         // Positive examples.
-        assert!(t(r"").is_alternation_literal());
         assert!(t(r"a").is_alternation_literal());
         assert!(t(r"ab").is_alternation_literal());
         assert!(t(r"abc").is_alternation_literal());
@@ -3135,6 +3134,7 @@
         assert!(t(r"foo|bar|baz").is_alternation_literal());
 
         // Negative examples.
+        assert!(!t(r"").is_alternation_literal());
         assert!(!t(r"^").is_alternation_literal());
         assert!(!t(r"(a)").is_alternation_literal());
         assert!(!t(r"a+").is_alternation_literal());
diff --git a/src/lib.rs b/src/lib.rs
index e9f59d8..7892668 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -175,7 +175,7 @@
 /// The string returned may be safely used as a literal in a regular
 /// expression.
 pub fn escape(text: &str) -> String {
-    let mut quoted = String::with_capacity(text.len());
+    let mut quoted = String::new();
     escape_into(text, &mut quoted);
     quoted
 }
@@ -185,6 +185,7 @@
 /// This will append escape characters into the given buffer. The characters
 /// that are appended are safe to use as a literal in a regular expression.
 pub fn escape_into(text: &str, buf: &mut String) {
+    buf.reserve(text.len());
     for c in text.chars() {
         if is_meta_character(c) {
             buf.push('\\');
diff --git a/src/unicode_tables/age.rs b/src/unicode_tables/age.rs
index 1452a52..7772919 100644
--- a/src/unicode_tables/age.rs
+++ b/src/unicode_tables/age.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate age ucd-13.0.0 --chars
+//   ucd-generate age ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("V10_0", V10_0),
diff --git a/src/unicode_tables/case_folding_simple.rs b/src/unicode_tables/case_folding_simple.rs
index 6b4cad3..cfb83f3 100644
--- a/src/unicode_tables/case_folding_simple.rs
+++ b/src/unicode_tables/case_folding_simple.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate case-folding-simple ucd-13.0.0 --chars --all-pairs
+//   ucd-generate case-folding-simple ucd-13.0.0 --chars --all-pairs
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const CASE_FOLDING_SIMPLE: &'static [(char, &'static [char])] = &[
     ('A', &['a']),
diff --git a/src/unicode_tables/general_category.rs b/src/unicode_tables/general_category.rs
index f2f9cef..33b7b7e 100644
--- a/src/unicode_tables/general_category.rs
+++ b/src/unicode_tables/general_category.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate general-category ucd-13.0.0 --chars --exclude surrogate
+//   ucd-generate general-category ucd-13.0.0 --chars --exclude surrogate
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("Cased_Letter", CASED_LETTER),
diff --git a/src/unicode_tables/grapheme_cluster_break.rs b/src/unicode_tables/grapheme_cluster_break.rs
index 1d0b285..7df9d2b 100644
--- a/src/unicode_tables/grapheme_cluster_break.rs
+++ b/src/unicode_tables/grapheme_cluster_break.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate grapheme-cluster-break ucd-13.0.0 --chars
+//   ucd-generate grapheme-cluster-break ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("CR", CR),
diff --git a/src/unicode_tables/perl_decimal.rs b/src/unicode_tables/perl_decimal.rs
index 541f324..2a09259 100644
--- a/src/unicode_tables/perl_decimal.rs
+++ b/src/unicode_tables/perl_decimal.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate general-category ucd-13.0.0 --chars --include decimalnumber
+//   ucd-generate general-category ucd-13.0.0 --chars --include decimalnumber
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] =
     &[("Decimal_Number", DECIMAL_NUMBER)];
diff --git a/src/unicode_tables/perl_space.rs b/src/unicode_tables/perl_space.rs
index 8f048f8..c112dd1 100644
--- a/src/unicode_tables/perl_space.rs
+++ b/src/unicode_tables/perl_space.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate property-bool ucd-13.0.0 --chars --include whitespace
+//   ucd-generate property-bool ucd-13.0.0 --chars --include whitespace
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] =
     &[("White_Space", WHITE_SPACE)];
diff --git a/src/unicode_tables/perl_word.rs b/src/unicode_tables/perl_word.rs
index 68e9451..df9eac7 100644
--- a/src/unicode_tables/perl_word.rs
+++ b/src/unicode_tables/perl_word.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate perl-word ucd-13.0.0 --chars
+//   ucd-generate perl-word ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const PERL_WORD: &'static [(char, char)] = &[
     ('0', '9'),
diff --git a/src/unicode_tables/property_bool.rs b/src/unicode_tables/property_bool.rs
index a0ef0cf..21cbaf9 100644
--- a/src/unicode_tables/property_bool.rs
+++ b/src/unicode_tables/property_bool.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate property-bool ucd-13.0.0 --chars
+//   ucd-generate property-bool ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("ASCII_Hex_Digit", ASCII_HEX_DIGIT),
diff --git a/src/unicode_tables/property_names.rs b/src/unicode_tables/property_names.rs
index 19ca856..6393df2 100644
--- a/src/unicode_tables/property_names.rs
+++ b/src/unicode_tables/property_names.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate property-names ucd-13.0.0
+//   ucd-generate property-names ucd-13.0.0
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const PROPERTY_NAMES: &'static [(&'static str, &'static str)] = &[
     ("age", "Age"),
diff --git a/src/unicode_tables/property_values.rs b/src/unicode_tables/property_values.rs
index bff7d34..c46653a 100644
--- a/src/unicode_tables/property_values.rs
+++ b/src/unicode_tables/property_values.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate property-values ucd-13.0.0 --include gc,script,scx,age,gcb,wb,sb
+//   ucd-generate property-values ucd-13.0.0 --include gc,script,scx,age,gcb,wb,sb
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const PROPERTY_VALUES: &'static [(
     &'static str,
diff --git a/src/unicode_tables/script.rs b/src/unicode_tables/script.rs
index a48203e..cd86cba 100644
--- a/src/unicode_tables/script.rs
+++ b/src/unicode_tables/script.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate script ucd-13.0.0 --chars
+//   ucd-generate script ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("Adlam", ADLAM),
diff --git a/src/unicode_tables/script_extension.rs b/src/unicode_tables/script_extension.rs
index 1b6b4ff..7fca2af 100644
--- a/src/unicode_tables/script_extension.rs
+++ b/src/unicode_tables/script_extension.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate script-extension ucd-13.0.0 --chars
+//   ucd-generate script-extension ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("Adlam", ADLAM),
diff --git a/src/unicode_tables/sentence_break.rs b/src/unicode_tables/sentence_break.rs
index e4840f4..67d830f 100644
--- a/src/unicode_tables/sentence_break.rs
+++ b/src/unicode_tables/sentence_break.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate sentence-break ucd-13.0.0 --chars
+//   ucd-generate sentence-break ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("ATerm", ATERM),
diff --git a/src/unicode_tables/word_break.rs b/src/unicode_tables/word_break.rs
index 5c01342..bd23e00 100644
--- a/src/unicode_tables/word_break.rs
+++ b/src/unicode_tables/word_break.rs
@@ -1,8 +1,10 @@
 // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY:
 //
-//  ucd-generate word-break ucd-13.0.0 --chars
+//   ucd-generate word-break ucd-13.0.0 --chars
 //
-// ucd-generate 0.2.7 is available on crates.io.
+// Unicode version: 13.0.0.
+//
+// ucd-generate 0.2.8 is available on crates.io.
 
 pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[
     ("ALetter", ALETTER),