Snap for 8730993 from 777878a84fcf09d1a133a5d88fa304adb2253d0d to mainline-tzdata3-release

Change-Id: Ibdd1f7d0f111ebffe682c56925e83e1f49c47d37
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 724f674..f3ad3ab 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,5 @@
 {
   "git": {
-    "sha1": "fc1e3250219170e31cddb8857a276cba7dd08d44"
-  },
-  "path_in_vcs": "futures-core"
-}
\ No newline at end of file
+    "sha1": "c91f8691672c7401b1923ab00bf138975c99391a"
+  }
+}
diff --git a/Android.bp b/Android.bp
index 898123d..0c9c344 100644
--- a/Android.bp
+++ b/Android.bp
@@ -37,12 +37,37 @@
     ],
 }
 
+rust_defaults {
+    name: "futures-core_defaults",
+    crate_name: "futures_core",
+    srcs: ["src/lib.rs"],
+    test_suites: ["general-tests"],
+    auto_gen_config: true,
+    edition: "2018",
+    features: [
+        "alloc",
+        "default",
+        "std",
+    ],
+}
+
+rust_test_host {
+    name: "futures-core_host_test_src_lib",
+    defaults: ["futures-core_defaults"],
+    test_options: {
+        unit_test: true,
+    },
+}
+
+rust_test {
+    name: "futures-core_device_test_src_lib",
+    defaults: ["futures-core_defaults"],
+}
+
 rust_library {
     name: "libfutures_core",
     host_supported: true,
     crate_name: "futures_core",
-    cargo_env_compat: true,
-    cargo_pkg_version: "0.3.21",
     srcs: ["src/lib.rs"],
     edition: "2018",
     features: [
@@ -52,7 +77,6 @@
     ],
     apex_available: [
         "//apex_available:platform",
-        "com.android.bluetooth",
         "com.android.resolv",
         "com.android.virt",
     ],
diff --git a/Cargo.toml b/Cargo.toml
index 32fedcb..b27e88f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,30 +3,26 @@
 # When uploading crates to the registry Cargo will automatically
 # "normalize" Cargo.toml files for maximal compatibility
 # with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
+# to registry (e.g., crates.io) dependencies
 #
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
 
 [package]
 edition = "2018"
-rust-version = "1.36"
 name = "futures-core"
-version = "0.3.21"
-description = """
-The core traits and types in for the `futures` library.
-"""
+version = "0.3.13"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+description = "The core traits and types in for the `futures` library.\n"
 homepage = "https://rust-lang.github.io/futures-rs"
+documentation = "https://docs.rs/futures-core/0.3"
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/futures-rs"
-
 [package.metadata.docs.rs]
 all-features = true
-rustdoc-args = [
-    "--cfg",
-    "docsrs",
-]
+rustdoc-args = ["--cfg", "docsrs"]
 
 [dependencies]
 
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 4a360f8..55601db 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,11 +1,12 @@
 [package]
 name = "futures-core"
-version = "0.3.21"
 edition = "2018"
-rust-version = "1.36"
+version = "0.3.13"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/futures-rs"
 homepage = "https://rust-lang.github.io/futures-rs"
+documentation = "https://docs.rs/futures-core/0.3"
 description = """
 The core traits and types in for the `futures` library.
 """
@@ -15,8 +16,9 @@
 std = ["alloc"]
 alloc = []
 
-# These features are no longer used.
-# TODO: remove in the next major version.
+# Unstable features
+# These features are outside of the normal semver guarantees and require the
+# `unstable` feature as an explicit opt-in to unstable API.
 unstable = []
 cfg-target-has-atomic = []
 
diff --git a/METADATA b/METADATA
index 6829297..39e1a12 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/futures-core/futures-core-0.3.21.crate"
+    value: "https://static.crates.io/crates/futures-core/futures-core-0.3.13.crate"
   }
-  version: "0.3.21"
+  version: "0.3.13"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2022
+    year: 2021
     month: 3
