[rust] Bump json5 from 0.2.2 to 0.2.4

Test: CQ
CF-343: #done
Change-Id: Ibdde19ee295a340a51711681cdcb21e7ea4b91f4
diff --git a/rustc_deps/Cargo.lock b/rustc_deps/Cargo.lock
index a7a3bd6..b45fb28 100644
--- a/rustc_deps/Cargo.lock
+++ b/rustc_deps/Cargo.lock
@@ -524,7 +524,7 @@
  "hyper 0.12.24 (registry+https://github.com/rust-lang/crates.io-index)",
  "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "json5 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "json5 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -811,7 +811,7 @@
 
 [[package]]
 name = "json5"
-version = "0.2.2"
+version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "pest 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2246,7 +2246,7 @@
 "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
 "checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d"
 "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
-"checksum json5 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc7233a9c736f0b783f77c757c85b4345efd66f61da2f943132228b2383ab8cd"
+"checksum json5 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "038d7116122ecb8ad983bf4643b324bdaf5b87d05e8ba2df872e705a287c67c6"
 "checksum jsonway 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effcb749443c905fbaef49d214f8b1049c240e0adb7af9baa0e201e625e4f9de"
 "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
 "checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047"
diff --git a/rustc_deps/Cargo.toml b/rustc_deps/Cargo.toml
index 4f9a15d..3ec012f 100644
--- a/rustc_deps/Cargo.toml
+++ b/rustc_deps/Cargo.toml
@@ -34,7 +34,7 @@
 hyper = { version = "0.12.13", default-features = false }
 itertools = "0.7"
 itoa = "0.4"
-json5 = "0.2.2"
+json5 = "0.2.4"
 lazy_static = "1"
 libc = "0.2"
 log = { version = "0.4.4", features = ["std"] }
diff --git a/rustc_deps/vendor/json5/.cargo-checksum.json b/rustc_deps/vendor/json5/.cargo-checksum.json
index c6f3c8f..2484cb4 100644
--- a/rustc_deps/vendor/json5/.cargo-checksum.json
+++ b/rustc_deps/vendor/json5/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"1f3b4b727f635077eb44ad939b47642ddfc81a220832002796374862fa7ab60c","LICENCE":"61f16940693f0ff048d7090dbf514f50f7d867f912f3315d599e8c2f685dd0d2","README.md":"4d7c9d4a6fed408b21583d3c21e12bf4973635994040d4bb35a7b792e32ca674","src/de.rs":"db7890f2eb034059b4bf2dd673b165c47a28ef8e1ba9b41e9f411ec54703bf9e","src/error.rs":"d4f426d59463e62b86c9a7d85aca981356c80b5386be8e5dda927f7f91913a6d","src/json5.pest":"d7d4cec0845ff5961bcbe93f3f9b6ef4faa7c2551e9aa2d9ebb4251edb13bdc3","src/lib.rs":"47ded8e9c5651471088dabcd8bb7d4984055cc66e9075d607ef9c20defb2a022","src/ser.rs":"2bd6734b8b653c8971aed90bd37fe56dd797091466a619819ba2a7353a27c222","tests/adapted_from_js_reference.rs":"ae9b11af86196e3d7e16beb4704eaa193cd1141ce852414aecdf2f3182d14d3a","tests/assets/json5_dot_org_example.json5":"4d4f6674c50e76a6c5a038277fbca73637cc35b29507cceb017608008fdb9851","tests/common.rs":"7f5334cbff9369017ca346334022fa88495b00c9e546863ff70b1177eba06145","tests/de.rs":"c5508491d5bbadcc47359c4bdd8f94ebd415c8ff4d13533a375564b9e80b064e","tests/json5_dot_org_example.rs":"ad93a03fc3437389b44884fec4391288c242534f5c51bf66d45b9a904a914782","tests/ser.rs":"1eaf1b38d874c8f560ac514d006f67404bb8c71757be502d3882cb554aef6a33"},"package":"bc7233a9c736f0b783f77c757c85b4345efd66f61da2f943132228b2383ab8cd"}
\ No newline at end of file
+{"files":{"Cargo.toml":"e307d3f755015868f78d4d174239655052e88af074800b0a823aac5daff850e0","LICENCE":"61f16940693f0ff048d7090dbf514f50f7d867f912f3315d599e8c2f685dd0d2","README.md":"d01faff47470832d7d64d207c7cd2d8111ab1e7acf00ca38d5d5686c2a888cba","src/de.rs":"528b8d3a0abbc3850f31ed06142c53214931e7c2e5d2aa711601fcfe8caedc27","src/error.rs":"2018ac095641c5f00d391a4e4ae12d7854fb987d3ffef6d4fe29af2f0263dc18","src/json5.pest":"d7d4cec0845ff5961bcbe93f3f9b6ef4faa7c2551e9aa2d9ebb4251edb13bdc3","src/lib.rs":"ab0d327f5607ea178db47eea5b9b58969702d17c4e72dfd35102d73f7de59d14","src/ser.rs":"6b3944683bf8b6b5c08f48bfa469d5abf32468cdadedd7d9fbf23134b3cce0a9","tests/adapted_from_js_reference.rs":"d57dd2b848fb14f3fd309b8f83336cd9e762e9b49334e1ec1d4bde10e6f79007","tests/assets/json5_dot_org_example.json5":"4d4f6674c50e76a6c5a038277fbca73637cc35b29507cceb017608008fdb9851","tests/common.rs":"72c5ad1d16e2d787a4d236ab85fdca27f9471c344a4db0632f75a957748eec5f","tests/de.rs":"b01d2fd3b56b3cafb626273c3f6e4527b6d1f9aaeb2ea0af25e0ca1f97b92cb4","tests/json5_dot_org_example.rs":"238e7b5a548f76278449e01f55172a68e12c8b7caa4699bcd680290a4b3fa25b","tests/ser.rs":"44df5310d3253e4c978e7424d818669f0ce8bac664a49f51b76ac62a7fa9a4de"},"package":"038d7116122ecb8ad983bf4643b324bdaf5b87d05e8ba2df872e705a287c67c6"}
\ No newline at end of file
diff --git a/rustc_deps/vendor/json5/Cargo.toml b/rustc_deps/vendor/json5/Cargo.toml
index 2a2775d..f77132d 100644
--- a/rustc_deps/vendor/json5/Cargo.toml
+++ b/rustc_deps/vendor/json5/Cargo.toml
@@ -11,8 +11,9 @@
 # will likely look very different (and much more reasonable)
 
 [package]
