Skip to content

Commit

Permalink
Auto merge of rust-lang#98242 - matthiaskrgr:rollup-qbbkwtf, r=matthi…
Browse files Browse the repository at this point in the history
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#97511 (Don't build the compiler before building rust-demangler)
 - rust-lang#98165 (once cell renamings)
 - rust-lang#98207 (Update cargo)
 - rust-lang#98229 (Add new eslint checks)
 - rust-lang#98230 (Fix weird js condition)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Jun 19, 2022
2 parents 8e430bf + 267fe3b commit 3b98c08
Show file tree
Hide file tree
Showing 46 changed files with 1,288 additions and 1,244 deletions.
48 changes: 27 additions & 21 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ dependencies = [
"cargo-test-macro",
"cargo-test-support",
"cargo-util",
"clap 3.1.1",
"clap 3.2.5",
"crates-io",
"crossbeam-utils",
"curl",
Expand Down Expand Up @@ -470,7 +470,7 @@ dependencies = [

[[package]]
name = "cargo-util"
version = "0.1.3"
version = "0.1.4"
dependencies = [
"anyhow",
"core-foundation",
Expand Down Expand Up @@ -615,19 +615,19 @@ dependencies = [

[[package]]
name = "clap"
version = "3.1.1"
version = "3.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d76c22c9b9b215eeb8d016ad3a90417bd13cb24cf8142756e6472445876cab7"
checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7"
dependencies = [
"atty",
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"lazy_static",
"os_str_bytes",
"once_cell",
"strsim 0.10.0",
"termcolor",
"textwrap 0.14.2",
"textwrap 0.15.0",
]

[[package]]
Expand All @@ -636,14 +636,14 @@ version = "3.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25"
dependencies = [
"clap 3.1.1",
"clap 3.2.5",
]

[[package]]
name = "clap_derive"
version = "3.1.18"
version = "3.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25320346e922cffe59c0bbc5410c8d8784509efb321488971081313cb1e1a33c"
checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9"
dependencies = [
"heck 0.4.0",
"proc-macro-error",
Expand All @@ -652,6 +652,15 @@ dependencies = [
"syn",
]

[[package]]
name = "clap_lex"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613"
dependencies = [
"os_str_bytes",
]

[[package]]
name = "clippy"
version = "0.1.63"
Expand Down Expand Up @@ -684,7 +693,7 @@ name = "clippy_dev"
version = "0.0.1"
dependencies = [
"aho-corasick",
"clap 3.1.1",
"clap 3.2.5",
"indoc",
"itertools",
"opener",
Expand Down Expand Up @@ -2334,7 +2343,7 @@ dependencies = [
"ammonia",
"anyhow",
"chrono",
"clap 3.1.1",
"clap 3.2.5",
"clap_complete",
"elasticlunr-rs",
"env_logger 0.7.1",
Expand Down Expand Up @@ -2572,9 +2581,9 @@ dependencies = [

[[package]]
name = "once_cell"
version = "1.10.0"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"

[[package]]
name = "opaque-debug"
Expand Down Expand Up @@ -2657,9 +2666,6 @@ name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]

[[package]]
name = "output_vt100"
Expand Down Expand Up @@ -3515,7 +3521,7 @@ version = "1.0.0"
dependencies = [
"bstr",
"byteorder",
"clap 3.1.1",
"clap 3.2.5",
"crossbeam-utils",
"libc",
"libz-sys",
Expand Down Expand Up @@ -4696,7 +4702,7 @@ dependencies = [
"anyhow",
"bytecount",
"cargo_metadata",
"clap 3.1.1",
"clap 3.2.5",
"derive-new",
"diff",
"dirs",
Expand Down Expand Up @@ -5259,9 +5265,9 @@ dependencies = [

[[package]]
name = "textwrap"
version = "0.14.2"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0066c8d12af8b5acd21e00547c3797fde4e8677254a7ee429176ccebbe93dd80"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"

[[package]]
name = "thiserror"
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/driver/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rustc_span::Symbol;

use cranelift_jit::{JITBuilder, JITModule};

// FIXME use std::lazy::SyncOnceCell once it stabilizes
// FIXME use std::sync::OnceLock once it stabilizes
use once_cell::sync::OnceCell;

use crate::{prelude::*, BackendConfig};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ use rustc_target::abi::Size;

use libc::c_uint;
use smallvec::SmallVec;
use std::cell::OnceCell;
use std::cell::RefCell;
use std::iter;
use std::lazy::OnceCell;
use tracing::debug;

mod create_scope_map;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ use regex::Regex;
use tempfile::Builder as TempFileBuilder;

use std::borrow::Borrow;
use std::cell::OnceCell;
use std::collections::BTreeSet;
use std::ffi::OsString;
use std::fs::{File, OpenOptions};
use std::io::{BufWriter, Write};
use std::lazy::OnceCell;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::process::{ExitStatus, Output, Stdio};
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/jobserver.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub use jobserver_crate::Client;
use std::lazy::SyncLazy;
use std::sync::LazyLock;

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

Expand All @@ -18,7 +18,7 @@ use std::lazy::SyncLazy;
// Also note that we stick this in a global because there could be
// multiple rustc instances in this process, and the jobserver is
// per-process.
static GLOBAL_CLIENT: SyncLazy<Client> = SyncLazy::new(|| unsafe {
static GLOBAL_CLIENT: LazyLock<Client> = LazyLock::new(|| unsafe {
Client::from_env().unwrap_or_else(|| {
let client = Client::new(32).expect("failed to create jobserver");
// Acquire a token for the main thread which we can release later
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_data_structures/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ cfg_if! {
pub use std::cell::RefMut as LockGuard;
pub use std::cell::RefMut as MappedLockGuard;

pub use std::lazy::OnceCell;
pub use std::cell::OnceCell;

use std::cell::RefCell as InnerRwLock;
use std::cell::RefCell as InnerLock;
Expand Down Expand Up @@ -258,7 +258,7 @@ cfg_if! {
pub use parking_lot::MutexGuard as LockGuard;
pub use parking_lot::MappedMutexGuard as MappedLockGuard;

pub use std::lazy::SyncOnceCell as OnceCell;
pub use std::sync::OnceLock as OnceCell;

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

Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ use std::env;
use std::ffi::OsString;
use std::fs;
use std::io::{self, Read, Write};
use std::lazy::SyncLazy;
use std::panic::{self, catch_unwind};
use std::path::PathBuf;
use std::process::{self, Command, Stdio};
use std::str;
use std::sync::LazyLock;
use std::time::Instant;

pub mod args;
Expand Down Expand Up @@ -1141,8 +1141,8 @@ pub fn catch_with_exit_code(f: impl FnOnce() -> interface::Result<()>) -> i32 {
}
}

static DEFAULT_HOOK: SyncLazy<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
SyncLazy::new(|| {
static DEFAULT_HOOK: LazyLock<Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static>> =
LazyLock::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
Expand Down Expand Up @@ -1237,7 +1237,7 @@ pub fn install_ice_hook() {
if std::env::var("RUST_BACKTRACE").is_err() {
std::env::set_var("RUST_BACKTRACE", "full");
}
SyncLazy::force(&DEFAULT_HOOK);
LazyLock::force(&DEFAULT_HOOK);
}

/// This allows tools to enable rust logging without having to magically match rustc's
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_error_messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use std::path::{Path, PathBuf};
use tracing::{instrument, trace};

#[cfg(not(parallel_compiler))]
use std::lazy::Lazy;
use std::cell::LazyCell as Lazy;
#[cfg(parallel_compiler)]
use std::lazy::SyncLazy as Lazy;
use std::sync::LazyLock as Lazy;

#[cfg(parallel_compiler)]
use intl_memoizer::concurrent::IntlLangMemoizer;
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{Features, Stability};
use rustc_data_structures::fx::FxHashMap;
use rustc_span::symbol::{sym, Symbol};

use std::lazy::SyncLazy;
use std::sync::LazyLock;

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

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

pub static BUILTIN_ATTRIBUTE_MAP: SyncLazy<FxHashMap<Symbol, &BuiltinAttribute>> =
SyncLazy::new(|| {
pub static BUILTIN_ATTRIBUTE_MAP: LazyLock<FxHashMap<Symbol, &BuiltinAttribute>> =
LazyLock::new(|| {
let mut map = FxHashMap::default();
for attr in BUILTIN_ATTRIBUTES.iter() {
if map.insert(attr.name, attr).is_some() {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use rustc_macros::HashStable_Generic;
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span;

use std::lazy::SyncLazy;
use std::sync::LazyLock;

pub enum LangItemGroup {
Op,
Expand Down Expand Up @@ -134,7 +134,7 @@ macro_rules! language_item_table {
}

/// A mapping from the name of the lang item to its order and the form it must be of.
pub static ITEM_REFS: SyncLazy<FxHashMap<Symbol, (usize, Target)>> = SyncLazy::new(|| {
pub static ITEM_REFS: LazyLock<FxHashMap<Symbol, (usize, Target)>> = LazyLock::new(|| {
let mut item_refs = FxHashMap::default();
$( item_refs.insert($module::$name, (LangItem::$variant as usize, $target)); )*
item_refs
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_hir/src/weak_lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use rustc_ast as ast;
use rustc_data_structures::stable_map::StableMap;
use rustc_span::symbol::{sym, Symbol};

use std::lazy::SyncLazy;
use std::sync::LazyLock;

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

pub static WEAK_ITEMS_REFS: SyncLazy<StableMap<Symbol, LangItem>> = SyncLazy::new(|| {
pub static WEAK_ITEMS_REFS: LazyLock<StableMap<Symbol, LangItem>> = LazyLock::new(|| {
let mut map = StableMap::default();
$(map.insert(sym::$name, LangItem::$item);)*
map
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_interface/src/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ use std::any::Any;
use std::cell::RefCell;
use std::ffi::OsString;
use std::io::{self, BufWriter, Write};
use std::lazy::SyncLazy;
use std::marker::PhantomPinned;
use std::path::{Path, PathBuf};
use std::pin::Pin;
use std::rc::Rc;
use std::sync::LazyLock;
use std::{env, fs, iter};

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

pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
pub static DEFAULT_QUERY_PROVIDERS: LazyLock<Providers> = LazyLock::new(|| {
let providers = &mut Providers::default();
providers.analysis = analysis;
proc_macro_decls::provide(providers);
Expand All @@ -799,7 +799,7 @@ pub static DEFAULT_QUERY_PROVIDERS: SyncLazy<Providers> = SyncLazy::new(|| {
*providers
});

pub static DEFAULT_EXTERN_QUERY_PROVIDERS: SyncLazy<ExternProviders> = SyncLazy::new(|| {
pub static DEFAULT_EXTERN_QUERY_PROVIDERS: LazyLock<ExternProviders> = LazyLock::new(|| {
let mut extern_providers = ExternProviders::default();
rustc_metadata::provide_extern(&mut extern_providers);
rustc_codegen_ssa::provide_extern(&mut extern_providers);
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ use rustc_span::source_map::FileLoader;
use rustc_span::symbol::{sym, Symbol};
use std::env;
use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
use std::lazy::SyncOnceCell;
use std::mem;
#[cfg(not(parallel_compiler))]
use std::panic;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::OnceLock;
use std::thread;
use tracing::info;

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

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

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

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_mir_dataflow/src/framework/graphviz.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A helpful diagram for debugging dataflow problems.

use std::borrow::Cow;
use std::lazy::SyncOnceCell;
use std::sync::OnceLock;
use std::{io, ops, str};

use regex::Regex;
Expand Down Expand Up @@ -590,7 +590,7 @@ where

macro_rules! regex {
($re:literal $(,)?) => {{
static RE: SyncOnceCell<regex::Regex> = SyncOnceCell::new();
static RE: OnceLock<regex::Regex> = OnceLock::new();
RE.get_or_init(|| Regex::new($re).unwrap())
}};
}
Expand Down
Loading

0 comments on commit 3b98c08

Please sign in to comment.