-    day: 1
+    day: 4
   }
 }
diff --git a/README.md b/README.md
deleted file mode 100644
index 96e0e06..0000000
--- a/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# futures-core
-
-The core traits and types in for the `futures` library.
-
-## Usage
-
-Add this to your `Cargo.toml`:
-
-```toml
-[dependencies]
-futures-core = "0.3"
-```
-
-The current `futures-core` requires Rust 1.36 or later.
-
-## License
-
-Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or
-[MIT license](LICENSE-MIT) at your option.
-
-Unless you explicitly state otherwise, any contribution intentionally submitted
-for inclusion in the work by you, as defined in the Apache-2.0 license, shall
-be dual licensed as above, without any additional terms or conditions.
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 5ef61de..8052406 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,45 +1,59 @@
 // Generated by update_crate_tests.py for tests that depend on this crate.
 {
-  "imports": [
-    {
-      "path": "external/rust/crates/anyhow"
-    },
-    {
-      "path": "external/rust/crates/futures-util"
-    },
-    {
-      "path": "external/rust/crates/tokio"
-    },
-    {
-      "path": "external/rust/crates/tokio-test"
-    }
-  ],
   "presubmit": [
     {
-      "name": "ZipFuseTest"
+      "name": "anyhow_device_test_tests_test_repr"
     },
     {
-      "name": "authfs_device_test_src_lib"
+      "name": "anyhow_device_test_tests_test_convert"
     },
     {
-      "name": "doh_unit_test"
+      "name": "anyhow_device_test_src_lib"
     },
     {
-      "name": "virtualizationservice_device_test"
-    }
-  ],
-  "presubmit-rust": [
-    {
-      "name": "ZipFuseTest"
+      "name": "anyhow_device_test_tests_test_chain"
     },
     {
-      "name": "authfs_device_test_src_lib"
+      "name": "anyhow_device_test_tests_test_boxed"
     },
     {
-      "name": "doh_unit_test"
+      "name": "tokio-test_device_test_tests_macros"
     },
     {
-      "name": "virtualizationservice_device_test"
+      "name": "tokio-test_device_test_tests_block_on"
+    },
+    {
+      "name": "anyhow_device_test_tests_test_downcast"
+    },
+    {
+      "name": "anyhow_device_test_tests_test_context"
+    },
+    {
+      "name": "futures-core_device_test_src_lib"
+    },
+    {
+      "name": "futures-util_device_test_src_lib"
+    },
+    {
+      "name": "tokio-test_device_test_tests_io"
+    },
+    {
+      "name": "tokio-test_device_test_src_lib"
+    },
+    {
+      "name": "anyhow_device_test_tests_test_macros"
+    },
+    {
+      "name": "anyhow_device_test_tests_test_ffi"
+    },
+    {
+      "name": "anyhow_device_test_tests_test_fmt"
+    },
+    {
+      "name": "anyhow_device_test_tests_test_autotrait"
+    },
+    {
+      "name": "anyhow_device_test_tests_test_source"
     }
   ]
 }