+edition = "2018"
 name = "json5"
-version = "0.2.2"
+version = "0.2.4"
 authors = ["Callum Oakley <c.oakley108@gmail.com>"]
 description = "A Rust JSON5 serializer and deserializer which speaks Serde."
 readme = "README.md"
@@ -29,3 +30,6 @@
 version = "1.0"
 [dev-dependencies.serde_derive]
 version = "1.0"
+
+[dev-dependencies.serde_json]
+version = "1.0"
diff --git a/rustc_deps/vendor/json5/README.md b/rustc_deps/vendor/json5/README.md
index 416346f..e8fbbc8 100644
--- a/rustc_deps/vendor/json5/README.md
+++ b/rustc_deps/vendor/json5/README.md
@@ -20,9 +20,8 @@
 Read some config into a struct.
 
 ```rust
-extern crate json5;
-#[macro_use]
-extern crate serde_derive;
+use json5;
+use serde_derive::Deserialize;
 
 #[derive(Deserialize, Debug, PartialEq)]
 struct Config {
diff --git a/rustc_deps/vendor/json5/src/de.rs b/rustc_deps/vendor/json5/src/de.rs
index 1383d87..41a5a4c 100644
--- a/rustc_deps/vendor/json5/src/de.rs
+++ b/rustc_deps/vendor/json5/src/de.rs
@@ -1,12 +1,12 @@
 use pest::iterators::{Pair, Pairs};
 use pest::Parser as P;
+use pest_derive::Parser;
 use serde::de;
+use serde::forward_to_deserialize_any;
 use std::char;
 use std::f64;
 
-use error::{Error, Result};
-
-const _GRAMMAR: &str = include_str!("json5.pest");
+use crate::error::{Error, Result};
 
 #[derive(Parser)]
 #[grammar = "json5.pest"]
@@ -49,9 +49,15 @@
         let pair = self.pair.take().unwrap();
         match pair.as_rule() {
             Rule::null => visitor.visit_unit(),
-            Rule::boolean => visitor.visit_bool(parse_bool(pair)),
-            Rule::string | Rule::identifier => visitor.visit_string(parse_string(pair)),
-            Rule::number => visitor.visit_f64(parse_number(pair)),
+            Rule::boolean => visitor.visit_bool(parse_bool(&pair)),
+            Rule::string | Rule::identifier => visitor.visit_string(parse_string(pair)?),
+            Rule::number => {
+                if is_int(pair.as_str()) {
+                    visitor.visit_i64(parse_integer(&pair)?)
+                } else {
+                    visitor.visit_f64(parse_number(&pair)?)
+                }
+            }
             Rule::array => visitor.visit_seq(Seq {
                 pairs: pair.into_inner(),
             }),
@@ -83,7 +89,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_i8(parse_number(pair) as i8)
+        visitor.visit_i8(parse_number(&pair)? as i8)
     }
 
     fn deserialize_i16<V>(self, visitor: V) -> Result<V::Value>
@@ -91,7 +97,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_i16(parse_number(pair) as i16)
+        visitor.visit_i16(parse_number(&pair)? as i16)
     }
 
     fn deserialize_i32<V>(self, visitor: V) -> Result<V::Value>
@@ -99,7 +105,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_i32(parse_number(pair) as i32)
+        visitor.visit_i32(parse_number(&pair)? as i32)
     }
 
     fn deserialize_i64<V>(self, visitor: V) -> Result<V::Value>
@@ -107,7 +113,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_i64(parse_number(pair) as i64)
+        visitor.visit_i64(parse_number(&pair)? as i64)
     }
 
     fn deserialize_i128<V>(self, visitor: V) -> Result<V::Value>
@@ -115,7 +121,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_i128(parse_number(pair) as i128)
+        visitor.visit_i128(parse_number(&pair)? as i128)
     }
 
     fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value>
@@ -123,7 +129,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_u8(parse_number(pair) as u8)
+        visitor.visit_u8(parse_number(&pair)? as u8)
     }
 
     fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value>
@@ -131,7 +137,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_u16(parse_number(pair) as u16)
+        visitor.visit_u16(parse_number(&pair)? as u16)
     }
 
     fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value>
@@ -139,7 +145,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_u32(parse_number(pair) as u32)
+        visitor.visit_u32(parse_number(&pair)? as u32)
     }
 
     fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value>
@@ -147,7 +153,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_u64(parse_number(pair) as u64)
+        visitor.visit_u64(parse_number(&pair)? as u64)
     }
 
     fn deserialize_u128<V>(self, visitor: V) -> Result<V::Value>
@@ -155,7 +161,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_u128(parse_number(pair) as u128)
+        visitor.visit_u128(parse_number(&pair)? as u128)
     }
 
     fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value>
@@ -163,7 +169,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_f32(parse_number(pair) as f32)
+        visitor.visit_f32(parse_number(&pair)? as f32)
     }
 
     fn deserialize_f64<V>(self, visitor: V) -> Result<V::Value>
@@ -171,7 +177,7 @@
         V: de::Visitor<'de>,
     {
         let pair = self.pair.take().unwrap();
-        visitor.visit_f64(parse_number(pair))
+        visitor.visit_f64(parse_number(&pair)?)
     }
 
     fn deserialize_option<V>(self, visitor: V) -> Result<V::Value>
@@ -198,7 +204,7 @@
     }
 }
 
-fn parse_bool(pair: Pair<Rule>) -> bool {
+fn parse_bool(pair: &Pair<'_, Rule>) -> bool {
     match pair.as_str() {
         "true" => true,
         "false" => false,
@@ -206,22 +212,25 @@
     }
 }
 
-fn parse_string(pair: Pair<Rule>) -> String {
+fn parse_string(pair: Pair<'_, Rule>) -> Result<String> {
     pair.into_inner()
         .map(|component| match component.as_rule() {
-            Rule::char_literal => String::from(component.as_str()),
-            Rule::char_escape_sequence => parse_char_escape_sequence(component),
-            Rule::nul_escape_sequence => String::from("\u{0000}"),
+            Rule::char_literal => Ok(String::from(component.as_str())),
+            Rule::char_escape_sequence => Ok(parse_char_escape_sequence(&component)),
+            Rule::nul_escape_sequence => Ok(String::from("\u{0000}")),
             Rule::hex_escape_sequence | Rule::unicode_escape_sequence => {
-                char::from_u32(parse_hex(component.as_str()))
-                    .unwrap()
-                    .to_string()
+                let hex_escape = parse_hex(component.as_str())?;
+                match char::from_u32(hex_escape) {
+                    Some(s) => Ok(s.to_string()),
+                    None => Err(de::Error::custom("error parsing hex prefix")),
+                }
             }
             _ => unreachable!(),
-        }).collect()
+        })
+        .collect()
 }
 
-fn parse_char_escape_sequence(pair: Pair<Rule>) -> String {
+fn parse_char_escape_sequence(pair: &Pair<'_, Rule>) -> String {
     String::from(match pair.as_str() {
         "b" => "\u{0008}",
         "f" => "\u{000C}",
@@ -233,18 +242,41 @@
     })
 }
 
-fn parse_number(pair: Pair<Rule>) -> f64 {
+fn parse_number(pair: &Pair<'_, Rule>) -> Result<f64> {
     match pair.as_str() {
-        "Infinity" => f64::INFINITY,
-        "-Infinity" => f64::NEG_INFINITY,
-        "NaN" | "-NaN" => f64::NAN,
-        s if is_hex_literal(s) => parse_hex(&s[2..]) as f64,
-        s => s.parse().unwrap(),
+        "Infinity" => Ok(f64::INFINITY),
+        "-Infinity" => Ok(f64::NEG_INFINITY),
+        "NaN" | "-NaN" => Ok(f64::NAN),
+        s if is_hex_literal(s) => parse_hex(&s[2..]).map(f64::from),
+        s => {
+            if let Ok(r) = s.parse::<f64>() {
+                if r.is_finite() {
+                    Ok(r)
+                } else {
+                    Err(de::Error::custom("error parsing number: too large"))
+                }
+            } else {
+                Err(de::Error::custom("error parsing number"))
+            }
+        }
     }
 }
 
-fn parse_hex(s: &str) -> u32 {
-    u32::from_str_radix(s, 16).unwrap()
+fn parse_integer(pair: &Pair<'_, Rule>) -> Result<i64> {
+    match pair.as_str() {
+        s if is_hex_literal(s) => Ok(parse_hex(&s[2..])? as i64),
+        s => s
+            .parse()
+            .or(Err(de::Error::custom("error parsing integer"))),
+    }
+}
+
+fn is_int(s: &str) -> bool {
+    !s.contains('.') && (is_hex_literal(s) || (!s.contains('e') && !s.contains('E')))
+}
+
+fn parse_hex(s: &str) -> Result<u32> {
+    u32::from_str_radix(s, 16).or(Err(de::Error::custom("error parsing hex")))
 }
 
 fn is_hex_literal(s: &str) -> bool {
diff --git a/rustc_deps/vendor/json5/src/error.rs b/rustc_deps/vendor/json5/src/error.rs
index d157c32..7338edb 100644
--- a/rustc_deps/vendor/json5/src/error.rs
+++ b/rustc_deps/vendor/json5/src/error.rs
@@ -1,9 +1,8 @@
 use pest;
 use serde::{de, ser};
-use std;
 use std::fmt::{self, Display};
 
-use de::Rule;
+use crate::de::Rule;
 
 /// Alias for a `Result` with error type `json5::Error`
 pub type Result<T> = std::result::Result<T, Error>;
@@ -36,7 +35,7 @@
 }
 
 impl Display for Error {
-    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
         formatter.write_str(std::error::Error::description(self))
     }
 }
diff --git a/rustc_deps/vendor/json5/src/lib.rs b/rustc_deps/vendor/json5/src/lib.rs
index bbca05e..8430107 100644
--- a/rustc_deps/vendor/json5/src/lib.rs
+++ b/rustc_deps/vendor/json5/src/lib.rs
@@ -28,9 +28,7 @@
 //! text into a value of that type with [`from_str`][].
 //!
 //! ```rust
