Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump MSRV to 1.27.2 #155

Merged
merged 3 commits into from
Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: rust
matrix:
include:
- rust: 1.24.1
- rust: 1.27.2
- rust: stable
script:
- cargo test
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ as well as anything that requires non-const function calls to be computed.

## Minimum supported `rustc`

`1.24.1+`
`1.27.2+`

This version is explicitly tested in CI and may only be bumped in new minor versions. Any changes to the supported minimum version will be called out in the release notes.

Expand Down
17 changes: 3 additions & 14 deletions src/inline_lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ 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> {
Expand All @@ -31,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,
Expand All @@ -54,15 +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 {}
#[allow(deprecated)]
match std::mem::uninitialized::<Void>() {}
}