diff --git a/build.rs b/build.rs
deleted file mode 100644
index 05e0496..0000000
--- a/build.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// The rustc-cfg listed below are considered public API, but it is *unstable*
-// and outside of the normal semver guarantees:
-//
-// - `futures_no_atomic_cas`
-//      Assume the target does *not* support atomic CAS operations.
-//      This is usually detected automatically by the build script, but you may
-//      need to enable it manually when building for custom targets or using
-//      non-cargo build systems that don't run the build script.
-//
-// With the exceptions mentioned above, the rustc-cfg emitted by the build
-// script are *not* public API.
-
-#![warn(rust_2018_idioms, single_use_lifetimes)]
-
-use std::env;
-
-include!("no_atomic_cas.rs");
-
-fn main() {
-    let target = match env::var("TARGET") {
-        Ok(target) => target,
-        Err(e) => {
-            println!(
-                "cargo:warning={}: unable to get TARGET environment variable: {}",
-                env!("CARGO_PKG_NAME"),
-                e
-            );
-            return;
-        }
-    };
-
-    // Note that this is `no_*`, not `has_*`. This allows treating
-    // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
-    // run. This is needed for compatibility with non-cargo build systems that
-    // don't run the build script.
-    if NO_ATOMIC_CAS.contains(&&*target) {
-        println!("cargo:rustc-cfg=futures_no_atomic_cas");
-    }
-
-    println!("cargo:rerun-if-changed=no_atomic_cas.rs");
-}
diff --git a/cargo2android.json b/cargo2android.json
index 5b266a6..44e747c 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,13 +1,12 @@
 {
   "apex-available": [
     "//apex_available:platform",
-    "com.android.bluetooth",
     "com.android.resolv",
     "com.android.virt"
   ],
+  "min_sdk_version": "29",
   "dependencies": true,
   "device": true,
-  "min-sdk-version": "29",
   "run": true,
   "tests": true
-}
+}
\ No newline at end of file
diff --git a/no_atomic_cas.rs b/no_atomic_cas.rs
deleted file mode 100644
index 9b05d4b..0000000
--- a/no_atomic_cas.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// This file is @generated by no_atomic_cas.sh.
-// It is not intended for manual editing.
-
-const NO_ATOMIC_CAS: &[&str] = &[
-    "avr-unknown-gnu-atmega328",
-    "bpfeb-unknown-none",
-    "bpfel-unknown-none",
-    "msp430-none-elf",
-    "riscv32i-unknown-none-elf",
-    "riscv32imc-unknown-none-elf",
-    "thumbv4t-none-eabi",
-    "thumbv6m-none-eabi",
-];
diff --git a/src/future.rs b/src/future.rs
index 7540cd0..d9327c0 100644
--- a/src/future.rs
+++ b/src/future.rs
@@ -67,12 +67,14 @@
     /// This method is a stopgap for a compiler limitation that prevents us from
     /// directly inheriting from the `Future` trait; in the future it won't be
     /// needed.
-    fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<Self::Ok, Self::Error>>;
+    fn try_poll(
+        self: Pin<&mut Self>,
+        cx: &mut Context<'_>,
+    ) -> Poll<Result<Self::Ok, Self::Error>>;
 }
 
 impl<F, T, E> TryFuture for F
