Skip to content

Commit 0463a90

Browse files
committed
Remove extra build config, we'll always use our unreachable_unchecked polyfill.
1 parent f85db0b commit 0463a90

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

build.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,4 @@ fn main() {
4343
};
4444

4545
println!("cargo:rustc-cfg=lazy_static_{}_impl", impl_name);
46-
47-
let version_geq_127 = version().unwrap() >= Version::new(1, 27, 0);
48-
let core_unreachable_unchecked_supported = version_geq_127 || nightly_feature_enabled;
49-
if core_unreachable_unchecked_supported {
50-
println!("cargo:rustc-cfg=lazy_static_core_unreachable_unchecked");
51-
}
5246
}

src/inline_lazy.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,12 @@ macro_rules! __lazy_static_create {
4747
};
4848
}
4949

50-
#[cfg(lazy_static_core_unreachable_unchecked)]
51-
use core::hint::unreachable_unchecked;
52-
53-
#[cfg(not(lazy_static_core_unreachable_unchecked))]
54-
/// Polyfill for core::hint::unreachable_unchecked. Included to support Rust prior to 1.27. See
55-
/// [issue #102](https://github.com/rust-lang-nursery/lazy-static.rs/issues/102#issuecomment-400959779)
56-
/// for details.
50+
/// Polyfill for std::hint::unreachable_unchecked. There currently exists a
51+
/// [crate](https://docs.rs/unreachable) for an equivalent to std::hint::unreachable_unchecked, but
52+
/// lazy_static currently doesn't include any runtime dependencies and we've chosen to include this
53+
/// short polyfill rather than include a new crate in every consumer's build.
54+
///
55+
/// This should be replaced by std's version when lazy_static starts to require at least Rust 1.27.
5756
unsafe fn unreachable_unchecked() -> ! {
5857
enum Void {}
5958
match std::mem::uninitialized::<Void>() {}

0 commit comments

Comments
 (0)