Skip to content

Commit 5d76a13

Browse files
committed
Auto merge of #127653 - matthiaskrgr:rollup-72bqgvp, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #124980 (Generalize `fn allocator` for Rc/Arc.) - #126639 (Add AMX target-features and `x86_amx_intrinsics` feature flag) - #126827 (Use pidfd_spawn for faster process spawning when a PidFd is requested) - #127433 (Stabilize const_cstr_from_ptr (CStr::from_ptr, CStr::count_bytes)) - #127552 (remove unnecessary `git` usages) - #127613 (Update dist-riscv64-linux to binutils 2.40) - #127627 (generalize search graph to enable fuzzing) - #127648 (Lower timeout of CI jobs to 4 hours) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 05eac57 + f11c2c8 commit 5d76a13

35 files changed

Lines changed: 1408 additions & 807 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
defaults:
6666
run:
6767
shell: ${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
68-
timeout-minutes: 600
68+
timeout-minutes: 240
6969
env:
7070
CI_JOB_NAME: ${{ matrix.image }}
7171
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse

‎compiler/rustc_codegen_ssa/src/target_features.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ pub fn from_target_feature(
8080
Some(sym::loongarch_target_feature) => rust_features.loongarch_target_feature,
8181
Some(sym::lahfsahf_target_feature) => rust_features.lahfsahf_target_feature,
8282
Some(sym::prfchw_target_feature) => rust_features.prfchw_target_feature,
83+
Some(sym::x86_amx_intrinsics) => rust_features.x86_amx_intrinsics,
8384
Some(name) => bug!("unknown target feature gate {}", name),
8485
None => true,
8586
};

‎compiler/rustc_feature/src/unstable.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,8 @@ declare_features! (
640640
(unstable, unsized_tuple_coercion,"1.20.0",Some(42877)),
641641
/// Allows using the `#[used(linker)]` (or `#[used(compiler)]`) attribute.
642642
(unstable, used_with_arg,"1.60.0",Some(93798)),
643+
/// Allows use of x86 `AMX` target-feature attributes and intrinsics
644+
(unstable, x86_amx_intrinsics,"CURRENT_RUSTC_VERSION",Some(126622)),
643645
/// Allows `do yeet` expressions
644646
(unstable, yeet_expr,"1.62.0",Some(96373)),
645647
// !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!! !!!!

‎compiler/rustc_middle/src/traits/solve.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ use crate::ty::{
88
self,FallibleTypeFolder,TyCtxt,TypeFoldable,TypeFolder,TypeVisitable,TypeVisitor,
99
};
1010

11-
mod cache;
12-
13-
pubuse cache::EvaluationCache;
14-
1511
pubtypeGoal<'tcx,P> = ir::solve::Goal<TyCtxt<'tcx>,P>;
1612
pubtypeQueryInput<'tcx,P> = ir::solve::QueryInput<TyCtxt<'tcx>,P>;
1713
pubtypeQueryResult<'tcx> = ir::solve::QueryResult<TyCtxt<'tcx>>;

‎compiler/rustc_middle/src/traits/solve/cache.rs‎

Lines changed: 0 additions & 121 deletions
This file was deleted.

‎compiler/rustc_middle/src/ty/context.rs‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ use rustc_hir::lang_items::LangItem;
5959
use rustc_hir::{HirId,Node,TraitCandidate};
6060
use rustc_index::IndexVec;
6161
use rustc_macros::{HashStable,TyDecodable,TyEncodable};
62+
use rustc_query_system::cache::WithDepNode;
6263
use rustc_query_system::dep_graph::DepNodeIndex;
6364
use rustc_query_system::ich::StableHashingContext;
6465
use rustc_serialize::opaque::{FileEncodeResult,FileEncoder};
@@ -75,7 +76,7 @@ use rustc_type_ir::fold::TypeFoldable;
7576
use rustc_type_ir::lang_items::TraitSolverLangItem;
7677
use rustc_type_ir::solve::SolverMode;
7778
use rustc_type_ir::TyKind::*;
78-
use rustc_type_ir::{CollectAndApply,Interner,TypeFlags,WithCachedTypeInfo};
79+
use rustc_type_ir::{search_graph,CollectAndApply,Interner,TypeFlags,WithCachedTypeInfo};
7980
use tracing::{debug, instrument};
8081

8182
use std::assert_matches::assert_matches;
@@ -164,12 +165,26 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
164165
typeClause = Clause<'tcx>;
165166
typeClauses = ty::Clauses<'tcx>;
166167

167-
typeEvaluationCache = &'tcx solve::EvaluationCache<'tcx>;
168+
typeTracked<T: fmt::Debug + Clone> = WithDepNode<T>;
169+
fnmk_tracked<T: fmt::Debug + Clone>(
170+
self,
171+
data:T,
172+
dep_node:DepNodeIndex,
173+
) -> Self::Tracked<T>{
174+
WithDepNode::new(dep_node, data)
175+
}
176+
fnget_tracked<T: fmt::Debug + Clone>(self,tracked:&Self::Tracked<T>) -> T{
177+
tracked.get(self)
178+
}
168179

169-
fnevaluation_cache(self,mode:SolverMode) -> &'tcx solve::EvaluationCache<'tcx>{
180+
fnwith_global_cache<R>(
181+
self,
182+
mode:SolverMode,
183+
f:implFnOnce(&mut search_graph::GlobalCache<Self>) -> R,
184+
) -> R{
170185
match mode {
171-
SolverMode::Normal => &self.new_solver_evaluation_cache,
172-
SolverMode::Coherence => &self.new_solver_coherence_evaluation_cache,
186+
SolverMode::Normal => f(&mut*self.new_solver_evaluation_cache.lock()),
187+
SolverMode::Coherence => f(&mut*self.new_solver_coherence_evaluation_cache.lock()),
173188
}
174189
}
175190

@@ -1283,8 +1298,8 @@ pub struct GlobalCtxt<'tcx> {
12831298
pubevaluation_cache: traits::EvaluationCache<'tcx>,
12841299

12851300
/// Caches the results of goal evaluation in the new solver.
1286-
pubnew_solver_evaluation_cache:solve::EvaluationCache<'tcx>,
1287-
pubnew_solver_coherence_evaluation_cache:solve::EvaluationCache<'tcx>,
1301+
pubnew_solver_evaluation_cache:Lock<search_graph::GlobalCache<TyCtxt<'tcx>>>,
1302+
pubnew_solver_coherence_evaluation_cache:Lock<search_graph::GlobalCache<TyCtxt<'tcx>>>,
12881303

12891304
pubcanonical_param_env_cache:CanonicalParamEnvCache<'tcx>,
12901305

‎compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ use crate::delegate::SolverDelegate;
1616
usecrate::solve::inspect::{self,ProofTreeBuilder};
1717
usecrate::solve::search_graph::SearchGraph;
1818
usecrate::solve::{
19-
search_graph,CanonicalInput,CanonicalResponse,Certainty,Goal,GoalEvaluationKind,
20-
GoalSource,MaybeCause,NestedNormalizationGoals,NoSolution,PredefinedOpaquesData,
21-
QueryResult,SolverMode,FIXPOINT_STEP_LIMIT,
19+
CanonicalInput,CanonicalResponse,Certainty,Goal,GoalEvaluationKind,GoalSource,MaybeCause,
20+
NestedNormalizationGoals,NoSolution,PredefinedOpaquesData,QueryResult,SolverMode,
21+
FIXPOINT_STEP_LIMIT,
2222
};
2323

2424
pub(super)mod canonical;
@@ -72,7 +72,7 @@ where
7272
/// new placeholders to the caller.
7373
pub(super)max_input_universe: ty::UniverseIndex,
7474

75-
pub(super)search_graph:&'amutSearchGraph<I>,
75+
pub(super)search_graph:&'amutSearchGraph<D>,
7676

7777
nested_goals:NestedGoals<I>,
7878

@@ -200,7 +200,7 @@ where
200200
generate_proof_tree:GenerateProofTree,
201201
f:implFnOnce(&mutEvalCtxt<'_,D>) -> R,
202202
) -> (R,Option<inspect::GoalEvaluation<I>>){
203-
letmut search_graph = search_graph::SearchGraph::new(delegate.solver_mode());
203+
letmut search_graph = SearchGraph::new(delegate.solver_mode());
204204

205205
letmut ecx = EvalCtxt{
206206
delegate,
@@ -241,7 +241,7 @@ where
241241
/// and registering opaques from the canonicalized input.
242242
fnenter_canonical<R>(
243243
cx:I,
244-
search_graph:&'amutsearch_graph::SearchGraph<I>,
244+
search_graph:&'amutSearchGraph<D>,
245245
canonical_input:CanonicalInput<I>,
246246
canonical_goal_evaluation:&mutProofTreeBuilder<D>,
247247
f:implFnOnce(&mutEvalCtxt<'_,D>,Goal<I,I::Predicate>) -> R,
@@ -296,7 +296,7 @@ where
296296
#[instrument(level = "debug", skip(cx, search_graph, goal_evaluation), ret)]
297297
fnevaluate_canonical_goal(
298298
cx:I,
299-
search_graph:&'amutsearch_graph::SearchGraph<I>,
299+
search_graph:&'amutSearchGraph<D>,
300300
canonical_input:CanonicalInput<I>,
301301
goal_evaluation:&mutProofTreeBuilder<D>,
302302
) -> QueryResult<I>{

‎compiler/rustc_next_trait_solver/src/solve/inspect/build.rs‎

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::marker::PhantomData;
88
use std::mem;
99

1010
use rustc_type_ir::inherent::*;
11-
use rustc_type_ir::{selfas ty,Interner};
11+
use rustc_type_ir::{selfas ty,search_graph,Interner};
1212

1313
usecrate::delegate::SolverDelegate;
1414
usecrate::solve::eval_ctxt::canonical;
@@ -38,7 +38,7 @@ use crate::solve::{
3838
/// trees. At the end of trait solving `ProofTreeBuilder::finalize`
3939
/// is called to recursively convert the whole structure to a
4040
/// finished proof tree.
41-
pub(incrate::solve)structProofTreeBuilder<D,I = <DasSolverDelegate>::Interner>
41+
pub(crate)structProofTreeBuilder<D,I = <DasSolverDelegate>::Interner>
4242
where
4343
D:SolverDelegate<Interner = I>,
4444
I:Interner,
@@ -321,23 +321,6 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> {
321321
})
322322
}
323323

324-
pubfnfinalize_canonical_goal_evaluation(
325-
&mutself,
326-
cx:I,
327-
) -> Option<I::CanonicalGoalEvaluationStepRef>{
328-
self.as_mut().map(|this| match this {
329-
DebugSolver::CanonicalGoalEvaluation(evaluation) => {
330-
let final_revision = mem::take(&mut evaluation.final_revision).unwrap();
331-
let final_revision =
332-
cx.intern_canonical_goal_evaluation_step(final_revision.finalize());
333-
let kind = WipCanonicalGoalEvaluationKind::Interned{ final_revision };
334-
assert_eq!(evaluation.kind.replace(kind),None);
335-
final_revision
336-
}
337-
_ => unreachable!(),
338-
})
339-
}
340-
341324
pubfncanonical_goal_evaluation(&mutself,canonical_goal_evaluation:ProofTreeBuilder<D>){
342325
ifletSome(this) = self.as_mut(){
343326
match(this,*canonical_goal_evaluation.state.unwrap()){
@@ -571,3 +554,51 @@ impl<D: SolverDelegate<Interner = I>, I: Interner> ProofTreeBuilder<D> {
571554
}
572555
}
573556
}
557+
558+
impl<D,I> search_graph::ProofTreeBuilder<I>forProofTreeBuilder<D>
559+
where
560+
D:SolverDelegate<Interner = I>,
561+
I:Interner,
562+
{
563+
fntry_apply_proof_tree(
564+
&mutself,
565+
proof_tree:Option<I::CanonicalGoalEvaluationStepRef>,
566+
) -> bool{
567+
if !self.is_noop(){
568+
ifletSome(final_revision) = proof_tree {
569+
let kind = WipCanonicalGoalEvaluationKind::Interned{ final_revision };
570+
self.canonical_goal_evaluation_kind(kind);
571+
true
572+
}else{
573+
false
574+
}
575+
}else{
576+
true
577+
}
578+
}
579+
580+
fnon_provisional_cache_hit(&mutself){
581+
self.canonical_goal_evaluation_kind(WipCanonicalGoalEvaluationKind::ProvisionalCacheHit);
582+
}
583+
584+
fnon_cycle_in_stack(&mutself){
585+
self.canonical_goal_evaluation_kind(WipCanonicalGoalEvaluationKind::CycleInStack);
586+
}
587+
588+
fnfinalize_canonical_goal_evaluation(
589+
&mutself,
590+
tcx:I,
591+
) -> Option<I::CanonicalGoalEvaluationStepRef>{
592+
self.as_mut().map(|this| match this {
593+
DebugSolver::CanonicalGoalEvaluation(evaluation) => {
594+
let final_revision = mem::take(&mut evaluation.final_revision).unwrap();
595+
let final_revision =
596+
tcx.intern_canonical_goal_evaluation_step(final_revision.finalize());
597+
let kind = WipCanonicalGoalEvaluationKind::Interned{ final_revision };
598+
assert_eq!(evaluation.kind.replace(kind),None);
599+
final_revision
600+
}
601+
_ => unreachable!(),
602+
})
603+
}
604+
}

0 commit comments

Comments
 (0)