-//! extern crate json5;
-//! #[macro_use]
-//! extern crate serde_derive;
+//! use serde_derive::Deserialize;
 //!
 //! #[derive(Deserialize, Debug, PartialEq)]
 //! struct Config {
@@ -71,9 +69,7 @@
 //! output style (single over double quotes, trailing commas, indentation etc.).
 //!
 //! ```rust
-//! extern crate json5;
-//! #[macro_use]
-//! extern crate serde_derive;
+//! use serde_derive::Serialize;
 //!
 //! #[derive(Serialize, PartialEq, Debug)]
 //! #[serde(untagged)]
@@ -124,16 +120,12 @@
 //! [byte arrays]: https://serde.rs/data-model.html#types
 
 #![warn(missing_docs)]
-extern crate pest;
-#[macro_use]
-extern crate serde;
-#[macro_use]
-extern crate pest_derive;
+#![warn(rust_2018_idioms)]
 
 mod de;
 mod error;
 mod ser;
 
-pub use de::from_str;
-pub use error::{Error, Result};
-pub use ser::to_string;
+pub use crate::de::from_str;
+pub use crate::error::{Error, Result};
+pub use crate::ser::to_string;
diff --git a/rustc_deps/vendor/json5/src/ser.rs b/rustc_deps/vendor/json5/src/ser.rs
index caa2d51..e2c0764 100644
--- a/rustc_deps/vendor/json5/src/ser.rs
+++ b/rustc_deps/vendor/json5/src/ser.rs
@@ -1,6 +1,6 @@
 use serde::ser::{self, Serialize};
 
