Skip to content

Commit 3b98c08

Browse files
committed
Auto merge of #98242 - matthiaskrgr:rollup-qbbkwtf, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #97511 (Don't build the compiler before building rust-demangler) - #98165 (once cell renamings) - #98207 (Update cargo) - #98229 (Add new eslint checks) - #98230 (Fix weird js condition) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 8e430bf + 267fe3b commit 3b98c08

File tree

46 files changed

+1288
-1244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1288
-1244
lines changed

Cargo.lock

+27-21
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ dependencies = [
332332
"cargo-test-macro",
333333
"cargo-test-support",
334334
"cargo-util",
335-
"clap 3.1.1",
335+
"clap 3.2.5",
336336
"crates-io",
337337
"crossbeam-utils",
338338
"curl",
@@ -470,7 +470,7 @@ dependencies = [
470470

471471
[[package]]
472472
name = "cargo-util"
473-
version = "0.1.3"
473+
version = "0.1.4"
474474
dependencies = [
475475
"anyhow",
476476
"core-foundation",
@@ -615,19 +615,19 @@ dependencies = [
615615

616616
[[package]]
617617
name = "clap"
618-
version = "3.1.1"
618+
version = "3.2.5"
619619
source = "registry+https://github.com/rust-lang/crates.io-index"
620-
checksum = "6d76c22c9b9b215eeb8d016ad3a90417bd13cb24cf8142756e6472445876cab7"
620+
checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7"
621621
dependencies = [
622622
"atty",
623623
"bitflags",
624624
"clap_derive",
625+
"clap_lex",
625626
"indexmap",
626-
"lazy_static",
627-
"os_str_bytes",
627+
"once_cell",
628628
"strsim 0.10.0",
629629
"termcolor",
630-
"textwrap 0.14.2",
630+
"textwrap 0.15.0",
631631
]
632632

633633
[[package]]
@@ -636,14 +636,14 @@ version = "3.1.1"
636636
source = "registry+https://github.com/rust-lang/crates.io-index"
637637
checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25"
638638
dependencies = [
639-
"clap 3.1.1",
639+
"clap 3.2.5",
640640
]
641641

642642
[[package]]
643643
name = "clap_derive"
644-
version = "3.1.18"
644+
version = "3.2.5"
645645
source = "registry+https://github.com/rust-lang/crates.io-index"
646-
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
646+
checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9"
647647
dependencies = [
648648
"heck 0.4.0",
649649
"proc-macro-error",
@@ -652,6 +652,15 @@ dependencies = [
652652
"syn",
653653
]
654654

655+
[[package]]
656+
name = "clap_lex"
657+
version = "0.2.2"
658+
source = "registry+https://github.com/rust-lang/crates.io-index"
659+
checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613"
660+
dependencies = [
661+
"os_str_bytes",
662+
]
663+
655664
[[package]]
656665
name = "clippy"
657666
version = "0.1.63"
@@ -684,7 +693,7 @@ name = "clippy_dev"
684693
version = "0.0.1"
685694
dependencies = [
686695
"aho-corasick",
687-
"clap 3.1.1",
696+
"clap 3.2.5",
688697
"indoc",
689698
"itertools",
690699
"opener",
@@ -2334,7 +2343,7 @@ dependencies = [
23342343
"ammonia",
23352344
"anyhow",
23362345
"chrono",
2337-
"clap 3.1.1",
2346+
"clap 3.2.5",
23382347
"clap_complete",
23392348
"elasticlunr-rs",
23402349
"env_logger 0.7.1",
@@ -2572,9 +2581,9 @@ dependencies = [
25722581

25732582
[[package]]
25742583
name = "once_cell"
2575-
version = "1.10.0"
2584+
version = "1.12.0"
25762585
source = "registry+https://github.com/rust-lang/crates.io-index"
2577-
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
2586+
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
25782587

25792588
[[package]]
25802589
name = "opaque-debug"
@@ -2657,9 +2666,6 @@ name = "os_str_bytes"
26572666
version = "6.0.0"
26582667
source = "registry+https://github.com/rust-lang/crates.io-index"
26592668
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
2660-
dependencies = [
2661-
"memchr",
2662-
]
26632669

26642670
[[package]]
26652671
name = "output_vt100"
@@ -3515,7 +3521,7 @@ version = "1.0.0"
35153521
dependencies = [
35163522
"bstr",
35173523
"byteorder",
3518-
"clap 3.1.1",
3524+
"clap 3.2.5",
35193525
"crossbeam-utils",
35203526
"libc",
35213527
"libz-sys",
@@ -4696,7 +4702,7 @@ dependencies = [
46964702
"anyhow",
46974703
"bytecount",
46984704
"cargo_metadata",
4699-
"clap 3.1.1",
4705+
"clap 3.2.5",
47004706
"derive-new",
47014707
"diff",
47024708
"dirs",
@@ -5259,9 +5265,9 @@ dependencies = [
52595265

52605266
[[package]]
52615267
name = "textwrap"
5262-
version = "0.14.2"
5268+
version = "0.15.0"
52635269
source = "registry+https://github.com/rust-lang/crates.io-index"
5264-
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
5270+
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
52655271

52665272
[[package]]
52675273
name = "thiserror"

compiler/rustc_codegen_cranelift/src/driver/jit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc_span::Symbol;
1313

1414
use cranelift_jit::{JITBuilder, JITModule};
1515

16-
// FIXME use std::lazy::SyncOnceCell once it stabilizes
16+
// FIXME use std::sync::OnceLock once it stabilizes
1717
use once_cell::sync::OnceCell;
1818

1919
use crate::{prelude::*, BackendConfig};

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ use rustc_target::abi::Size;
3636

3737
use libc::c_uint;
3838
use smallvec::SmallVec;
39+
use std::cell::OnceCell;
3940
use std::cell::RefCell;
4041
use std::iter;
41-
use std::lazy::OnceCell;
4242
use tracing::debug;
4343

4444
mod create_scope_map;

compiler/rustc_codegen_ssa/src/back/link.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ use regex::Regex;
3838
use tempfile::Builder as TempFileBuilder;
3939

4040
use std::borrow::Borrow;
41+
use std::cell::OnceCell;
4142
use std::collections::BTreeSet;
4243
use std::ffi::OsString;
4344
use std::fs::{File, OpenOptions};
4445
use std::io::{BufWriter, Write};
45-
use std::lazy::OnceCell;
4646
use std::ops::Deref;
4747
use std::path::{Path, PathBuf};
4848
use std::process::{ExitStatus, Output, Stdio};

compiler/rustc_data_structures/src/jobserver.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub use jobserver_crate::Client;
2-
use std::lazy::SyncLazy;
2+
use std::sync::LazyLock;
33

44
// We can only call `from_env` once per process
55

@@ -18,7 +18,7 @@ use std::lazy::SyncLazy;
1818
// Also note that we stick this in a global because there could be
1919
// multiple rustc instances in this process, and the jobserver is
2020
// per-process.
21-
static GLOBAL_CLIENT: SyncLazy<Client> = SyncLazy::new(|| unsafe {
21+
static GLOBAL_CLIENT: LazyLock<Client> = LazyLock::new(|| unsafe {
2222
Client::from_env().unwrap_or_else(|| {
2323
let client = Client::new(32).expect("failed to create jobserver");
2424
// Acquire a token for the main thread which we can release later

compiler/rustc_data_structures/src/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ cfg_if! {
173173
pub use std::cell::RefMut as LockGuard;
174174
pub use std::cell::RefMut as MappedLockGuard;
175175

176-
pub use std::lazy::OnceCell;
176+
pub use std::cell::OnceCell;
177177

178178
use std::cell::RefCell as InnerRwLock;
179179
use std::cell::RefCell as InnerLock;
@@ -258,7 +258,7 @@ cfg_if! {
258258
pub use parking_lot::MutexGuard as LockGuard;
259259
pub use parking_lot::MappedMutexGuard as MappedLockGuard;
260260

261-
pub use std::lazy::SyncOnceCell as OnceCell;
261+
pub use std::sync::OnceLock as OnceCell;
262262

263263
pub use std::sync::atomic::{AtomicBool, AtomicUsize, AtomicU32, AtomicU64};
264264

compiler/rustc_driver/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ use std::env;
4747
use std::ffi::OsString;
4848
use std::fs;
4949
use std::io::{self, Read, Write};
50-
use std::lazy::SyncLazy;
5150
use std::panic::{self, catch_unwind};
5251
use std::path::PathBuf;
5352
use std::process::{self, Command, Stdio};
5453
use std::str;
54+
use std::sync::LazyLock;
5555
use std::time::Instant;
5656

5757
pub mod args;
@@ -1141,8 +1141,8 @@ pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
11411141
}
11421142
}
11431143

1144-
static DEFAULT_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
1145-
SyncLazy::new(|| {
1144+
static DEFAULT_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
1145+
LazyLock::new(|| {
11461146
let hook = panic::take_hook();
11471147
panic::set_hook(Box::new(|info| {
11481148
// Invoke the default handler, which prints the actual panic message and optionally a backtrace
@@ -1237,7 +1237,7 @@ pub fn install_ice_hook() {
12371237
if std::env::var("RUST_BACKTRACE").is_err() {
12381238
std::env::set_var("RUST_BACKTRACE", "full");
12391239
}
1240-
SyncLazy::force(&DEFAULT_HOOK);
1240+
LazyLock::force(&DEFAULT_HOOK);
12411241
}
12421242

12431243
/// This allows tools to enable rust logging without having to magically match rustc's

compiler/rustc_error_messages/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ use std::path::{Path, PathBuf};
1818
use tracing::{instrument, trace};
1919

2020
#[cfg(not(parallel_compiler))]
21-
use std::lazy::Lazy;
21+
use std::cell::LazyCell as Lazy;
2222
#[cfg(parallel_compiler)]
23-
use std::lazy::SyncLazy as Lazy;
23+
use std::sync::LazyLock as Lazy;
2424

2525
#[cfg(parallel_compiler)]
2626
use intl_memoizer::concurrent::IntlLangMemoizer;

compiler/rustc_feature/src/builtin_attrs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{Features, Stability};
99
use rustc_data_structures::fx::FxHashMap;
1010
use rustc_span::symbol::{sym, Symbol};
1111

12-
use std::lazy::SyncLazy;
12+
use std::sync::LazyLock;
1313

1414
type GateFn = fn(&Features) -> bool;
1515

@@ -809,8 +809,8 @@ pub fn is_builtin_only_local(name: Symbol) -> bool {
809809
BUILTIN_ATTRIBUTE_MAP.get(&name).map_or(false, |attr| attr.only_local)
810810
}
811811

812-
pub static BUILTIN_ATTRIBUTE_MAP: SyncLazy<FxHashMap<Symbol, &BuiltinAttribute>> =
813-
SyncLazy::new(|| {
812+
pub static BUILTIN_ATTRIBUTE_MAP: LazyLock<FxHashMap<Symbol, &BuiltinAttribute>> =
813+
LazyLock::new(|| {
814814
let mut map = FxHashMap::default();
815815
for attr in BUILTIN_ATTRIBUTES.iter() {
816816
if map.insert(attr.name, attr).is_some() {

compiler/rustc_hir/src/lang_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_macros::HashStable_Generic;
1717
use rustc_span::symbol::{kw, sym, Symbol};
1818
use rustc_span::Span;
1919

20-
use std::lazy::SyncLazy;
20+
use std::sync::LazyLock;
2121

2222
pub enum LangItemGroup {
2323
Op,
@@ -134,7 +134,7 @@ macro_rules! language_item_table {
134134
}
135135

136136
/// A mapping from the name of the lang item to its order and the form it must be of.
137-
pub static ITEM_REFS: SyncLazy<FxHashMap<Symbol, (usize, Target)>> = SyncLazy::new(|| {
137+
pub static ITEM_REFS: LazyLock<FxHashMap<Symbol, (usize, Target)>> = LazyLock::new(|| {
138138
let mut item_refs = FxHashMap::default();
139139
$( item_refs.insert($module::$name, (LangItem::$variant as usize, $target)); )*
140140
item_refs

compiler/rustc_hir/src/weak_lang_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use rustc_ast as ast;
77
use rustc_data_structures::stable_map::StableMap;
88
use rustc_span::symbol::{sym, Symbol};
99

10-
use std::lazy::SyncLazy;
10+
use std::sync::LazyLock;
1111

1212
macro_rules! weak_lang_items {
1313
($($name:ident, $item:ident, $sym:ident;)*) => (
1414

15-
pub static WEAK_ITEMS_REFS: SyncLazy<StableMap<Symbol, LangItem>> = SyncLazy::new(|| {
15+
pub static WEAK_ITEMS_REFS: LazyLock<StableMap<Symbol, LangItem>> = LazyLock::new(|| {
1616
let mut map = StableMap::default();
1717
$(map.insert(sym::$name, LangItem::$item);)*
1818
map

compiler/rustc_interface/src/passes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ use std::any::Any;
4444
use std::cell::RefCell;
4545
use std::ffi::OsString;
4646
use std::io::{self, BufWriter, Write};
47-
use std::lazy::SyncLazy;
4847
use std::marker::PhantomPinned;
4948
use std::path::{Path, PathBuf};
5049
use std::pin::Pin;
5150
use std::rc::Rc;
51+
use std::sync::LazyLock;
5252
use std::{env, fs, iter};
5353

5454
pub fn parse<'a>(sess: &'a Session, input: &Input) -> PResult<'a, ast::Crate> {
@@ -774,7 +774,7 @@ pub fn prepare_outputs(
774774
Ok(outputs)
775775
}
776776

777-
pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
777+
pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
778778
let providers = &mut Providers::default();
779779
providers.analysis = analysis;
780780
proc_macro_decls::provide(providers);
@@ -799,7 +799,7 @@ pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
799799
*providers
800800
});
801801

802-
pub static DEFAULT_EXTERN_QUERY_PROVIDERS: SyncLazy<ExternProviders> = SyncLazy::new(|| {
802+
pub static DEFAULT_EXTERN_QUERY_PROVIDERS: LazyLock<ExternProviders> = LazyLock::new(|| {
803803
let mut extern_providers = ExternProviders::default();
804804
rustc_metadata::provide_extern(&mut extern_providers);
805805
rustc_codegen_ssa::provide_extern(&mut extern_providers);

compiler/rustc_interface/src/util.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ use rustc_span::source_map::FileLoader;
2424
use rustc_span::symbol::{sym, Symbol};
2525
use std::env;
2626
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
27-
use std::lazy::SyncOnceCell;
2827
use std::mem;
2928
#[cfg(not(parallel_compiler))]
3029
use std::panic;
3130
use std::path::{Path, PathBuf};
3231
use std::sync::atomic::{AtomicBool, Ordering};
32+
use std::sync::OnceLock;
3333
use std::thread;
3434
use tracing::info;
3535

@@ -242,7 +242,7 @@ pub fn get_codegen_backend(
242242
maybe_sysroot: &Option<PathBuf>,
243243
backend_name: Option<&str>,
244244
) -> Box<dyn CodegenBackend> {
245-
static LOAD: SyncOnceCell<unsafe fn() -> Box<dyn CodegenBackend>> = SyncOnceCell::new();
245+
static LOAD: OnceLock<unsafe fn() -> Box<dyn CodegenBackend>> = OnceLock::new();
246246

247247
let load = LOAD.get_or_init(|| {
248248
let default_codegen_backend = option_env!("CFG_DEFAULT_CODEGEN_BACKEND").unwrap_or("llvm");
@@ -265,7 +265,7 @@ pub fn get_codegen_backend(
265265
// loading, so we leave the code here. It is potentially useful for other tools
266266
// that want to invoke the rustc binary while linking to rustc as well.
267267
pub fn rustc_path<'a>() -> Option<&'a Path> {
268-
static RUSTC_PATH: SyncOnceCell<Option<PathBuf>> = SyncOnceCell::new();
268+
static RUSTC_PATH: OnceLock<Option<PathBuf>> = OnceLock::new();
269269

270270
const BIN_PATH: &str = env!("RUSTC_INSTALL_BINDIR");
271271

compiler/rustc_mir_dataflow/src/framework/graphviz.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! A helpful diagram for debugging dataflow problems.
22
33
use std::borrow::Cow;
4-
use std::lazy::SyncOnceCell;
4+
use std::sync::OnceLock;
55
use std::{io, ops, str};
66

77
use regex::Regex;
@@ -590,7 +590,7 @@ where
590590

591591
macro_rules! regex {
592592
($re:literal $(,)?) => {{
593-
static RE: SyncOnceCell<regex::Regex> = SyncOnceCell::new();
593+
static RE: OnceLock<regex::Regex> = OnceLock::new();
594594
RE.get_or_init(|| Regex::new($re).unwrap())
595595
}};
596596
}

0 commit comments

Comments
 (0)