-where
-    F: ?Sized + Future<Output = Result<T, E>>,
+    where F: ?Sized + Future<Output = Result<T, E>>
 {
     type Ok = T;
     type Error = E;
@@ -85,8 +87,8 @@
 
 #[cfg(feature = "alloc")]
 mod if_alloc {
-    use super::*;
     use alloc::boxed::Box;
+    use super::*;
 
     impl<F: FusedFuture + ?Sized + Unpin> FusedFuture for Box<F> {
         fn is_terminated(&self) -> bool {
diff --git a/src/lib.rs b/src/lib.rs
index 9c31d8d..ec14adb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,27 +1,32 @@
 //! Core traits and types for asynchronous operations in Rust.
 
+#![cfg_attr(feature = "cfg-target-has-atomic", feature(cfg_target_has_atomic))]
+
 #![cfg_attr(not(feature = "std"), no_std)]
-#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub)]
+
+#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms, unreachable_pub)]
 // It cannot be included in the published code because this lints have false positives in the minimum required version.
 #![cfg_attr(test, warn(single_use_lifetimes))]
-#![doc(test(
-    no_crate_inject,
-    attr(
-        deny(warnings, rust_2018_idioms, single_use_lifetimes),
-        allow(dead_code, unused_assignments, unused_variables)
-    )
-))]
+#![warn(clippy::all)]
+#![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
+
+#[cfg(all(feature = "cfg-target-has-atomic", not(feature = "unstable")))]
+compile_error!("The `cfg-target-has-atomic` feature requires the `unstable` feature as an explicit opt-in to unstable features");
 
 #[cfg(feature = "alloc")]
 extern crate alloc;
 
 pub mod future;
-#[doc(no_inline)]
-pub use self::future::{FusedFuture, Future, TryFuture};
+#[doc(hidden)] pub use self::future::{Future, FusedFuture, TryFuture};
 
 pub mod stream;
-#[doc(no_inline)]
-pub use self::stream::{FusedStream, Stream, TryStream};
+#[doc(hidden)] pub use self::stream::{Stream, FusedStream, TryStream};
 
 #[macro_use]
 pub mod task;
+
+// Not public API.
+#[doc(hidden)]
+pub mod __private {
+    pub use core::task::Poll;
+}
diff --git a/src/stream.rs b/src/stream.rs
index ad5350b..4a13e3b 100644
--- a/src/stream.rs
+++ b/src/stream.rs
@@ -63,7 +63,10 @@
     /// calls.
     ///
     /// [`fuse`]: https://docs.rs/futures/0.3/futures/stream/trait.StreamExt.html#method.fuse
-    fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>;
+    fn poll_next(
+        self: Pin<&mut Self>,
+        cx: &mut Context<'_>,
+    ) -> Poll<Option<Self::Item>>;
 
     /// Returns the bounds on the remaining length of the stream.
     ///
@@ -100,7 +103,10 @@
 impl<S: ?Sized + Stream + Unpin> Stream for &mut S {
     type Item = S::Item;
 
-    fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+    fn poll_next(
+        mut self: Pin<&mut Self>,
+        cx: &mut Context<'_>,
+    ) -> Poll<Option<Self::Item>> {
         S::poll_next(Pin::new(&mut **self), cx)
     }
 
@@ -116,7 +122,10 @@
 {
     type Item = <P::Target as Stream>::Item;
 
-    fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+    fn poll_next(
+        self: Pin<&mut Self>,
+        cx: &mut Context<'_>,
+    ) -> Poll<Option<Self::Item>> {
         self.get_mut().as_mut().poll_next(cx)
     }
 
@@ -176,36 +185,35 @@
     /// This method is a stopgap for a compiler limitation that prevents us from
     /// directly inheriting from the `Stream` trait; in the future it won't be
     /// needed.
-    fn try_poll_next(
-        self: Pin<&mut Self>,
-        cx: &mut Context<'_>,
-    ) -> Poll<Option<Result<Self::Ok, Self::Error>>>;
+    fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>)
+        -> Poll<Option<Result<Self::Ok, Self::Error>>>;
 }
 
 impl<S, T, E> TryStream for S
-where
-    S: ?Sized + Stream<Item = Result<T, E>>,
+    where S: ?Sized + Stream<Item = Result<T, E>>
 {
     type Ok = T;
     type Error = E;
 
-    fn try_poll_next(
-        self: Pin<&mut Self>,
-        cx: &mut Context<'_>,
-    ) -> Poll<Option<Result<Self::Ok, Self::Error>>> {
+    fn try_poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>)
+        -> Poll<Option<Result<Self::Ok, Self::Error>>>
+    {
         self.poll_next(cx)
     }
 }
 
 #[cfg(feature = "alloc")]
 mod if_alloc {
-    use super::*;
     use alloc::boxed::Box;
+    use super::*;
 
     impl<S: ?Sized + Stream + Unpin> Stream for Box<S> {
         type Item = S::Item;
 
-        fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+        fn poll_next(
+            mut self: Pin<&mut Self>,
+            cx: &mut Context<'_>,
+        ) -> Poll<Option<Self::Item>> {
             Pin::new(&mut **self).poll_next(cx)
         }
 
@@ -218,7 +226,10 @@
     impl<S: Stream> Stream for std::panic::AssertUnwindSafe<S> {
         type Item = S::Item;
 
-        fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S::Item>> {
+        fn poll_next(
+            self: Pin<&mut Self>,
+            cx: &mut Context<'_>,
+        ) -> Poll<Option<S::Item>> {
             unsafe { self.map_unchecked_mut(|x| &mut x.0) }.poll_next(cx)
         }
 
diff --git a/src/task/__internal/atomic_waker.rs b/src/task/__internal/atomic_waker.rs
index d49d043..213355b 100644
--- a/src/task/__internal/atomic_waker.rs
+++ b/src/task/__internal/atomic_waker.rs
@@ -1,7 +1,7 @@
 use core::cell::UnsafeCell;
 use core::fmt;
 use core::sync::atomic::AtomicUsize;
-use core::sync::atomic::Ordering::{AcqRel, Acquire, Release};
+use core::sync::atomic::Ordering::{Acquire, Release, AcqRel};
 use core::task::Waker;
 
 /// A synchronization primitive for task wakeup.
@@ -202,7 +202,10 @@
         trait AssertSync: Sync {}
         impl AssertSync for Waker {}
 
-        Self { state: AtomicUsize::new(WAITING), waker: UnsafeCell::new(None) }
+        Self {
+            state: AtomicUsize::new(WAITING),
+            waker: UnsafeCell::new(None),
+        }
     }
 
     /// Registers the waker to be notified on calls to `wake`.
@@ -276,7 +279,8 @@
                     // nothing to acquire, only release. In case of concurrent
                     // wakers, we need to acquire their releases, so success needs
                     // to do both.
-                    let res = self.state.compare_exchange(REGISTERING, WAITING, AcqRel, Acquire);
+                    let res = self.state.compare_exchange(
+                        REGISTERING, WAITING, AcqRel, Acquire);
 
                     match res {
                         Ok(_) => {
@@ -340,7 +344,9 @@
                 //
                 // We just want to maintain memory safety. It is ok to drop the
                 // call to `register`.
-                debug_assert!(state == REGISTERING || state == REGISTERING | WAKING);
+                debug_assert!(
+                    state == REGISTERING ||
+                    state == REGISTERING | WAKING);
             }
         }
     }
@@ -385,8 +391,9 @@
                 // not.
                 //
                 debug_assert!(
-                    state == REGISTERING || state == REGISTERING | WAKING || state == WAKING
-                );
+                    state == REGISTERING ||
+                    state == REGISTERING | WAKING ||
+                    state == WAKING);
                 None
             }
         }
