Upgrade serde to 1.0.158

This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update rust/crates/serde
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md

Test: TreeHugger
Bug: 276463929
Change-Id: I72e91b6393f94ae11699d65fccb92f8b85a7d46d
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index e57ffb4..889a79f 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
 {
   "git": {
-    "sha1": "ccf9c6fc072378ea8c4f15df1024e258d35d6e61"
+    "sha1": "e3058105f0b1a64018577b12ea19cd255644a17b"
   },
   "path_in_vcs": "serde"
 }
\ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 7e5d067..0a04940 100644
--- a/Android.bp
+++ b/Android.bp
@@ -43,7 +43,7 @@
     host_supported: true,
     crate_name: "serde",
     cargo_env_compat: true,
-    cargo_pkg_version: "1.0.152",
+    cargo_pkg_version: "1.0.158",
     srcs: ["src/lib.rs"],
     edition: "2015",
     features: [
@@ -97,7 +97,7 @@
     host_supported: true,
     crate_name: "serde",
     cargo_env_compat: true,
-    cargo_pkg_version: "1.0.152",
+    cargo_pkg_version: "1.0.158",
     srcs: ["src/lib.rs"],
     test_suites: ["general-tests"],
     auto_gen_config: true,
diff --git a/Cargo.toml b/Cargo.toml
index 93acff3..e1e3e26 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,9 +10,9 @@
 # See Cargo.toml.orig for the original contents.
 
 [package]
-rust-version = "1.13"
+rust-version = "1.19"
 name = "serde"
-version = "1.0.152"
+version = "1.0.158"
 authors = [
     "Erick Tryzelaar <[email protected]>",
     "David Tolnay <[email protected]>",
@@ -42,20 +42,21 @@
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/serde-rs/serde"
 
+[package.metadata.docs.rs]
+features = ["derive"]
+targets = ["x86_64-unknown-linux-gnu"]
+
 [package.metadata.playground]
 features = [
     "derive",
     "rc",
 ]
 
-[package.metadata.docs.rs]
-targets = ["x86_64-unknown-linux-gnu"]
-
 [lib]
 doc-scrape-examples = false
 
 [dependencies.serde_derive]
-version = "=1.0.152"
+version = "=1.0.158"
 optional = true
 
 [dev-dependencies.serde_derive]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 9c3bc58..db7e6b1 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "serde"
-version = "1.0.152" # remember to update html_root_url and serde_derive dependency
+version = "1.0.158" # remember to update html_root_url and serde_derive dependency
 authors = ["Erick Tryzelaar <[email protected]>", "David Tolnay <[email protected]>"]
 build = "build.rs"
 categories = ["encoding", "no-std"]
@@ -12,10 +12,10 @@
 license = "MIT OR Apache-2.0"
 readme = "crates-io.md"
 repository = "https://github.com/serde-rs/serde"
-rust-version = "1.13"
+rust-version = "1.19"
 
 [dependencies]
-serde_derive = { version = "=1.0.152", optional = true, path = "../serde_derive" }
+serde_derive = { version = "=1.0.158", optional = true, path = "../serde_derive" }
 
 [dev-dependencies]
 serde_derive = { version = "1.0", path = "../serde_derive" }
@@ -27,6 +27,7 @@
 features = ["derive", "rc"]
 
 [package.metadata.docs.rs]
+features = ["derive"]
 targets = ["x86_64-unknown-linux-gnu"]
 
 
diff --git a/LICENSE-APACHE b/LICENSE-APACHE
index 16fe87b..1b5ec8b 100644
--- a/LICENSE-APACHE
+++ b/LICENSE-APACHE
@@ -174,28 +174,3 @@
    of your accepting any such warranty or additional liability.
 
 END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
-   To apply the Apache License to your work, attach the following
-   boilerplate notice, with the fields enclosed by brackets "[]"
-   replaced with your own identifying information. (Don't include
-   the brackets!)  The text should be enclosed in the appropriate
-   comment syntax for the file format. We also recommend that a
-   file or class name and description of purpose be included on the
-   same "printed page" as the copyright notice for easier
-   identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-	http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/METADATA b/METADATA
index eb4163f..13623c7 100644
--- a/METADATA
+++ b/METADATA
@@ -11,13 +11,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/serde/serde-1.0.152.crate"
+    value: "https://static.crates.io/crates/serde/serde-1.0.158.crate"
   }
-  version: "1.0.152"
+  version: "1.0.158"
   license_type: NOTICE
   last_upgrade_date {
     year: 2023
-    month: 2
-    day: 6
+    month: 3
+    day: 20
   }
 }
