Snap for 6533464 from 66a594dcb0ae44ad8d166453fc06504a3fe6588b to sdk-release

Change-Id: I4c7626a4b63095b382e0a7bd5cb995e2b69c5b99
diff --git a/Android.bp b/Android.bp
index 27261e5..f9608ec 100644
--- a/Android.bp
+++ b/Android.bp
@@ -8,6 +8,13 @@
     features: [
         "alloc",
         "default",
+        "once_cell",
         "std",
     ],
+    rlibs: [
+        "libonce_cell",
+    ],
 }
+
+// dependent_library ["feature_list"]
+//   once_cell-1.3.1 "std"
diff --git a/Cargo.toml b/Cargo.toml
index 35a136e..889a333 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,21 +13,24 @@
 [package]
 edition = "2018"
 name = "futures-task"
-version = "0.3.4"
+version = "0.3.5"
 authors = ["Alex Crichton <alex@alexcrichton.com>"]
 description = "Tools for working with tasks.\n"
 homepage = "https://rust-lang.github.io/futures-rs"
-documentation = "https://rust-lang.github.io/futures-api-docs/0.3.0-alpha.18/futures_core"
+documentation = "https://docs.rs/futures-task/0.3.5"
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/rust-lang/futures-rs"
 [package.metadata.docs.rs]
 all-features = true
-
-[dependencies]
+[dependencies.once_cell]
+version = "1.3.1"
+features = ["std"]
+optional = true
+default-features = false
 
 [features]
 alloc = []
 cfg-target-has-atomic = []
 default = ["std"]
-std = ["alloc"]
+std = ["alloc", "once_cell"]
 unstable = []
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 0b4b62a..fdf27ca 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,19 +1,19 @@
 [package]
 name = "futures-task"
 edition = "2018"
-version = "0.3.4"
+version = "0.3.5"
 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://rust-lang.github.io/futures-api-docs/0.3.0-alpha.18/futures_core"
+documentation = "https://docs.rs/futures-task/0.3.5"
 description = """
 Tools for working with tasks.
 """
 
 [features]
 default = ["std"]
-std = ["alloc"]
+std = ["alloc", "once_cell"]
 alloc = []
 
 # Unstable features
@@ -23,6 +23,7 @@
 cfg-target-has-atomic = []
 
 [dependencies]
+once_cell = { version = "1.3.1", default-features = false, features = ["std"], optional = true }
 
 [package.metadata.docs.rs]
 all-features = true
diff --git a/METADATA b/METADATA
index 77fddf1..e9e7014 100644
--- a/METADATA
+++ b/METADATA
@@ -1,7 +1,5 @@
 name: "futures-task"
-description:
-    "Tools for working with tasks."
-
+description: "Tools for working with tasks."
 third_party {
   url {
     type: HOMEPAGE
@@ -11,7 +9,11 @@
     type: GIT
     value: "https://github.com/rust-lang/futures-rs"
   }
-  version: "0.3.4"
-  last_upgrade_date { year: 2020 month: 3 day: 17 }
+  version: "0.3.5"
   license_type: NOTICE
+  last_upgrade_date {
+    year: 2020
+    month: 5
+    day: 8
+  }
 }
diff --git a/src/lib.rs b/src/lib.rs
index b18a33a..5f919f8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,7 +11,7 @@
 
 #![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))]
 
-#![doc(html_root_url = "https://docs.rs/futures-task/0.3.0")]
+#![doc(html_root_url = "https://docs.rs/futures-task/0.3.5")]
 
 #[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");
diff --git a/src/noop_waker.rs b/src/noop_waker.rs
index a0924ad..2a84bcd 100644
--- a/src/noop_waker.rs
+++ b/src/noop_waker.rs
@@ -3,7 +3,7 @@
 use core::task::{RawWaker, RawWakerVTable, Waker};
 use core::ptr::null;
 #[cfg(feature = "std")]
-use core::cell::UnsafeCell;
+use once_cell::sync::Lazy;
 
 unsafe fn noop_clone(_data: *const ()) -> RawWaker {
     noop_raw_waker()
@@ -47,9 +47,16 @@
 #[inline]
 #[cfg(feature = "std")]
 pub fn noop_waker_ref() -> &'static Waker {
-    thread_local! {
-        static NOOP_WAKER_INSTANCE: UnsafeCell<Waker> =
-            UnsafeCell::new(noop_waker());
+    static NOOP_WAKER_INSTANCE: Lazy<Waker> = Lazy::new(noop_waker);
+    &*NOOP_WAKER_INSTANCE
+}
+
+#[cfg(test)]
+mod tests {
+    #[test]
+    #[cfg(feature = "std")]
+    fn issue_2091_cross_thread_segfault() {
+        let waker = std::thread::spawn(super::noop_waker_ref).join().unwrap();
+        waker.wake_by_ref();
     }
-    NOOP_WAKER_INSTANCE.with(|l| unsafe { &*l.get() })
 }