diff --git a/src/task/__internal/mod.rs b/src/task/__internal/mod.rs
index c902eb4..77e3678 100644
--- a/src/task/__internal/mod.rs
+++ b/src/task/__internal/mod.rs
@@ -1,4 +1,4 @@
-#[cfg(not(futures_no_atomic_cas))]
+#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
 mod atomic_waker;
-#[cfg(not(futures_no_atomic_cas))]
+#[cfg_attr(feature = "cfg-target-has-atomic", cfg(target_has_atomic = "ptr"))]
 pub use self::atomic_waker::AtomicWaker;
diff --git a/src/task/mod.rs b/src/task/mod.rs
index 19e4eae..f945d5d 100644
--- a/src/task/mod.rs
+++ b/src/task/mod.rs
@@ -7,4 +7,4 @@
 pub mod __internal;
 
 #[doc(no_inline)]
-pub use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
+pub use core::task::{Context, Poll, Waker, RawWaker, RawWakerVTable};
diff --git a/src/task/poll.rs b/src/task/poll.rs
index 607e78e..8fe294c 100644
--- a/src/task/poll.rs
+++ b/src/task/poll.rs
@@ -3,10 +3,9 @@
 /// This macro bakes in propagation of `Pending` signals by returning early.
 #[macro_export]
 macro_rules! ready {
-    ($e:expr $(,)?) => {
-        match $e {
-            $crate::task::Poll::Ready(t) => t,
-            $crate::task::Poll::Pending => return $crate::task::Poll::Pending,
-        }
-    };
+    ($e:expr $(,)?) => (match $e {
+        $crate::__private::Poll::Ready(t) => t,
+        $crate::__private::Poll::Pending =>
+            return $crate::__private::Poll::Pending,
+    })
 }