Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0a59f11

Browse files
committed
Auto merge of rust-lang#125552 - matthiaskrgr:rollup-f1yybpn, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#121377 (Stabilize `LazyCell` and `LazyLock`) - rust-lang#122986 (Fix c_char on AIX) - rust-lang#123803 (Fix `VecDeque::shrink_to` UB when `handle_alloc_error` unwinds.) - rust-lang#124080 (Some unstable changes to where opaque types get defined) - rust-lang#124667 (Stabilize `div_duration`) - rust-lang#125472 (tidy: validate LLVM component names in tests) - rust-lang#125523 (Exit the process a short time after entering our ctrl-c handler) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1ba35e9 + 0ded36f commit 0a59f11

File tree

76 files changed

+590
-222
lines changed

Some content is hidden

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

76 files changed

+590
-222
lines changed

compiler/rustc_const_eval/src/check_consts/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
309309
}
310310

311311
if let ConstContext::Static(_) = ccx.const_kind() {
312-
err.note("consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell");
312+
err.note("consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`");
313313
}
314314

315315
err

compiler/rustc_data_structures/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(extend_one)]
2525
#![feature(hash_raw_entry)]
2626
#![feature(hasher_prefixfree_extras)]
27-
#![feature(lazy_cell)]
2827
#![feature(lint_reasons)]
2928
#![feature(macro_metavar_expr)]
3029
#![feature(map_try_insert)]

compiler/rustc_driver_impl/src/lib.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use std::process::{self, Command, Stdio};
5757
use std::str;
5858
use std::sync::atomic::{AtomicBool, Ordering};
5959
use std::sync::{Arc, OnceLock};
60-
use std::time::{Instant, SystemTime};
60+
use std::time::{Duration, Instant, SystemTime};
6161
use time::OffsetDateTime;
6262
use tracing::trace;
6363

