aboutsummaryrefslogtreecommitdiff
path: root/lazy-static/src/inline_lazy.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-12-29 09:22:57 -0800
committerDaniel Mueller <deso@posteo.net>2019-12-29 09:22:57 -0800
commit4ae7f49555583b0d02fe73354e79243980545b60 (patch)
tree36ea299e8a2c41ba0e2bc24f7b08ef987d088091 /lazy-static/src/inline_lazy.rs
parent3602aa37413186da0973c069bd0edc701a240dfe (diff)
downloadnitrocli-4ae7f49555583b0d02fe73354e79243980545b60.tar.gz
nitrocli-4ae7f49555583b0d02fe73354e79243980545b60.tar.bz2
Update lazy_static crate to 1.4.0
This change updates the lazy_static crate version to 1.4.0. Import subrepo lazy-static/:lazy-static at 421669662b35fcb455f2902daed2e20bbbba79b6
Diffstat (limited to 'lazy-static/src/inline_lazy.rs')
-rw-r--r--lazy-static/src/inline_lazy.rs18
1 files changed, 5 insertions, 13 deletions
diff --git a/lazy-static/src/inline_lazy.rs b/lazy-static/src/inline_lazy.rs
index 268dd45..219ce9c 100644
--- a/lazy-static/src/inline_lazy.rs
+++ b/lazy-static/src/inline_lazy.rs
@@ -10,13 +10,16 @@ extern crate std;
use self::std::prelude::v1::*;
use self::std::cell::Cell;
+use self::std::hint::unreachable_unchecked;
use self::std::sync::Once;
+#[allow(deprecated)]
pub use self::std::sync::ONCE_INIT;
-// FIXME: Replace Option<T> with MaybeInitialized<T>
+// FIXME: Replace Option<T> with MaybeUninit<T> (stable since 1.36.0)
pub struct Lazy<T: Sync>(Cell<Option<T>>, Once);
impl<T: Sync> Lazy<T> {
+ #[allow(deprecated)]
pub const INIT: Self = Lazy(Cell::new(None), ONCE_INIT);
#[inline(always)]
@@ -29,7 +32,7 @@ impl<T: Sync> Lazy<T> {
});
// `self.0` is guaranteed to be `Some` by this point
- // The `Once` will catch and propegate panics
+ // The `Once` will catch and propagate panics
unsafe {
match *self.0.as_ptr() {
Some(ref x) => x,
@@ -52,14 +55,3 @@ macro_rules! __lazy_static_create {
static $NAME: $crate::lazy::Lazy<$T> = $crate::lazy::Lazy::INIT;
};
}
-
-/// Polyfill for std::hint::unreachable_unchecked. There currently exists a
-/// [crate](https://docs.rs/unreachable) for an equivalent to std::hint::unreachable_unchecked, but
-/// lazy_static currently doesn't include any runtime dependencies and we've chosen to include this
-/// short polyfill rather than include a new crate in every consumer's build.
-///
-/// This should be replaced by std's version when lazy_static starts to require at least Rust 1.27.
-unsafe fn unreachable_unchecked() -> ! {
- enum Void {}
- match std::mem::uninitialized::<Void>() {}
-}