Skip to content

Commit 0e33ae2

Browse files
committed
Auto merge of #142656 - jhpratt:rollup-46k4zk0, r=jhpratt
Rollup of 10 pull requests Successful merges: - #135656 (Add `-Z hint-mostly-unused` to tell rustc that most of a crate will go unused) - #138237 (Get rid of `EscapeDebugInner`.) - #140772 ({aarch64,x86_64}-pc-windows-gnullvm: build host tools) - #140774 (Affirm `-Cforce-frame-pointers=off` does not override) - #141610 (Stabilize `feature(generic_arg_infer)`) - #141864 (Handle win32 separator for cygwin paths) - #142384 (Bringing `rustc_rayon_core` in tree as `rustc_thread_pool`) - #142502 (rustdoc_json: improve handling of generic args) - #142571 (Reason about borrowed classes in CopyProp.) - #142591 (Add spawn APIs for BootstrapCommand to support deferred command execution) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 27733d4 + d593e72 commit 0e33ae2

File tree

152 files changed

+9599
-862
lines changed

Some content is hidden

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

152 files changed

+9599
-862
lines changed

Cargo.lock

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,6 +2983,15 @@ dependencies = [
29832983
"getrandom 0.3.3",
29842984
]
29852985

2986+
[[package]]
2987+
name = "rand_xorshift"
2988+
version = "0.4.0"
2989+
source = "registry+https://github.com/rust-lang/crates.io-index"
2990+
checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a"
2991+
dependencies = [
2992+
"rand_core 0.9.3",
2993+
]
2994+
29862995
[[package]]
29872996
name = "rand_xoshiro"
29882997
version = "0.7.0"
@@ -3182,16 +3191,6 @@ dependencies = [
31823191
"tikv-jemalloc-sys",
31833192
]
31843193