@@ -1502,14 +1502,13 @@ pub fn init_logger(early_dcx: &EarlyDiagCtxt, cfg: rustc_log::LoggerConfig) {
15021502
pub fn install_ctrlc_handler() {
15031503
#[cfg(not(target_family = "wasm"))]
15041504
ctrlc::set_handler(move || {
1505-
// Indicate that we have been signaled to stop. If we were already signaled, exit
1506-
// immediately. In our interpreter loop we try to consult this value often, but if for
1507-
// whatever reason we don't get to that check or the cleanup we do upon finding that
1508-
// this bool has become true takes a long time, the exit here will promptly exit the
1509-
// process on the second Ctrl-C.
1510-
if CTRL_C_RECEIVED.swap(true, Ordering::Relaxed) {
1511-
std::process::exit(1);
1512-
}
1505+
// Indicate that we have been signaled to stop, then give the rest of the compiler a bit of
1506+
// time to check CTRL_C_RECEIVED and run its own shutdown logic, but after a short amount
1507+
// of time exit the process. This sleep+exit ensures that even if nobody is checking
1508+
// CTRL_C_RECEIVED, the compiler exits reasonably promptly.
1509+
CTRL_C_RECEIVED.store(true, Ordering::Relaxed);
1510+
std::thread::sleep(Duration::from_millis(100));
1511+
std::process::exit(1);
15131512
})
15141513
.expect("Unable to install ctrlc handler");
15151514
}

compiler/rustc_error_messages/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![doc(rust_logo)]
22
#![feature(rustdoc_internals)]
3-
#![feature(lazy_cell)]
43
#![feature(rustc_attrs)]
54
#![feature(type_alias_impl_trait)]
65
#![allow(internal_features)]

compiler/rustc_feature/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![allow(internal_features)]
1515
#![feature(rustdoc_internals)]
1616
#![doc(rust_logo)]
17-
#![feature(lazy_cell)]
1817

1918
mod accepted;
2019
mod builtin_attrs;

compiler/rustc_hir_analysis/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ This API is completely unstable and subject to change.
6868
#![feature(iter_intersperse)]
6969
#![feature(let_chains)]
7070
#![feature(never_type)]
71-
#![feature(lazy_cell)]
7271
#![feature(slice_partition_dedup)]
7372
#![feature(try_blocks)]
7473

compiler/rustc_interface/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(decl_macro)]
2-
#![feature(lazy_cell)]
32
#![feature(let_chains)]
43
#![feature(thread_spawn_unchecked)]
54
#![feature(try_blocks)]

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,10 +1316,8 @@ declare_lint! {
13161316
/// * If you are trying to perform a one-time initialization of a global:
13171317
/// * If the value can be computed at compile-time, consider using
13181318
/// const-compatible values (see [Constant Evaluation]).
1319-
/// * For more complex single-initialization cases, consider using a
1320-
/// third-party crate, such as [`lazy_static`] or [`once_cell`].
1321-
/// * If you are using the [nightly channel], consider the new
1322-
/// [`lazy`] module in the standard library.
1319+
/// * For more complex single-initialization cases, consider using
1320+
/// [`std::sync::LazyLock`].
13231321
/// * If you truly need a mutable global, consider using a [`static`],
13241322
/// which has a variety of options:
13251323
/// * Simple data types can be directly defined and mutated with an
@@ -1334,9 +1332,7 @@ declare_lint! {
13341332
/// [Constant Evaluation]: https://doc.rust-lang.org/reference/const_eval.html
13351333
/// [`static`]: https://doc.rust-lang.org/reference/items/static-items.html
13361334
/// [mutable `static`]: https://doc.rust-lang.org/reference/items/static-items.html#mutable-statics
1337-
/// [`lazy`]: https://doc.rust-lang.org/nightly/std/lazy/index.html
1338-
/// [`lazy_static`]: https://crates.io/crates/lazy_static
1339-
/// [`once_cell`]: https://crates.io/crates/once_cell
1335+
/// [`std::sync::LazyLock`]: https://doc.rust-lang.org/stable/std/sync/struct.LazyLock.html
13401336
/// [`atomic`]: https://doc.rust-lang.org/std/sync/atomic/index.html
13411337
/// [`Mutex`]: https://doc.rust-lang.org/std/sync/struct.Mutex.html
13421338
pub CONST_ITEM_MUTATION,

compiler/rustc_session/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(let_chains)]
2-
#![feature(lazy_cell)]
32
#![feature(option_get_or_insert_default)]
43
#![feature(rustc_attrs)]
54
#![feature(map_many_mut)]

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,7 +2539,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
25392539
let InferOk { obligations, .. } = self
25402540
.infcx
25412541
.at(&cause, obligation.param_env)
2542-
.eq(DefineOpaqueTypes::No, placeholder_obligation_trait_ref, impl_trait_ref)
2542+
.eq(DefineOpaqueTypes::Yes, placeholder_obligation_trait_ref, impl_trait_ref)
25432543
.map_err(|e| {
25442544
debug!("match_impl: failed eq_trait_refs due to `{}`", e.to_string(self.tcx()))
25452545
})?;
@@ -2594,7 +2594,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
25942594
self.infcx
25952595
.at(&obligation.cause, obligation.param_env)
25962596
.eq(
2597-
DefineOpaqueTypes::No,
2597+
DefineOpaqueTypes::Yes,
25982598
upcast_principal.map_bound(|trait_ref| {
25992599
ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)
26002600
}),
@@ -2631,7 +2631,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
26312631
nested.extend(
26322632
self.infcx
26332633
.at(&obligation.cause, obligation.param_env)
2634-
.eq(DefineOpaqueTypes::No, source_projection, target_projection)
2634+
.eq(DefineOpaqueTypes::Yes, source_projection, target_projection)
26352635
.map_err(|_| SelectionError::Unimplemented)?
26362636
.into_obligations(),
26372637
);

0 commit comments

Comments
 (0)