From 5d13845e5be03ec3cbe0da3ce67b8272bc4c2e69 Mon Sep 17 00:00:00 2001 From: Chayim Refael Friedman Date: Thu, 4 Sep 2025 02:09:59 +0300 Subject: [PATCH] Don't require next-solver `ProbeRef` to be `Copy` rust-analyzer would like to use a non-interned `Probe` there. Also rename it to `Probe` for this reason. --- compiler/rustc_middle/src/ty/context.rs | 4 ++-- .../rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs | 4 ++-- compiler/rustc_type_ir/src/interner.rs | 7 ++++--- compiler/rustc_type_ir/src/solve/inspect.rs | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 72ab6ac612c61..97c8a0336c21a 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -738,8 +738,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> { ) } - type ProbeRef = &'tcx inspect::Probe>; - fn mk_probe_ref(self, probe: inspect::Probe) -> &'tcx inspect::Probe> { + type Probe = &'tcx inspect::Probe>; + fn mk_probe(self, probe: inspect::Probe) -> &'tcx inspect::Probe> { self.arena.alloc(probe) } fn evaluate_root_goal_for_proof_tree_raw( diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs index 31106a7452795..443aebbdb4d69 100644 --- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs @@ -1275,7 +1275,7 @@ pub fn evaluate_root_goal_for_proof_tree_raw_provider< >( cx: I, canonical_goal: CanonicalInput, -) -> (QueryResult, I::ProbeRef) { +) -> (QueryResult, I::Probe) { let mut inspect = inspect::ProofTreeBuilder::new(); let canonical_result = SearchGraph::::evaluate_root_goal_for_proof_tree( cx, @@ -1284,7 +1284,7 @@ pub fn evaluate_root_goal_for_proof_tree_raw_provider< &mut inspect, ); let final_revision = inspect.unwrap(); - (canonical_result, cx.mk_probe_ref(final_revision)) + (canonical_result, cx.mk_probe(final_revision)) } /// Evaluate a goal to build a proof tree. diff --git a/compiler/rustc_type_ir/src/interner.rs b/compiler/rustc_type_ir/src/interner.rs index f5448baf8c0b9..3355c0c2104da 100644 --- a/compiler/rustc_type_ir/src/interner.rs +++ b/compiler/rustc_type_ir/src/interner.rs @@ -1,3 +1,4 @@ +use std::borrow::Borrow; use std::fmt::Debug; use std::hash::Hash; use std::ops::Deref; @@ -383,12 +384,12 @@ pub trait Interner: defining_anchor: Self::LocalDefId, ) -> Self::LocalDefIds; - type ProbeRef: Copy + Debug + Hash + Eq + Deref>; - fn mk_probe_ref(self, probe: inspect::Probe) -> Self::ProbeRef; + type Probe: Debug + Hash + Eq + Borrow>; + fn mk_probe(self, probe: inspect::Probe) -> Self::Probe; fn evaluate_root_goal_for_proof_tree_raw( self, canonical_goal: CanonicalInput, - ) -> (QueryResult, Self::ProbeRef); + ) -> (QueryResult, Self::Probe); } /// Imagine you have a function `F: FnOnce(&[T]) -> R`, plus an iterator `iter` diff --git a/compiler/rustc_type_ir/src/solve/inspect.rs b/compiler/rustc_type_ir/src/solve/inspect.rs index 5452ac441589d..3af2f8dbaf27d 100644 --- a/compiler/rustc_type_ir/src/solve/inspect.rs +++ b/compiler/rustc_type_ir/src/solve/inspect.rs @@ -49,7 +49,7 @@ pub type CanonicalState = Canonical>; pub struct GoalEvaluation { pub uncanonicalized_goal: Goal, pub orig_values: Vec, - pub final_revision: I::ProbeRef, + pub final_revision: I::Probe, pub result: QueryResult, }