diff --git a/README.md b/README.md
index c3f6575..d53e572 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,13 @@
-# Serde &emsp; [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.13+]][Rust 1.13] [![serde_derive: rustc 1.31+]][Rust 1.31]
+# Serde &emsp; [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.19+]][Rust 1.19] [![serde_derive: rustc 1.56+]][Rust 1.56]
 
 [Build Status]: https://img.shields.io/github/actions/workflow/status/serde-rs/serde/ci.yml?branch=master
 [actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster
 [Latest Version]: https://img.shields.io/crates/v/serde.svg
 [crates.io]: https://crates.io/crates/serde
-[serde: rustc 1.13+]: https://img.shields.io/badge/serde-rustc_1.13+-lightgray.svg
-[serde_derive: rustc 1.31+]: https://img.shields.io/badge/serde_derive-rustc_1.31+-lightgray.svg
-[Rust 1.13]: https://blog.rust-lang.org/2016/11/10/Rust-1.13.html
-[Rust 1.31]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html
+[serde: rustc 1.19+]: https://img.shields.io/badge/serde-rustc_1.19+-lightgray.svg
+[serde_derive: rustc 1.56+]: https://img.shields.io/badge/serde_derive-rustc_1.56+-lightgray.svg
+[Rust 1.19]: https://blog.rust-lang.org/2017/07/20/Rust-1.19.html
+[Rust 1.56]: https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html
 
 **Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.**
 
diff --git a/build.rs b/build.rs
index ccbddd2..929d8e1 100644
--- a/build.rs
+++ b/build.rs
@@ -78,11 +78,6 @@
         println!("cargo:rustc-cfg=no_num_nonzero");
     }
 
-    // Current minimum supported version of serde_derive crate is Rust 1.31.
-    if minor < 31 {
-        println!("cargo:rustc-cfg=no_serde_derive");
-    }
-
     // TryFrom, Atomic types, non-zero signed integers, and SystemTime::checked_add
     // stabilized in Rust 1.34:
     // https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto
@@ -94,6 +89,11 @@
         println!("cargo:rustc-cfg=no_relaxed_trait_bounds");
     }
 
+    // Current minimum supported version of serde_derive crate is Rust 1.56.
+    if minor < 56 {
+        println!("cargo:rustc-cfg=no_serde_derive");
+    }
+
     // Support for #[cfg(target_has_atomic = "...")] stabilized in Rust 1.60.
     if minor < 60 {
         println!("cargo:rustc-cfg=no_target_has_atomic");
@@ -114,6 +114,12 @@
             println!("cargo:rustc-cfg=no_std_atomic");
         }
     }
+
+    // Support for core::ffi::CStr and alloc::ffi::CString stabilized in Rust 1.64.
+    // https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html#c-compatible-ffi-types-in-core-and-alloc
+    if minor < 64 {
+        println!("cargo:rustc-cfg=no_core_cstr");
+    }
 }
 
 fn rustc_minor_version() -> Option<u32> {
diff --git a/src/de/impls.rs b/src/de/impls.rs
index a257d9e..a2e2c48 100644
--- a/src/de/impls.rs
+++ b/src/de/impls.rs
@@ -666,10 +666,10 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))]
 struct CStringVisitor;
 
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))]
 impl<'de> Visitor<'de> for CStringVisitor {
     type Value = CString;
 
@@ -720,7 +720,7 @@
     }
 }
 
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))]
 impl<'de> Deserialize<'de> for CString {
     fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
     where
@@ -747,7 +747,10 @@
     }
 }
 