3185-
[[package]]
3186-
name = "rustc-rayon-core"
3187-
version = "0.5.1"
3188-
source = "registry+https://github.com/rust-lang/crates.io-index"
3189-
checksum = "2f42932dcd3bcbe484b38a3ccf79b7906fac41c02d408b5b1bac26da3416efdb"
3190-
dependencies = [
3191-
"crossbeam-deque",
3192-
"crossbeam-utils",
3193-
]
3194-
31953194
[[package]]
31963195
name = "rustc-semver"
31973196
version = "1.1.0"
@@ -3560,14 +3559,14 @@ dependencies = [
35603559
"parking_lot",
35613560
"portable-atomic",
35623561
"rustc-hash 2.1.1",
3563-
"rustc-rayon-core",
35643562
"rustc-stable-hash",
35653563
"rustc_arena",
35663564
"rustc_graphviz",
35673565
"rustc_hashes",
35683566
"rustc_index",
35693567
"rustc_macros",
35703568
"rustc_serialize",
3569+
"rustc_thread_pool",
35713570
"smallvec",
35723571
"stacker",
35733572
"tempfile",
@@ -3915,7 +3914,6 @@ dependencies = [
39153914
name = "rustc_interface"
39163915
version = "0.0.0"
39173916
dependencies = [
3918-
"rustc-rayon-core",
39193917
"rustc_abi",
39203918
"rustc_ast",
39213919
"rustc_ast_lowering",
@@ -3954,6 +3952,7 @@ dependencies = [
39543952
"rustc_span",
39553953
"rustc_symbol_mangling",
39563954
"rustc_target",
3955+
"rustc_thread_pool",
39573956
"rustc_trait_selection",
39583957
"rustc_traits",
39593958
"rustc_ty_utils",
@@ -4081,7 +4080,6 @@ dependencies = [
40814080
"either",
40824081
"gsgdt",
40834082
"polonius-engine",
4084-
"rustc-rayon-core",
40854083
"rustc_abi",
40864084
"rustc_apfloat",
40874085
"rustc_arena",
@@ -4105,6 +4103,7 @@ dependencies = [
41054103
"rustc_session",
41064104
"rustc_span",
41074105
"rustc_target",
4106+
"rustc_thread_pool",
41084107
"rustc_type_ir",
41094108
"smallvec",
41104109
"thin-vec",
@@ -4351,7 +4350,6 @@ version = "0.0.0"
43514350
dependencies = [
43524351
"hashbrown",
43534352
"parking_lot",
4354-
"rustc-rayon-core",
43554353
"rustc_abi",
43564354
"rustc_ast",
43574355
"rustc_attr_data_structures",
@@ -4366,6 +4364,7 @@ dependencies = [
43664364
"rustc_serialize",
43674365
"rustc_session",
43684366
"rustc_span",
4367+
"rustc_thread_pool",
43694368
"smallvec",
43704369
"tracing",
43714370
]
@@ -4527,6 +4526,18 @@ dependencies = [
45274526
"tracing",
45284527
]
45294528

4529+
[[package]]
4530+
name = "rustc_thread_pool"
4531+
version = "0.0.0"
4532+
dependencies = [
4533+
"crossbeam-deque",
4534+
"crossbeam-utils",
4535+
"libc",
4536+
"rand 0.9.1",
4537+
"rand_xorshift",
4538+
"scoped-tls",
4539+
]
4540+
45304541
[[package]]
45314542
name = "rustc_tools_util"
45324543
version = "0.4.2"

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ exclude = [
6060
"obj",
6161
]
6262

63-
[profile.release.package.rustc-rayon-core]
63+
[profile.release.package.rustc_thread_pool]
6464
# The rustc fork of Rayon has deadlock detection code which intermittently
6565
# causes overflows in the CI (see https://github.com/rust-lang/rust/issues/90227)
6666
# so we turn overflow checks off for now.

compiler/rustc_ast_lowering/messages.ftl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ ast_lowering_template_modifier = template modifier
172172
173173
ast_lowering_this_not_async = this is not `async`
174174
175-
ast_lowering_underscore_array_length_unstable =
176-
using `_` for array lengths is unstable
177-
178175
ast_lowering_underscore_expr_lhs_assign =
179176
in expressions, `_` can only be used on the left-hand side of an assignment
180177
.label = `_` not allowed here

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use rustc_data_structures::sorted_map::SortedMap;
4848
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
4949
use rustc_data_structures::sync::spawn;
5050
use rustc_data_structures::tagged_ptr::TaggedRef;
51-
use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, StashKey};
51+
use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle};
5252
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
5353
use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId};
5454
use rustc_hir::lints::DelayedLint;
@@ -60,7 +60,7 @@ use rustc_index::{Idx, IndexSlice, IndexVec};
6060
use rustc_macros::extension;
6161
use rustc_middle::span_bug;
6262
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
63-
use rustc_session::parse::{add_feature_diagnostics, feature_err};
63+
use rustc_session::parse::add_feature_diagnostics;
6464
use rustc_span::symbol::{Ident, Symbol, kw, sym};
6565
use rustc_span::{DUMMY_SP, DesugaringKind, Span};
6666
use smallvec::SmallVec;
@@ -2109,15 +2109,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21092109
// `ExprKind::Paren(ExprKind::Underscore)` and should also be lowered to `GenericArg::Infer`
21102110
match c.value.peel_parens().kind {
21112111
ExprKind::Underscore => {
2112-
if !self.tcx.features().generic_arg_infer() {
2113-
feature_err(
2114-
&self.tcx.sess,
2115-
sym::generic_arg_infer,
2116-
c.value.span,
2117-
fluent_generated::ast_lowering_underscore_array_length_unstable,
2118-
)
2119-
.stash(c.value.span, StashKey::UnderscoreForArrayLengths);
2120-
}
21212112
let ct_kind = hir::ConstArgKind::Infer(self.lower_span(c.value.span), ());
21222113
self.arena.alloc(hir::ConstArg { hir_id: self.lower_node_id(c.id), kind: ct_kind })
21232114
}

compiler/rustc_data_structures/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ indexmap = "2.4.0"
1414
jobserver_crate = { version = "0.1.28", package = "jobserver" }
1515
measureme = "12.0.1"
1616
rustc-hash = "2.0.0"
17-
rustc-rayon-core = { version = "0.5.0" }
1817
rustc-stable-hash = { version = "0.1.0", features = ["nightly"] }
1918
rustc_arena = { path = "../rustc_arena" }
2019
rustc_graphviz = { path = "../rustc_graphviz" }
2120
rustc_hashes = { path = "../rustc_hashes" }
2221
rustc_index = { path = "../rustc_index", package = "rustc_index" }
2322
rustc_macros = { path = "../rustc_macros" }
2423
rustc_serialize = { path = "../rustc_serialize" }
24+
rustc_thread_pool = { path = "../rustc_thread_pool" }
2525
smallvec = { version = "1.8.1", features = ["const_generics", "union", "may_dangle"] }
2626
stacker = "0.1.17"
2727
tempfile = "3.2"

compiler/rustc_data_structures/src/sync.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
//! | | | `parking_lot::Mutex<T>` |
2323
//! | `RwLock<T>` | `RefCell<T>` | `parking_lot::RwLock<T>` |
2424
//! | `MTLock<T>` [^1] | `T` | `Lock<T>` |
25-
//! | | | |
26-
//! | `ParallelIterator` | `Iterator` | `rayon::iter::ParallelIterator` |
2725
//!
2826
//! [^1]: `MTLock` is similar to `Lock`, but the serial version avoids the cost
2927
//! of a `RefCell`. This is appropriate when interior mutability is not

compiler/rustc_data_structures/src/sync/parallel.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ macro_rules! parallel {
9696
pub fn spawn(func: impl FnOnce() + DynSend + 'static) {
9797
if mode::is_dyn_thread_safe() {
9898
let func = FromDyn::from(func);
99-
rayon_core::spawn(|| {
99+
rustc_thread_pool::spawn(|| {
100100
(func.into_inner())();
101101
});
102102
} else {
@@ -107,11 +107,11 @@ pub fn spawn(func: impl FnOnce() + DynSend + 'static) {
107107
// This function only works when `mode::is_dyn_thread_safe()`.
108108
pub fn scope<'scope, OP, R>(op: OP) -> R
109109
where
110-
OP: FnOnce(&rayon_core::Scope<'scope>) -> R + DynSend,
110+
OP: FnOnce(&rustc_thread_pool::Scope<'scope>) -> R + DynSend,
111111
R: DynSend,
112112
{
113113
let op = FromDyn::from(op);
114-
rayon_core::scope(|s| FromDyn::from(op.into_inner()(s))).into_inner()
114+
rustc_thread_pool::scope(|s| FromDyn::from(op.into_inner()(s))).into_inner()
115115
}
116116

117117
#[inline]
@@ -124,7 +124,7 @@ where
124124
let oper_a = FromDyn::from(oper_a);
125125
let oper_b = FromDyn::from(oper_b);
126126
let (a, b) = parallel_guard(|guard| {
127-
rayon_core::join(
127+
rustc_thread_pool::join(
128128
move || guard.run(move || FromDyn::from(oper_a.into_inner()())),
129129
move || guard.run(move || FromDyn::from(oper_b.into_inner()())),
130130
)
@@ -158,7 +158,7 @@ fn par_slice<I: DynSend>(
158158
let (left, right) = items.split_at_mut(items.len() / 2);
159159
let mut left = state.for_each.derive(left);
160160
let mut right = state.for_each.derive(right);
161-
rayon_core::join(move || par_rec(*left, state), move || par_rec(*right, state));
161+
rustc_thread_pool::join(move || par_rec(*left, state), move || par_rec(*right, state));
162162
}
163163
}
164164

@@ -241,7 +241,7 @@ pub fn par_map<I: DynSend, T: IntoIterator<Item = I>, R: DynSend, C: FromIterato
241241
pub fn broadcast<R: DynSend>(op: impl Fn(usize) -> R + DynSync) -> Vec<R> {
242242
if mode::is_dyn_thread_safe() {
243243
let op = FromDyn::from(op);
244-
let results = rayon_core::broadcast(|context| op.derive(op(context.index())));
244+
let results = rustc_thread_pool::broadcast(|context| op.derive(op(context.index())));
245245
results.into_iter().map(|r| r.into_inner()).collect()
246246
} else {
247247
vec![op(0)]

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ declare_features! (
220220
(accepted, fn_must_use, "1.27.0", Some(43302)),
221221
/// Allows capturing variables in scope using format_args!
222222
(accepted, format_args_capture, "1.58.0", Some(67984)),
223+
/// Infer generic args for both consts and types.
224+
(accepted, generic_arg_infer, "CURRENT_RUSTC_VERSION", Some(85077)),
223225
/// Allows associated types to be generic, e.g., `type Foo<T>;` (RFC 1598).
224226
(accepted, generic_associated_types, "1.65.0", Some(44265)),
225227
/// Allows attributes on lifetime/type formal parameters in generics (RFC 1327).

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,6 @@ declare_features! (
520520
(unstable, frontmatter, "1.88.0", Some(136889)),
521521
/// Allows defining gen blocks and `gen fn`.
522522
(unstable, gen_blocks, "1.75.0", Some(117078)),
523-
/// Infer generic args for both consts and types.
524-
(unstable, generic_arg_infer, "1.55.0", Some(85077)),
525523
/// Allows non-trivial generic constants which have to have wfness manually propagated to callers
526524
(incomplete, generic_const_exprs, "1.56.0", Some(76560)),
527525
/// Allows generic parameters and where-clauses on free & associated const items.

compiler/rustc_hir_analysis/src/collect/type_of.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,6 @@ fn infer_placeholder_type<'tcx>(
452452
if let Some(ty) = node.ty() {
453453
visitor.visit_ty_unambig(ty);
454454
}
455-
// If we have just one span, let's try to steal a const `_` feature error.
456-
let try_steal_span = if !tcx.features().generic_arg_infer() && visitor.spans.len() == 1
457-
{
458-
visitor.spans.first().copied()
459-
} else {
460-
None
461-
};
462455
// If we didn't find any infer tys, then just fallback to `span`.
463456
if visitor.spans.is_empty() {
464457
visitor.spans.push(span);
@@ -489,15 +482,7 @@ fn infer_placeholder_type<'tcx>(
489482
}
490483
}
491484

492-
if let Some(try_steal_span) = try_steal_span {
493-
cx.dcx().try_steal_replace_and_emit_err(
494-
try_steal_span,
495-
StashKey::UnderscoreForArrayLengths,
496-
diag,
497-
)
498-
} else {
499-
diag.emit()
500-
}
485+
diag.emit()
501486
});
502487
Ty::new_error(tcx, guar)
503488
}

compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_middle::ty::{
88
self, GenericArgsRef, GenericParamDef, GenericParamDefKind, IsSuggestable, Ty,
99
};
1010
use rustc_session::lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS;
11-
use rustc_span::{kw, sym};
11+
use rustc_span::kw;
1212
use smallvec::SmallVec;
1313
use tracing::{debug, instrument};
1414

@@ -258,19 +258,6 @@ pub fn lower_generic_args<'tcx: 'a, 'a>(
258258
GenericParamDefKind::Const { .. },
259259
_,
260260
) => {
261-
if let GenericParamDefKind::Const { .. } = param.kind
262-
&& let GenericArg::Infer(inf) = arg
263-
&& !tcx.features().generic_arg_infer()
264-
{
265-
rustc_session::parse::feature_err(
266-
tcx.sess,
267-
sym::generic_arg_infer,
268-
inf.span,
269-
"const arguments cannot yet be inferred with `_`",
270-
)
271-
.emit();
272-
}
273-
274261
// We lower to an infer even when the feature gate is not enabled
275262
// as it is useful for diagnostics to be able to see a `ConstKind::Infer`
276263
args.push(ctx.provided_kind(&args, param, arg));

compiler/rustc_interface/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ edition = "2024"
55

66
[dependencies]
77
# tidy-alphabetical-start
8-
rustc-rayon-core = { version = "0.5.0" }
98
rustc_ast = { path = "../rustc_ast" }
109
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
1110
rustc_ast_passes = { path = "../rustc_ast_passes" }
@@ -43,6 +42,7 @@ rustc_session = { path = "../rustc_session" }
4342
rustc_span = { path = "../rustc_span" }
4443
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
4544
rustc_target = { path = "../rustc_target" }
45+
rustc_thread_pool = { path = "../rustc_thread_pool" }
4646
rustc_trait_selection = { path = "../rustc_trait_selection" }
4747
rustc_traits = { path = "../rustc_traits" }
4848
rustc_ty_utils = { path = "../rustc_ty_utils" }

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ fn test_unstable_options_tracking_hash() {
802802
tracked!(force_unstable_if_unmarked, true);
803803
tracked!(function_return, FunctionReturn::ThunkExtern);
804804
tracked!(function_sections, Some(false));
805+
tracked!(hint_mostly_unused, true);
805806
tracked!(human_readable_cgu_names, true);
806807
tracked!(incremental_ignore_spans, true);
807808
tracked!(inline_mir, Some(true));

compiler/rustc_interface/src/util.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
208208

209209
let proxy_ = Arc::clone(&proxy);
210210
let proxy__ = Arc::clone(&proxy);
211-
let builder = rayon_core::ThreadPoolBuilder::new()
211+
let builder = rustc_thread_pool::ThreadPoolBuilder::new()
212212
.thread_name(|_| "rustc".to_string())
213213
.acquire_thread_handler(move || proxy_.acquire_thread())
214214
.release_thread_handler(move || proxy__.release_thread())
@@ -218,7 +218,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
218218
// locals to it. The new thread runs the deadlock handler.
219219

220220
let current_gcx2 = current_gcx2.clone();
221-
let registry = rayon_core::Registry::current();
221+
let registry = rustc_thread_pool::Registry::current();
222222
let session_globals = rustc_span::with_session_globals(|session_globals| {
223223
session_globals as *const SessionGlobals as usize
224224
});
@@ -265,7 +265,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
265265
builder
266266
.build_scoped(
267267
// Initialize each new worker thread when created.
268-
move |thread: rayon_core::ThreadBuilder| {
268+
move |thread: rustc_thread_pool::ThreadBuilder| {
269269
// Register the thread for use with the `WorkerLocal` type.
270270
registry.register();
271271

@@ -274,7 +274,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
274274
})
275275
},
276276
// Run `f` on the first thread in the thread pool.
277-
move |pool: &rayon_core::ThreadPool| {
277+
move |pool: &rustc_thread_pool::ThreadPool| {
278278
pool.install(|| f(current_gcx.into_inner(), proxy))
279279
},
280280
)

compiler/rustc_middle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ bitflags = "2.4.1"
99
either = "1.5.0"
1010
gsgdt = "0.1.2"
1111
polonius-engine = "0.13.0"
12-
rustc-rayon-core = { version = "0.5.0" }
1312
rustc_abi = { path = "../rustc_abi" }
1413
rustc_apfloat = "0.2.0"
1514
rustc_arena = { path = "../rustc_arena" }
@@ -33,6 +32,7 @@ rustc_serialize = { path = "../rustc_serialize" }
3332
rustc_session = { path = "../rustc_session" }
3433
rustc_span = { path = "../rustc_span" }
3534
rustc_target = { path = "../rustc_target" }
35+
rustc_thread_pool = { path = "../rustc_thread_pool" }
3636
rustc_type_ir = { path = "../rustc_type_ir" }
3737
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
3838
thin-vec = "0.2.12"

0 commit comments

Comments
 (0)