Avoid once_cell unstable feature in cg_clif.rs

This commit is contained in:
bjorn3 2022-03-15 17:42:51 +01:00
parent a900a5229a
commit 88c3719c68
2 changed files with 9 additions and 7 deletions

View file

@ -21,7 +21,7 @@ object = { version = "0.27.0", default-features = false, features = ["std", "rea
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
indexmap = "1.8.0"
libloading = { version = "0.6.0", optional = true }
once_cell = { version = "1.10.0", optional = true }
once_cell = "1.10.0"
smallvec = "1.6.1"
[patch.crates-io]
@ -38,7 +38,7 @@ smallvec = "1.6.1"
[features]
# Enable features not ready to be enabled when compiling as part of rustc
unstable-features = ["jit", "inline_asm"]
jit = ["cranelift-jit", "libloading", "once_cell"]
jit = ["cranelift-jit", "libloading"]
inline_asm = []
# Disable optimizations and debuginfo of build scripts and some of the heavy build deps, as the

View file

@ -1,4 +1,4 @@
#![feature(rustc_private, once_cell)]
#![feature(rustc_private)]
#![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)]
#![warn(unreachable_pub)]
@ -9,7 +9,6 @@ extern crate rustc_interface;
extern crate rustc_session;
extern crate rustc_target;
use std::lazy::SyncLazy;
use std::panic;
use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
@ -18,10 +17,13 @@ use rustc_session::config::ErrorOutputType;
use rustc_session::early_error;
use rustc_target::spec::PanicStrategy;
// FIXME use std::lazy::SyncLazy once it stabilizes
use once_cell::sync::Lazy;
const BUG_REPORT_URL: &str = "https://github.com/bjorn3/rustc_codegen_cranelift/issues/new";
static DEFAULT_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
SyncLazy::new(|| {
static DEFAULT_HOOK: Lazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
Lazy::new(|| {
let hook = panic::take_hook();
panic::set_hook(Box::new(|info| {
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
@ -61,7 +63,7 @@ fn main() {
let start_rss = get_resident_set_size();
rustc_driver::init_rustc_env_logger();
let mut callbacks = CraneliftPassesCallbacks::default();
SyncLazy::force(&DEFAULT_HOOK); // Install ice hook
Lazy::force(&DEFAULT_HOOK); // Install ice hook
let exit_code = rustc_driver::catch_with_exit_code(|| {
let args = std::env::args_os()
.enumerate()