-use error::{Error, Result};
+use crate::error::{Error, Result};
 
 /// Attempts to serialize the input as a JSON5 string (actually a JSON string).
 pub fn to_string<T>(value: &T) -> Result<String>
@@ -20,7 +20,7 @@
 }
 
 impl Serializer {
-    fn call_to_string<T>(&mut self, v: T) -> Result<()>
+    fn call_to_string<T>(&mut self, v: &T) -> Result<()>
     where
         T: ToString,
     {
@@ -42,47 +42,47 @@
     type SerializeStructVariant = Self;
 
     fn serialize_bool(self, v: bool) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_i8(self, v: i8) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_i16(self, v: i16) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_i32(self, v: i32) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_i64(self, v: i64) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_u8(self, v: u8) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_u16(self, v: u16) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_u32(self, v: u32) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_u64(self, v: u64) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_f32(self, v: f32) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_f64(self, v: f64) -> Result<()> {
-        self.call_to_string(v)
+        self.call_to_string(&v)
     }
 
     fn serialize_char(self, v: char) -> Result<()> {
@@ -345,5 +345,6 @@
             '\n' => vec!['\\', 'n'],
             '\\' => vec!['\\', '\\'],
             c => vec![c],
-        }).collect()
+        })
+        .collect()
 }
diff --git a/rustc_deps/vendor/json5/tests/adapted_from_js_reference.rs b/rustc_deps/vendor/json5/tests/adapted_from_js_reference.rs
index 5ce952f..3761628 100644
--- a/rustc_deps/vendor/json5/tests/adapted_from_js_reference.rs
+++ b/rustc_deps/vendor/json5/tests/adapted_from_js_reference.rs
@@ -1,11 +1,9 @@
-extern crate json5;
-
 use std::collections::HashMap;
 use std::f64;
 
 mod common;
 
