Skip to content

Commit d2df430

Browse files
authored
Merge pull request #99 from KodrAus/fix/nightly
Fix nightly build
2 parents c90f281 + afa05d2 commit d2df430

12 files changed

+41
-16
lines changed

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ matrix:
1313
- cargo bench --features nightly
1414
- cargo test --features spin_no_std
1515
- cargo bench --features spin_no_std
16+
- cd compiletest
1617
- cargo clean
17-
- cargo test --features compiletest
18+
- cargo test
19+
- cd ../
1820

1921
- rust: nightly
2022
before_script:

Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@ categories = [ "no-std", "rust-patterns", "memory-management" ]
1717
version = "0.4.6"
1818
optional = true
1919

20-
[dependencies.compiletest_rs]
21-
version = "0.3"
22-
optional = true
23-
2420
[features]
2521
nightly = []
2622
spin_no_std = ["nightly", "spin"]
27-
compiletest = ["compiletest_rs"]
2823

2924
[badges]
3025
appveyor = { repository = "rust-lang-nursery/lazy-static.rs" }

appveyor.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ test_script:
5353
- cargo build --verbose
5454
- cargo test
5555
- if [%CHANNEL%]==[nightly] (
56+
cd compiletest &&
5657
cargo clean &&
57-
cargo build --verbose --features "compiletest" &&
58-
cargo test --features "compiletest"
58+
cargo build --verbose &&
59+
cargo test &&
60+
cd ../
5961
)

compiletest/Cargo.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "lazy_static_compiletest"
3+
version = "0.0.1"
4+
publish = false
5+
authors = ["lazy_static contributors"]
6+
7+
[dependencies.lazy_static]
8+
path = "../"
9+
10+
[dependencies.compiletest_rs]
11+
version = "0.3"

compiletest/src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
This library is a shim around `lazy_static` that disambiguates it with the `lazy_static`
3+
that's shipped with the Rust toolchain. We re-export the entire public API of `lazy_static`
4+
under a different crate name so that can be imported in the compile tests.
5+
6+
This currently appears to use the right local build of `lazy_static`.
7+
*/
8+
9+
#![feature(use_extern_macros)]
10+
11+
extern crate lazy_static;
12+
13+
pub use self::lazy_static::*;

tests/compile-fail/README.md compiletest/tests/compile-fail/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ warning/note/help/error at compilation. Syntax of annotations is described in
33
[rust documentation](https://github.com/rust-lang/rust/blob/master/src/test/COMPILER_TESTS.md).
44
For more information check out [`compiletest` crate](https://github.com/laumann/compiletest-rs).
55

6-
To run compile tests issue `cargo +nightly --test --features compiletest`.
6+
To run compile tests issue `cargo +nightly --test`.
77

88
## Notes on working with `compiletest` crate
99

tests/compile-fail/incorrect_visibility_restriction.rs compiletest/tests/compile-fail/incorrect_visibility_restriction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// incorrect visibility restriction
22
#[macro_use]
3-
extern crate lazy_static;
3+
extern crate lazy_static_compiletest as lazy_static;
44

55
lazy_static! {
66
pub(nonsense) static ref WRONG: () = ();

tests/compile-fail/static_is_private.rs compiletest/tests/compile-fail/static_is_private.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[macro_use]
2-
extern crate lazy_static;
2+
extern crate lazy_static_compiletest as lazy_static;
33

44
mod outer {
55
pub mod inner {

tests/compile-fail/static_is_sized.rs compiletest/tests/compile-fail/static_is_sized.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// error-pattern:the trait bound `str: std::marker::Sized` is not satisfied
22
#[macro_use]
3-
extern crate lazy_static;
3+
extern crate lazy_static_compiletest as lazy_static;
44

55
lazy_static! {
66
pub static ref FOO: str = panic!();

tests/compile-fail/static_never_used.rs compiletest/tests/compile-fail/static_never_used.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// error-pattern:static item is never used: `UNUSED`
22
#![deny(dead_code)]
33
#[macro_use]
4-
extern crate lazy_static;
4+
extern crate lazy_static_compiletest as lazy_static;
55

66
lazy_static! {
77
static ref UNUSED: () = ();

tests/compile_tests.rs compiletest/tests/compile_tests.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
#![cfg(feature="compiletest")]
21
extern crate compiletest_rs as compiletest;
32

43
fn run_mode(mode: &'static str) {
54
let mut config = compiletest::Config::default();
65
config.mode = mode.parse().expect("Invalid mode");
76
config.src_base = ["tests", mode].iter().collect();
8-
config.target_rustcflags = Some("-L target/debug/ -L target/debug/deps/".to_owned());
97

108
config.verbose = true;
119

10+
config.target_rustcflags = Some("-L target/debug/ -L target/debug/deps/".to_owned());
11+
config.clean_rmeta();
12+
1213
compiletest::run_tests(&config);
1314
}
1415

src/nightly_lazy.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// copied, modified, or distributed except according to those terms.
77

88
extern crate std;
9+
extern crate core;
910

1011
use self::std::prelude::v1::*;
1112
use self::std::sync::Once;
@@ -27,7 +28,7 @@ impl<T: Sync> Lazy<T> {
2728
unsafe {
2829
match self.0 {
2930
Some(ref x) => x,
30-
None => std::mem::unreachable(),
31+
None => core::hint::unreachable_unchecked(),
3132
}
3233
}
3334
}

0 commit comments

Comments
 (0)