Skip to content

Commit dfbfbf7

Browse files
committed
Auto merge of #152755 - jdonszelmann:rollup-hcFNB2j, r=jdonszelmann
Rollup of 6 pull requests Successful merges: - #152609 (Install LLVM DLL in the right place on Windows) - #149904 (`-Znext-solver` Remove the forced ambiguity hack from search graph) - #152704 (Remove `QueryCtxt` and trait `HasDepContext`) - #152746 (remove `#![allow(stable_features)]` from most tests) - #152675 (Improve `VaList` stdlib docs) - #152748 (Update `sysinfo` version to `0.38.2`)
2 parents 3f6250a + 8d26ccc commit dfbfbf7

58 files changed

Lines changed: 368 additions & 450 deletions

File tree

Some content is hidden

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

Cargo.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,9 +2652,9 @@ dependencies = [
26522652

26532653
[[package]]
26542654
name = "objc2-core-foundation"
2655-
version = "0.3.2"
2655+
version = "0.3.1"
26562656
source = "registry+https://github.com/rust-lang/crates.io-index"
2657-
checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
2657+
checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
26582658
dependencies = [
26592659
"bitflags",
26602660
]
@@ -2667,9 +2667,9 @@ checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33"
26672667

26682668
[[package]]
26692669
name = "objc2-io-kit"
2670-
version = "0.3.2"
2670+
version = "0.3.1"
26712671
source = "registry+https://github.com/rust-lang/crates.io-index"
2672-
checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15"
2672+
checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a"
26732673
dependencies = [
26742674
"libc",
26752675
"objc2-core-foundation",
@@ -5354,9 +5354,9 @@ dependencies = [
53545354

53555355
[[package]]
53565356
name = "sysinfo"
5357-
version = "0.38.0"
5357+
version = "0.38.2"
53585358
source = "registry+https://github.com/rust-lang/crates.io-index"
5359-
checksum = "fe840c5b1afe259a5657392a4dbb74473a14c8db999c3ec2f4ae812e028a94da"
5359+
checksum = "1efc19935b4b66baa6f654ac7924c192f55b175c00a7ab72410fc24284dacda8"
53605360
dependencies = [
53615361
"libc",
53625362
"objc2-core-foundation",

compiler/rustc_feature/src/accepted.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ declare_features! (
2525
// feature-group-start: for testing purposes
2626
// -------------------------------------------------------------------------
2727

28-
/// A temporary feature gate used to enable parser extensions needed
29-
/// to bootstrap fix for #5723.
30-
(accepted, issue_5723_bootstrap, "1.0.0", None),
3128
/// These are used to test this portion of the compiler,
3229
/// they don't actually mean anything.
3330
(accepted, test_accepted_feature, "1.0.0", None),

compiler/rustc_feature/src/removed.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ declare_features! (
172172
/// Allow anonymous constants from an inline `const` block in pattern position
173173
(removed, inline_const_pat, "1.88.0", Some(76001),
174174
Some("removed due to implementation concerns as it requires significant refactorings"), 138492),
175+
/// A temporary feature gate used to enable parser extensions needed
176+
/// to bootstrap fix for #5723.
177+
(removed, issue_5723_bootstrap, "CURRENT_RUSTC_VERSION", None, None),
175178
/// Lazily evaluate constants. This allows constants to depend on type parameters.
176179
(removed, lazy_normalization_consts, "1.56.0", Some(72219), Some("superseded by `generic_const_exprs`"), 88369),
177180
/// Changes `impl Trait` to capture all lifetimes in scope.

compiler/rustc_interface/src/interface.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_parse::lexer::StripTokens;
1616
use rustc_parse::new_parser_from_source_str;
1717
use rustc_parse::parser::Recovery;
1818
use rustc_parse::parser::attr::AllowLeadingUnsafe;
19-
use rustc_query_impl::{QueryCtxt, print_query_stack};
19+
use rustc_query_impl::print_query_stack;
2020
use rustc_session::config::{self, Cfg, CheckCfg, ExpectedValues, Input, OutFileName};
2121
use rustc_session::parse::ParseSess;
2222
use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, lint};
@@ -556,7 +556,7 @@ pub fn try_print_query_stack(
556556
let all_frames = ty::tls::with_context_opt(|icx| {
557557
if let Some(icx) = icx {
558558
ty::print::with_no_queries!(print_query_stack(
559-
QueryCtxt::new(icx.tcx),
559+
icx.tcx,
560560
icx.query,
561561
dcx,
562562
limit_frames,

compiler/rustc_interface/src/util.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use rustc_data_structures::sync;
1818
use rustc_metadata::{DylibError, EncodedMetadata, load_symbol_from_dylib};
1919
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
2020
use rustc_middle::ty::{CurrentGcx, TyCtxt};
21+
use rustc_query_impl::collect_active_jobs_from_all_queries;
2122
use rustc_session::config::{
2223
Cfg, CrateType, OutFileName, OutputFilenames, OutputTypes, Sysroot, host_tuple,
2324
};
@@ -184,7 +185,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
184185
use rustc_data_structures::defer;
185186
use rustc_data_structures::sync::FromDyn;
186187
use rustc_middle::ty::tls;
187-
use rustc_query_impl::{QueryCtxt, break_query_cycles};
188+
use rustc_query_impl::break_query_cycles;
188189

189190
let thread_stack_size = init_stack_size(thread_builder_diag);
190191

@@ -253,7 +254,7 @@ internal compiler error: query cycle handler thread panicked, aborting process";
253254
|| {
254255
// Ensure there were no errors collecting all active jobs.
255256
// We need the complete map to ensure we find a cycle to break.
256-
QueryCtxt::new(tcx).collect_active_jobs_from_all_queries(false).expect(
257+
collect_active_jobs_from_all_queries(tcx, false).expect(
257258
"failed to collect active queries in deadlock handler",
258259
)
259260
},

compiler/rustc_metadata/src/native_libs.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ pub fn walk_native_lib_search_dirs<R>(
6161
// library directory instead of the self-contained directories.
6262
// Sanitizer libraries have the same issue and are also linked by name on Apple targets.
6363
// The targets here should be in sync with `copy_third_party_objects` in bootstrap.
64+
// Finally there is shared LLVM library, which unlike compiler libraries, is linked by the name,
65+
// therefore requiring the search path for the linker.
6466
// FIXME: implement `-Clink-self-contained=+/-unwind,+/-sanitizers`, move the shipped libunwind
6567
// and sanitizers to self-contained directory, and stop adding this search path.
6668
// FIXME: On AIX this also has the side-effect of making the list of library search paths
@@ -71,6 +73,9 @@ pub fn walk_native_lib_search_dirs<R>(
7173
|| sess.target.os == Os::Fuchsia
7274
|| sess.target.is_like_aix
7375
|| sess.target.is_like_darwin && !sess.sanitizers().is_empty()
76+
|| sess.target.os == Os::Windows
77+
&& sess.target.env == Env::Gnu
78+
&& sess.target.abi == Abi::Llvm
7479
{
7580
f(&sess.target_tlib_path.dir, false)?;
7681
}

compiler/rustc_middle/src/dep_graph/graph.rs

Lines changed: 31 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use {super::debug::EdgeFilter, std::env};
2323

2424
use super::query::DepGraphQuery;
2525
use super::serialized::{GraphEncoder, SerializedDepGraph, SerializedDepNodeIndex};
26-
use super::{DepKind, DepNode, HasDepContext, WorkProductId, read_deps, with_deps};
26+
use super::{DepKind, DepNode, WorkProductId, read_deps, with_deps};
2727
use crate::dep_graph::edges::EdgesVec;
2828
use crate::ich::StableHashingContext;
2929
use crate::ty::TyCtxt;
@@ -268,17 +268,17 @@ impl DepGraph {
268268
}
269269

270270
#[inline(always)]
271-
pub fn with_task<'tcx, Ctxt: HasDepContext<'tcx>, A: Debug, R>(
271+
pub fn with_task<'tcx, A: Debug, R>(
272272
&self,
273-
key: DepNode,
274-
cx: Ctxt,
275-
arg: A,
276-
task: fn(Ctxt, A) -> R,
273+
dep_node: DepNode,
274+
tcx: TyCtxt<'tcx>,
275+
task_arg: A,
276+
task_fn: fn(tcx: TyCtxt<'tcx>, task_arg: A) -> R,
277277
hash_result: Option<fn(&mut StableHashingContext<'_>, &R) -> Fingerprint>,
278278
) -> (R, DepNodeIndex) {
279279
match self.data() {
280-
Some(data) => data.with_task(key, cx, arg, task, hash_result),
281-
None => (task(cx, arg), self.next_virtual_depnode_index()),
280+
Some(data) => data.with_task(dep_node, tcx, task_arg, task_fn, hash_result),
281+
None => (task_fn(tcx, task_arg), self.next_virtual_depnode_index()),
282282
}
283283
}
284284

@@ -310,66 +310,50 @@ impl DepGraphData {
310310
/// prevent implicit 'leaks' of tracked state into the task (which
311311
/// could then be read without generating correct edges in the
312312
/// dep-graph -- see the [rustc dev guide] for more details on
313-
/// the dep-graph). To this end, the task function gets exactly two
314-
/// pieces of state: the context `cx` and an argument `arg`. Both
315-
/// of these bits of state must be of some type that implements
316-
/// `DepGraphSafe` and hence does not leak.
317-
///
318-
/// The choice of two arguments is not fundamental. One argument
319-
/// would work just as well, since multiple values can be
320-
/// collected using tuples. However, using two arguments works out
321-
/// to be quite convenient, since it is common to need a context
322-
/// (`cx`) and some argument (e.g., a `DefId` identifying what
323-
/// item to process).
313+
/// the dep-graph).
324314
///
325-
/// For cases where you need some other number of arguments:
326-
///
327-
/// - If you only need one argument, just use `()` for the `arg`
328-
/// parameter.
329-
/// - If you need 3+ arguments, use a tuple for the
330-
/// `arg` parameter.
315+
/// Therefore, the task function takes a `TyCtxt`, plus exactly one
316+
/// additional argument, `task_arg`. The additional argument type can be
317+
/// `()` if no argument is needed, or a tuple if multiple arguments are
318+
/// needed.
331319
///
332320
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/queries/incremental-compilation.html
333321
#[inline(always)]
334-
pub fn with_task<'tcx, Ctxt: HasDepContext<'tcx>, A: Debug, R>(
322+
pub fn with_task<'tcx, A: Debug, R>(
335323
&self,
336-
key: DepNode,
337-
cx: Ctxt,
338-
arg: A,
339-
task: fn(Ctxt, A) -> R,
324+
dep_node: DepNode,
325+
tcx: TyCtxt<'tcx>,
326+
task_arg: A,
327+
task_fn: fn(tcx: TyCtxt<'tcx>, task_arg: A) -> R,
340328
hash_result: Option<fn(&mut StableHashingContext<'_>, &R) -> Fingerprint>,
341329
) -> (R, DepNodeIndex) {
342330
// If the following assertion triggers, it can have two reasons:
343331
// 1. Something is wrong with DepNode creation, either here or
344332
// in `DepGraph::try_mark_green()`.
345333
// 2. Two distinct query keys get mapped to the same `DepNode`
346334
// (see for example #48923).
347-
self.assert_dep_node_not_yet_allocated_in_current_session(
348-
cx.dep_context().sess,
349-
&key,
350-
|| {
351-
format!(
352-
"forcing query with already existing `DepNode`\n\
353-
- query-key: {arg:?}\n\
354-
- dep-node: {key:?}"
355-
)
356-
},
357-
);
335+
self.assert_dep_node_not_yet_allocated_in_current_session(tcx.sess, &dep_node, || {
336+
format!(
337+
"forcing query with already existing `DepNode`\n\
338+
- query-key: {task_arg:?}\n\
339+
- dep-node: {dep_node:?}"
340+
)
341+
});
358342

359-
let with_deps = |task_deps| with_deps(task_deps, || task(cx, arg));
360-
let (result, edges) = if cx.dep_context().is_eval_always(key.kind) {
343+
let with_deps = |task_deps| with_deps(task_deps, || task_fn(tcx, task_arg));
344+
let (result, edges) = if tcx.is_eval_always(dep_node.kind) {
361345
(with_deps(TaskDepsRef::EvalAlways), EdgesVec::new())
362346
} else {
363347
let task_deps = Lock::new(TaskDeps::new(
364348
#[cfg(debug_assertions)]
365-
Some(key),
349+
Some(dep_node),
366350
0,
367351
));
368352
(with_deps(TaskDepsRef::Allow(&task_deps)), task_deps.into_inner().reads)
369353
};
370354

371355
let dep_node_index =
372-
self.hash_result_and_alloc_node(cx.dep_context(), key, edges, &result, hash_result);
356+
self.hash_result_and_alloc_node(tcx, dep_node, edges, &result, hash_result);
373357

374358
(result, dep_node_index)
375359
}
@@ -954,7 +938,7 @@ impl DepGraphData {
954938

955939
// We failed to mark it green, so we try to force the query.
956940
debug!("trying to force dependency {dep_dep_node:?}");
957-
if !tcx.dep_context().try_force_from_dep_node(*dep_dep_node, parent_dep_node_index, frame) {
941+
if !tcx.try_force_from_dep_node(*dep_dep_node, parent_dep_node_index, frame) {
958942
// The DepNode could not be forced.
959943
debug!("dependency {dep_dep_node:?} could not be forced");
960944
return None;
@@ -1001,10 +985,7 @@ impl DepGraphData {
1001985
let frame = MarkFrame { index: prev_dep_node_index, parent: frame };
1002986

1003987
// We never try to mark eval_always nodes as green
1004-
debug_assert!(
1005-
!tcx.dep_context()
1006-
.is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind)
1007-
);
988+
debug_assert!(!tcx.is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind));
1008989

1009990
let prev_deps = self.previous.edge_targets_from(prev_dep_node_index);
1010991

compiler/rustc_middle/src/dep_graph/mod.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ mod graph;
2525
mod query;
2626
mod serialized;
2727

28-
pub trait HasDepContext<'tcx>: Copy {
29-
fn dep_context(&self) -> TyCtxt<'tcx>;
30-
}
31-
32-
impl<'tcx> HasDepContext<'tcx> for TyCtxt<'tcx> {
33-
fn dep_context(&self) -> TyCtxt<'tcx> {
34-
*self
35-
}
36-
}
37-
38-
impl<'tcx, T: HasDepContext<'tcx>, Q: Copy> HasDepContext<'tcx> for (T, Q) {
39-
fn dep_context(&self) -> TyCtxt<'tcx> {
40-
self.0.dep_context()
41-
}
42-
}
43-
4428
/// Describes the contents of the fingerprint generated by a given query.
4529
///
4630
/// This is mainly for determining whether and how we can reconstruct a key

0 commit comments

Comments
 (0)