-use common::{deserializes_to, deserializes_to_nan};
+use crate::common::{deserializes_to, deserializes_to_nan};
 
 // The following tests are adapted from https://github.com/json5/json5/blob/d828908384ce8dc40d8dde017ae82afd1b952d79/test/parse.js
 
diff --git a/rustc_deps/vendor/json5/tests/common.rs b/rustc_deps/vendor/json5/tests/common.rs
index 6499e20..7ba0dab 100644
--- a/rustc_deps/vendor/json5/tests/common.rs
+++ b/rustc_deps/vendor/json5/tests/common.rs
@@ -1,5 +1,5 @@
-extern crate json5;
-extern crate serde;
+use json5;
+use serde;
 
 use std::f64;
 
@@ -23,6 +23,17 @@
 }
 
 #[allow(dead_code)]
+pub fn deserializes_with_error<'a, T>(s: &'a str, _: T, error_expected: &'a str)
+where
+    T: ::std::fmt::Debug + ::std::cmp::PartialEq + serde::de::Deserialize<'a>,
+{
+    match json5::from_str::<T>(s) {
+        Ok(val) => panic!(format!("error expected!, got {:?}", val)),
+        Err(err) => assert_eq!(format!("{}", err), error_expected),
+    }
+}
+
+#[allow(dead_code)]
 pub fn serializes_to<T>(v: T, s: &'static str)
 where
     T: ::std::fmt::Debug + ::std::cmp::PartialEq + serde::ser::Serialize,
diff --git a/rustc_deps/vendor/json5/tests/de.rs b/rustc_deps/vendor/json5/tests/de.rs
index bdbaabc..4d6b0e4 100644
--- a/rustc_deps/vendor/json5/tests/de.rs
+++ b/rustc_deps/vendor/json5/tests/de.rs
@@ -1,12 +1,11 @@
-extern crate json5;
-#[macro_use]
-extern crate serde_derive;
+use json5;
+use serde_derive::Deserialize;
 
 use std::collections::HashMap;
 
 mod common;
 
-use common::deserializes_to;
+use crate::common::{deserializes_to, deserializes_with_error};
 
 #[test]
 fn deserializes_bool() {
@@ -356,3 +355,39 @@
 
     deserializes_to("{ a: 1, ignored: 42, b: 2 }", S { a: 1, b: 2 });
 }
+
+#[test]
+fn deserializes_json_values() {
+    // As int if json uses int type.
+    deserializes_to("0x2a", serde_json::json!(42));
+    deserializes_to("0x2A", serde_json::json!(42));
+    deserializes_to("0X2A", serde_json::json!(42));
+    deserializes_to("42", serde_json::json!(42));
+
+    // As float if json calls for explicit float type.
+    deserializes_to("42.", serde_json::json!(42.));
+    deserializes_to("42e0", serde_json::json!(42.));
+    deserializes_to("4e2", serde_json::json!(400.));
+    deserializes_to("4e2", serde_json::json!(4e2));
+}
+
+#[test]
+fn deserialize_error_messages() {
+    #[derive(Deserialize, PartialEq, Debug)]
+    enum E {
+        A,
+    }
+    deserializes_with_error("'B'", E::A, "unknown variant `B`, expected `A`");
+
+    deserializes_with_error("0xffffffffff", 42, "error parsing hex");
+
+    let mut over_i64 = i64::max_value().to_string();
+    over_i64.push_str("0");
+    deserializes_with_error(
+        over_i64.as_str(),
+        serde_json::json!(42),
+        "error parsing integer",
+    );
+
+    deserializes_with_error("1e309", 42, "error parsing number: too large");
+}
diff --git a/rustc_deps/vendor/json5/tests/json5_dot_org_example.rs b/rustc_deps/vendor/json5/tests/json5_dot_org_example.rs
index b10c075..990bbce 100644
--- a/rustc_deps/vendor/json5/tests/json5_dot_org_example.rs
+++ b/rustc_deps/vendor/json5/tests/json5_dot_org_example.rs
@@ -1,13 +1,12 @@
-extern crate json5;
+use json5;
 
+use serde_derive::Deserialize;
 use std::fs::File;
 use std::io::prelude::*;
-#[macro_use]
-extern crate serde_derive;
 
 mod common;
 
-use common::deserializes_to;
+use crate::common::deserializes_to;
 
 #[derive(Deserialize, PartialEq, Debug)]
 #[serde(rename_all = "camelCase")]
diff --git a/rustc_deps/vendor/json5/tests/ser.rs b/rustc_deps/vendor/json5/tests/ser.rs
index 64e7ab8..f460a4a 100644
--- a/rustc_deps/vendor/json5/tests/ser.rs
+++ b/rustc_deps/vendor/json5/tests/ser.rs
@@ -1,12 +1,11 @@
-extern crate json5;
-#[macro_use]
-extern crate serde_derive;
+use json5;
+use serde_derive::Serialize;
 
 use std::collections::HashMap;
 
 mod common;
 
-use common::serializes_to;
+use crate::common::serializes_to;
 
 #[test]
 fn serializes_bool() {