-#[cfg(all(feature = "std", not(no_de_boxed_c_str)))]
+#[cfg(all(
+    any(feature = "std", all(not(no_core_cstr), feature = "alloc")),
+    not(no_de_boxed_c_str)
+))]
 forwarded_impl!((), Box<CStr>, CString::into_boxed_c_str);
 
 #[cfg(not(no_core_reverse))]
diff --git a/src/lib.rs b/src/lib.rs
index e4bc7c8..8ba1473 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,6 +45,8 @@
 //!   definition.
 //! - [JSON5], a superset of JSON including some productions from ES5.
 //! - [URL] query strings, in the x-www-form-urlencoded format.
+//! - [Starlark], the format used for describing build targets by the Bazel and
+//!   Buck build systems. *(serialization only)*
 //! - [Envy], a way to deserialize environment variables into Rust structs.
 //!   *(deserialization only)*
 //! - [Envy Store], a way to deserialize [AWS Parameter Store] parameters into
@@ -74,6 +76,7 @@
 //! [Avro]: https://docs.rs/apache-avro
 //! [JSON5]: https://github.com/callum-oakley/json5-rs
 //! [URL]: https://docs.rs/serde_qs
+//! [Starlark]: https://github.com/dtolnay/serde-starlark
 //! [Envy]: https://github.com/softprops/envy
 //! [Envy Store]: https://github.com/softprops/envy-store
 //! [Cargo]: https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -90,7 +93,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 // Serde types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/serde/1.0.152")]
+#![doc(html_root_url = "https://docs.rs/serde/1.0.158")]
 // Support using Serde without the standard library!
 #![cfg_attr(not(feature = "std"), no_std)]
 // Unstable functionality only if the user asks for it. For tracking and
@@ -127,6 +130,7 @@
         derive_partial_eq_without_eq,
         enum_glob_use,
         explicit_auto_deref,
+        let_underscore_untyped,
         map_err_ignore,
         new_without_default,
         result_unit_err,
@@ -215,13 +219,23 @@
     #[cfg(feature = "std")]
     pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque};
 
+    #[cfg(all(not(no_core_cstr), not(feature = "std")))]
+    pub use core::ffi::CStr;
+    #[cfg(feature = "std")]
+    pub use std::ffi::CStr;
+
+    #[cfg(all(not(no_core_cstr), feature = "alloc", not(feature = "std")))]
+    pub use alloc::ffi::CString;
+    #[cfg(feature = "std")]
+    pub use std::ffi::CString;
+
     #[cfg(feature = "std")]
     pub use std::{error, net};
 
     #[cfg(feature = "std")]
     pub use std::collections::{HashMap, HashSet};
     #[cfg(feature = "std")]
-    pub use std::ffi::{CStr, CString, OsStr, OsString};
+    pub use std::ffi::{OsStr, OsString};
     #[cfg(feature = "std")]
     pub use std::hash::{BuildHasher, Hash};
     #[cfg(feature = "std")]
@@ -324,9 +338,10 @@
 #[allow(unused_imports)]
 #[macro_use]
 extern crate serde_derive;
+
+/// Derive macro available if serde is built with `features = ["derive"]`.
 #[cfg(feature = "serde_derive")]
-#[doc(hidden)]
-pub use serde_derive::*;
+pub use serde_derive::{Deserialize, Serialize};
 
 #[cfg(all(not(no_serde_derive), any(feature = "std", feature = "alloc")))]
 mod actually_private {
diff --git a/src/ser/impls.rs b/src/ser/impls.rs
index da26772..a79326e 100644
--- a/src/ser/impls.rs
+++ b/src/ser/impls.rs
@@ -72,7 +72,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", not(no_core_cstr)))]
 impl Serialize for CStr {
     #[inline]
     fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
@@ -83,7 +83,7 @@
     }
 }
 
-#[cfg(feature = "std")]
+#[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))]
 impl Serialize for CString {
     #[inline]
     fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>