Skip to content

Commit 88c3719

Browse files
committed
Avoid once_cell unstable feature in cg_clif.rs
1 parent a900a52 commit 88c3719

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ object = { version = "0.27.0", default-features = false, features = ["std", "rea
2121
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
2222
indexmap = "1.8.0"
2323
libloading = { version = "0.6.0", optional = true }
24-
once_cell = { version = "1.10.0", optional = true }
24+
once_cell = "1.10.0"
2525
smallvec = "1.6.1"
2626

2727
[patch.crates-io]
@@ -38,7 +38,7 @@ smallvec = "1.6.1"
3838
[features]
3939
# Enable features not ready to be enabled when compiling as part of rustc
4040
unstable-features = ["jit", "inline_asm"]
41-
jit = ["cranelift-jit", "libloading", "once_cell"]
41+
jit = ["cranelift-jit", "libloading"]
4242
inline_asm = []
4343

4444
# Disable optimizations and debuginfo of build scripts and some of the heavy build deps, as the

src/bin/cg_clif.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(rustc_private, once_cell)]
1+
#![feature(rustc_private)]
22
#![warn(rust_2018_idioms)]
33
#![warn(unused_lifetimes)]
44
#![warn(unreachable_pub)]
@@ -9,7 +9,6 @@ extern crate rustc_interface;
99
extern crate rustc_session;
1010
extern crate rustc_target;
1111

12-
use std::lazy::SyncLazy;
1312
use std::panic;
1413

1514
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
@@ -18,10 +17,13 @@ use rustc_session::config::ErrorOutputType;
1817
use rustc_session::early_error;
1918
use rustc_target::spec::PanicStrategy;
2019

20+
// FIXME use std::lazy::SyncLazy once it stabilizes
21+
use once_cell::sync::Lazy;
22+
2123
const BUG_REPORT_URL: &str = "https://github.com/bjorn3/rustc_codegen_cranelift/issues/new";
2224

23-
static DEFAULT_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
24-
SyncLazy::new(|| {
25+
static DEFAULT_HOOK: Lazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
26+
Lazy::new(|| {
2527
let hook = panic::take_hook();
2628
panic::set_hook(Box::new(|info| {
2729
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
@@ -61,7 +63,7 @@ fn main() {
6163
let start_rss = get_resident_set_size();
6264
rustc_driver::init_rustc_env_logger();
6365
let mut callbacks = CraneliftPassesCallbacks::default();
64-
SyncLazy::force(&DEFAULT_HOOK); // Install ice hook
66+
Lazy::force(&DEFAULT_HOOK); // Install ice hook
6567
let exit_code = rustc_driver::catch_with_exit_code(|| {
6668
let args = std::env::args_os()
6769
.enumerate()

0 commit comments

Comments
 (0)