1use std::mem;
2use std::ops::ControlFlow;
3
4#[cfg(feature = "nightly")]
5use rustc_macros::StableHash;
6use rustc_type_ir::data_structures::HashSet;
7use rustc_type_ir::inherent::*;
8use rustc_type_ir::region_constraint::{self, RegionConstraint};
9use rustc_type_ir::relate::Relate;
10use rustc_type_ir::relate::solver_relating::RelateExt;
11use rustc_type_ir::search_graph::{
12 CandidateHeadUsages, LowerAvailableDepth, PathKind, RequiredDepth,
13};
14use rustc_type_ir::solve::{
15 AccessedOpaques, ExternalRegionConstraints, FetchEligibleAssocItemResponse, MaybeInfo,
16 NoSolutionOrRerunNonErased, OpaqueTypesJank, QueryResultOrRerunNonErased, RerunCondition,
17 RerunNonErased, RerunReason, RerunResultExt, SmallCopySet, TyOrConstInferVar,
18};
19use rustc_type_ir::{
20 self as ty, CanonicalVarValues, ClauseKind, InferCtxtLike, Interner, MayBeErased,
21 OpaqueTypeKey, PredicateKind, Region, TypeFoldable, TypeSuperVisitable, TypeVisitable,
22 TypeVisitableExt, TypeVisitor, TypingMode, eager_resolve_vars,
23};
24use thin_vec::ThinVec;
25use tracing::{Level, debug, instrument, trace, warn};
26
27use super::has_only_region_constraints;
28use crate::canonical::{
29 canonicalize_goal, canonicalize_response, instantiate_and_apply_query_response,
30 response_no_constraints_raw,
31};
32use crate::coherence;
33use crate::delegate::SolverDelegate;
34use crate::normalize::{NormalizationFolder, NormalizationWasAmbiguous};
35use crate::placeholder::BoundVarReplacer;
36use crate::solve::eval_ctxt::fast_path::{
37 RerunStalled, compute_goal_fast_path, inlined_rerunning_stalled_goal_may_make_progress,
38 rerunning_stalled_goal_may_make_progress,
39};
40use crate::solve::fast_path::compute_goal_fast_path_cold;
41use crate::solve::search_graph::SearchGraph;
42use crate::solve::ty::may_use_unstable_feature;
43use crate::solve::{
44 CanonicalResponse, Certainty, ExternalConstraintsData, FIXPOINT_STEP_LIMIT, Goal,
45 GoalEvaluation, GoalSource, GoalStalledOn, GoalStalledOnOpaques, HasChanged, MaybeCause,
46 NestedNormalizationGoals, NoSolution, QueryInput, QueryResult, Response, SucceededInErased,
47 VisibleForLeakCheck, inspect,
48};
49
50pub mod fast_path;
51mod probe;
52mod solver_region_constraints;
53
54#[derive(#[automatically_derived]
impl ::core::fmt::Debug for CurrentGoalKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
CurrentGoalKind::Misc => "Misc",
CurrentGoalKind::CoinductiveTrait => "CoinductiveTrait",
CurrentGoalKind::ProjectionComputeAssocTermCandidate =>
"ProjectionComputeAssocTermCandidate",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for CurrentGoalKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CurrentGoalKind { }
#[automatically_derived]
impl ::core::clone::Clone for CurrentGoalKind {
#[inline]
fn clone(&self) -> CurrentGoalKind { *self }
}Clone)]
59enum CurrentGoalKind {
60 Misc,
61 CoinductiveTrait,
66 ProjectionComputeAssocTermCandidate,
80}
81
82impl CurrentGoalKind {
83 fn from_query_input<I: Interner>(cx: I, input: QueryInput<I, I::Predicate>) -> CurrentGoalKind {
84 match input.goal.predicate.kind().skip_binder() {
85 ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
86 if cx.trait_is_coinductive(pred.trait_ref.def_id) {
87 CurrentGoalKind::CoinductiveTrait
88 } else {
89 CurrentGoalKind::Misc
90 }
91 }
92 ty::PredicateKind::NormalizesTo(_) => {
93 CurrentGoalKind::ProjectionComputeAssocTermCandidate
94 }
95 _ => CurrentGoalKind::Misc,
96 }
97 }
98}
99
100pub struct EvalCtxt<'a, D, I = <D as SolverDelegate>::Interner>
101where
102 D: SolverDelegate<Interner = I>,
103 I: Interner,
104{
105 delegate: &'a D,
121
122 var_kinds: I::CanonicalVarKinds,
125
126 current_goal_kind: CurrentGoalKind,
129 pub(super) var_values: CanonicalVarValues<I>,
130
131 pub(super) max_input_universe: ty::UniverseIndex,
141 pub(super) initial_opaque_types_storage_num_entries:
144 <D::Infcx as InferCtxtLike>::OpaqueTypeStorageEntries,
145
146 pub(super) search_graph: &'a mut SearchGraph<D>,
147
148 nested_goals: Vec<(GoalSource, Goal<I, I::Predicate>, Option<GoalStalledOn<I>>)>,
149
150 pub(super) origin_span: I::Span,
151
152 tainted: Result<(), NoSolution>,
159
160 pub(super) opaque_accesses: AccessedOpaques<I>,
162
163 pub(super) inspect: inspect::EvaluationStepBuilder<D>,
164}
165
166#[derive(#[automatically_derived]
impl ::core::marker::StructuralPartialEq for GenerateProofTree { }
#[automatically_derived]
impl ::core::cmp::PartialEq for GenerateProofTree {
#[inline]
fn eq(&self, other: &GenerateProofTree) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GenerateProofTree {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for GenerateProofTree {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
GenerateProofTree::Yes => "Yes",
GenerateProofTree::No => "No",
})
}
}Debug, #[automatically_derived]
impl ::core::hash::Hash for GenerateProofTree {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}Hash, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for GenerateProofTree { }
#[automatically_derived]
impl ::core::clone::Clone for GenerateProofTree {
#[inline]
fn clone(&self) -> GenerateProofTree { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for GenerateProofTree { }Copy)]
167#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
GenerateProofTree {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
GenerateProofTree::Yes => {}
GenerateProofTree::No => {}
}
}
}
};StableHash))]
168pub enum GenerateProofTree {
169 Yes,
170 No,
171}
172
173pub trait SolverDelegateEvalExt: SolverDelegate {
174 fn evaluate_root_goal(
179 &self,
180 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
181 span: <Self::Interner as Interner>::Span,
182 stalled_on: Option<GoalStalledOn<Self::Interner>>,
183 ) -> Result<GoalEvaluation<Self::Interner>, NoSolution>;
184
185 fn goal_remains_stalled(&self, stalled_on: &GoalStalledOn<Self::Interner>) -> bool;
188
189 fn root_goal_may_hold_opaque_types_jank(
194 &self,
195 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
196 ) -> bool;
197
198 fn root_goal_may_hold_with_depth(
206 &self,
207 root_depth: usize,
208 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
209 ) -> bool;
210
211 fn evaluate_root_goal_for_proof_tree(
214 &self,
215 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
216 span: <Self::Interner as Interner>::Span,
217 ) -> (
218 Result<NestedNormalizationGoals<Self::Interner>, NoSolution>,
219 inspect::GoalEvaluation<Self::Interner>,
220 );
221}
222
223impl<D, I> SolverDelegateEvalExt for D
224where
225 D: SolverDelegate<Interner = I>,
226 I: Interner,
227{
228 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("evaluate_root_goal",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(228u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("span")
}> =
::tracing::__macro_support::FieldName::new("span");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("stalled_on")
}> =
::tracing::__macro_support::FieldName::new("stalled_on");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&span)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&stalled_on)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<GoalEvaluation<I>, NoSolution> = loop {};
return __tracing_attr_fake_return;
}
{
if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
rerunning_stalled_goal_may_make_progress(self,
stalled_on.as_ref()) {
return Ok(GoalEvaluation {
goal,
certainty: Certainty::Maybe(stalled_maybe_info),
has_changed: HasChanged::No,
stalled_on,
});
}
if stalled_on.is_some() &&
let Some(res) =
compute_goal_fast_path_cold(self, goal, span) {
return Ok(res);
}
let mut result =
EvalCtxt::enter_root(self, self.cx().recursion_limit(),
span,
|ecx|
{
ecx.evaluate_goal_no_fast_paths(GoalSource::Misc, goal)
});
maybe_evaluate_root_goal_with_higher_recursion_limit(self,
goal, span, &mut result);
match result {
Ok(i) => Ok(i),
Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) =>
Err(NoSolution),
Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
{
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("this never happens at the root, we\'re never in erased mode here")));
};
}
}
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:228",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(228u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "debug", skip(self), ret)]
229 fn evaluate_root_goal(
230 &self,
231 goal: Goal<I, I::Predicate>,
232 span: I::Span,
233 stalled_on: Option<GoalStalledOn<I>>,
234 ) -> Result<GoalEvaluation<I>, NoSolution> {
235 if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
237 rerunning_stalled_goal_may_make_progress(self, stalled_on.as_ref())
238 {
239 return Ok(GoalEvaluation {
240 goal,
241 certainty: Certainty::Maybe(stalled_maybe_info),
242 has_changed: HasChanged::No,
243 stalled_on,
244 });
245 }
246
247 if stalled_on.is_some()
251 && let Some(res) = compute_goal_fast_path_cold(self, goal, span)
252 {
253 return Ok(res);
254 }
255
256 let mut result = EvalCtxt::enter_root(self, self.cx().recursion_limit(), span, |ecx| {
257 ecx.evaluate_goal_no_fast_paths(GoalSource::Misc, goal)
258 });
259 maybe_evaluate_root_goal_with_higher_recursion_limit(self, goal, span, &mut result);
260
261 match result {
262 Ok(i) => Ok(i),
263 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
264 Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
265 unreachable!("this never happens at the root, we're never in erased mode here");
266 }
267 }
268 }
269
270 #[inline(always)]
272 fn goal_remains_stalled(&self, stalled_on: &GoalStalledOn<Self::Interner>) -> bool {
273 match inlined_rerunning_stalled_goal_may_make_progress(self, Some(stalled_on)) {
274 RerunStalled::WontMakeProgress(_) => true,
275 RerunStalled::MayMakeProgress => false,
276 }
277 }
278
279 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("root_goal_may_hold_opaque_types_jank",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(279u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: bool = loop {};
return __tracing_attr_fake_return;
}
{
self.probe(||
{
self.evaluate_root_goal(goal, I::Span::dummy(),
None).is_ok_and(|r|
match r.certainty {
Certainty::Yes => true,
Certainty::Maybe(MaybeInfo {
cause: _, opaque_types_jank, stalled_on_coroutines: _ }) =>
match opaque_types_jank {
OpaqueTypesJank::AllGood => true,
OpaqueTypesJank::ErrorIfRigidSelfTy => false,
},
})
})
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:279",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(279u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "debug", skip(self), ret)]
280 fn root_goal_may_hold_opaque_types_jank(
281 &self,
282 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
283 ) -> bool {
284 self.probe(|| {
285 self.evaluate_root_goal(goal, I::Span::dummy(), None).is_ok_and(|r| match r.certainty {
286 Certainty::Yes => true,
287 Certainty::Maybe(MaybeInfo {
288 cause: _,
289 opaque_types_jank,
290 stalled_on_coroutines: _,
291 }) => match opaque_types_jank {
292 OpaqueTypesJank::AllGood => true,
293 OpaqueTypesJank::ErrorIfRigidSelfTy => false,
294 },
295 })
296 })
297 }
298
299 fn root_goal_may_hold_with_depth(
300 &self,
301 root_depth: usize,
302 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
303 ) -> bool {
304 self.probe(|| {
305 EvalCtxt::enter_root(self, root_depth, I::Span::dummy(), |ecx| {
306 ecx.evaluate_goal(GoalSource::Misc, goal, None)
307 })
308 })
309 .is_ok()
310 }
311
312 {}
#[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() ||
{ false } {
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("evaluate_root_goal_for_proof_tree",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(312u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("span")
}> =
::tracing::__macro_support::FieldName::new("span");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&span)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
(Result<NestedNormalizationGoals<I>, NoSolution>,
inspect::GoalEvaluation<I>) = loop {};
return __tracing_attr_fake_return;
}
{
let mut result =
evaluate_root_goal_for_proof_tree(self, goal, span,
self.cx().recursion_limit());
maybe_evaluate_root_goal_for_proof_tree_with_higher_recursion_limit(self,
goal, span, &mut result);
result
}
}
}#[instrument(level = "debug", skip(self))]
313 fn evaluate_root_goal_for_proof_tree(
314 &self,
315 goal: Goal<I, I::Predicate>,
316 span: I::Span,
317 ) -> (Result<NestedNormalizationGoals<I>, NoSolution>, inspect::GoalEvaluation<I>) {
318 let mut result =
319 evaluate_root_goal_for_proof_tree(self, goal, span, self.cx().recursion_limit());
320 maybe_evaluate_root_goal_for_proof_tree_with_higher_recursion_limit(
321 self,
322 goal,
323 span,
324 &mut result,
325 );
326 result
327 }
328}
329
330fn maybe_evaluate_root_goal_with_higher_recursion_limit<D, I>(
336 delegate: &D,
337 goal: Goal<I, I::Predicate>,
338 span: I::Span,
339 initial_result: &mut Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased>,
340) where
341 D: SolverDelegate<Interner = I>,
342 I: Interner,
343{
344 if !delegate.enable_next_solver_overflow_fcw() {
345 return;
346 }
347
348 let predicate = match initial_result {
349 Err(_) => return,
350 Ok(goal_evaluation) if !goal_evaluation.certainty.is_overflow() => return,
351 Ok(goal_evaluation) => goal_evaluation.goal.predicate,
352 };
353
354 let rerun_result = delegate.commit_if_ok(|| {
355 let rerun_result =
356 EvalCtxt::enter_root(delegate, delegate.cx().recursion_limit() * 2, span, |ecx| {
357 ecx.evaluate_goal_no_fast_paths(GoalSource::Misc, goal)
358 });
359
360 if rerun_result.as_ref().is_ok_and(|evaluation| evaluation.certainty.is_overflow()) {
361 Err(())
362 } else {
363 Ok(rerun_result)
364 }
365 });
366 if let Ok(rerun_result) = rerun_result {
367 delegate.emit_next_solver_overflow_fcw(goal.with(delegate.cx(), predicate), span);
368 *initial_result = rerun_result;
369 }
370}
371
372fn maybe_evaluate_root_goal_for_proof_tree_with_higher_recursion_limit<D, I>(
378 delegate: &D,
379 goal: Goal<I, I::Predicate>,
380 span: I::Span,
381 initial_result: &mut (
382 Result<NestedNormalizationGoals<I>, NoSolution>,
383 inspect::GoalEvaluation<I>,
384 ),
385) where
386 D: SolverDelegate<Interner = I>,
387 I: Interner,
388{
389 if !delegate.enable_next_solver_overflow_fcw() {
390 return;
391 }
392
393 let goal_evaluation = &initial_result.1;
394 match goal_evaluation.result {
395 Err(_) => return,
396 Ok(response) if !response.value.certainty.is_overflow() => return,
397 Ok(_) => {}
398 }
399
400 let rerun_result = delegate.commit_if_ok(|| {
401 let (new_result, new_goal_evaluation) = evaluate_root_goal_for_proof_tree(
402 delegate,
403 goal,
404 span,
405 delegate.cx().recursion_limit() * 2,
406 );
407
408 if new_goal_evaluation.result.is_ok_and(|response| response.value.certainty.is_overflow()) {
409 Err(())
410 } else {
411 Ok((new_result, new_goal_evaluation))
412 }
413 });
414 if let Ok(rerun_result) = rerun_result {
415 let predicate: I::Predicate = goal_evaluation.uncanonicalized_goal.predicate;
416 delegate.emit_next_solver_overflow_fcw(goal.with(delegate.cx(), predicate), span);
417 *initial_result = rerun_result;
418 }
419}
420
421impl<'a, D, I> EvalCtxt<'a, D>
422where
423 D: SolverDelegate<Interner = I>,
424 I: Interner,
425{
426 pub(super) fn typing_mode(&self) -> TypingMode<I> {
427 self.delegate.typing_mode_raw()
428 }
429
430 pub(super) fn step_kind_for_source(&self, source: GoalSource) -> PathKind {
439 match source {
440 GoalSource::Misc => PathKind::Unknown,
448 GoalSource::NormalizeGoal(path_kind) => path_kind,
449 GoalSource::ImplWhereBound => match self.current_goal_kind {
450 CurrentGoalKind::CoinductiveTrait => PathKind::Coinductive,
453 CurrentGoalKind::Misc | CurrentGoalKind::ProjectionComputeAssocTermCandidate => {
457 PathKind::Unknown
458 }
459 },
460 GoalSource::TypeRelating => PathKind::Inductive,
464 GoalSource::AliasBoundConstCondition | GoalSource::AliasWellFormed => PathKind::Unknown,
468 }
469 }
470
471 pub(super) fn enter_root<R>(
475 delegate: &D,
476 root_depth: usize,
477 origin_span: I::Span,
478 f: impl FnOnce(&mut EvalCtxt<'_, D>) -> R,
479 ) -> R {
480 let mut search_graph = SearchGraph::new(root_depth);
481
482 let mut ecx = EvalCtxt {
483 delegate,
484 search_graph: &mut search_graph,
485 nested_goals: Default::default(),
486 inspect: inspect::EvaluationStepBuilder::new_noop(),
487
488 max_input_universe: ty::UniverseIndex::ROOT,
491 initial_opaque_types_storage_num_entries: Default::default(),
492 var_kinds: Default::default(),
493 var_values: CanonicalVarValues::dummy(),
494 current_goal_kind: CurrentGoalKind::Misc,
495 origin_span,
496 tainted: Ok(()),
497 opaque_accesses: AccessedOpaques::default(),
498 };
499 let result = f(&mut ecx);
500 if !ecx.nested_goals.is_empty() {
{
::core::panicking::panic_fmt(format_args!("root `EvalCtxt` should not have any goals added to it"));
}
};assert!(
501 ecx.nested_goals.is_empty(),
502 "root `EvalCtxt` should not have any goals added to it"
503 );
504 if !!ecx.opaque_accesses.might_rerun() {
::core::panicking::panic("assertion failed: !ecx.opaque_accesses.might_rerun()")
};assert!(!ecx.opaque_accesses.might_rerun());
505 if !search_graph.is_empty() {
::core::panicking::panic("assertion failed: search_graph.is_empty()")
};assert!(search_graph.is_empty());
506 result
507 }
508
509 pub(super) fn enter_canonical<T>(
517 cx: I,
518 search_graph: &'a mut SearchGraph<D>,
519 canonical_input: I::CanonicalInput,
520 proof_tree_builder: &mut inspect::ProofTreeBuilder<D>,
521 f: impl FnOnce(
522 &mut EvalCtxt<'_, D>,
523 Goal<I, I::Predicate>,
524 ) -> Result<T, NoSolutionOrRerunNonErased>,
525 ) -> (Result<T, NoSolution>, AccessedOpaques<I>) {
526 let (ref delegate, input, var_values) = D::build_with_canonical(cx, &canonical_input);
527 for (key, ty) in input.predefined_opaques_in_body.iter() {
528 let prev = delegate.register_hidden_type_in_storage(key, ty, I::Span::dummy());
529 if let Some(prev) = prev {
541 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:541",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(541u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message",
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("key")
}> =
::tracing::__macro_support::FieldName::new("key");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("ty")
}> =
::tracing::__macro_support::FieldName::new("ty");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("prev")
}> =
::tracing::__macro_support::FieldName::new("prev");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("ignore duplicate in `opaque_types_storage`")
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&key)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&ty)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&prev)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(?key, ?ty, ?prev, "ignore duplicate in `opaque_types_storage`");
542 }
543 }
544
545 let initial_opaque_types_storage_num_entries = delegate.opaque_types_storage_num_entries();
546 if truecfg!(debug_assertions) && delegate.typing_mode_raw().is_erased_not_coherence() {
547 if !delegate.clone_opaque_types_lookup_table().is_empty() {
::core::panicking::panic("assertion failed: delegate.clone_opaque_types_lookup_table().is_empty()")
};assert!(delegate.clone_opaque_types_lookup_table().is_empty());
548 }
549
550 let mut ecx = EvalCtxt {
551 delegate,
552 var_kinds: canonical_input.canonical.var_kinds,
553 var_values,
554 current_goal_kind: CurrentGoalKind::from_query_input(cx, input),
555 max_input_universe: canonical_input.canonical.max_universe,
556 initial_opaque_types_storage_num_entries,
557 search_graph,
558 nested_goals: Default::default(),
559 origin_span: I::Span::dummy(),
560 tainted: Ok(()),
561 inspect: proof_tree_builder.new_evaluation_step(var_values),
562 opaque_accesses: AccessedOpaques::default(),
563 };
564
565 let result = f(&mut ecx, input.goal);
566 ecx.inspect.probe_final_state(ecx.delegate, ecx.max_input_universe);
567 proof_tree_builder.finish_evaluation_step(ecx.inspect);
568
569 if canonical_input.typing_mode.0.is_erased_not_coherence() {
570 if true {
if !delegate.clone_opaque_types_lookup_table().is_empty() {
::core::panicking::panic("assertion failed: delegate.clone_opaque_types_lookup_table().is_empty()")
};
};debug_assert!(delegate.clone_opaque_types_lookup_table().is_empty());
571 }
572
573 delegate.reset_opaque_types();
579
580 let opaque_accesses = ecx.opaque_accesses;
581 (
582 match result {
583 Ok(i) => Ok(i),
584 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
585 Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
586 if !opaque_accesses.should_bail().is_err() {
::core::panicking::panic("assertion failed: opaque_accesses.should_bail().is_err()")
};assert!(opaque_accesses.should_bail().is_err());
588 Err(NoSolution)
589 }
590 },
591 opaque_accesses,
592 )
593 }
594
595 pub(super) fn ignore_candidate_head_usages(&mut self, usages: CandidateHeadUsages) {
596 self.search_graph.ignore_candidate_head_usages(usages);
597 }
598
599 fn evaluate_goal(
602 &mut self,
603 source: GoalSource,
604 goal: Goal<I, I::Predicate>,
605 stalled_on: Option<GoalStalledOn<I>>,
606 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
607 if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
608 rerunning_stalled_goal_may_make_progress(self.delegate, stalled_on.as_ref())
609 {
610 return Ok(GoalEvaluation {
611 goal,
612 certainty: Certainty::Maybe(stalled_maybe_info),
613 has_changed: HasChanged::No,
614 stalled_on,
615 });
616 }
617
618 if stalled_on.is_some()
622 && let Some(res) = compute_goal_fast_path_cold(self.delegate, goal, self.origin_span)
623 {
624 return Ok(res);
625 }
626
627 self.evaluate_goal_no_fast_paths(source, goal)
628 }
629
630 #[cold]
632 #[inline(never)]
633 fn evaluate_goal_no_fast_paths(
634 &mut self,
635 source: GoalSource,
636 goal: Goal<I, I::Predicate>,
637 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
638 let (normalization_nested_goals, goal_evaluation) =
639 self.evaluate_goal_raw(source, goal, LowerAvailableDepth::Yes)?;
640 if !normalization_nested_goals.is_empty() {
::core::panicking::panic("assertion failed: normalization_nested_goals.is_empty()")
};assert!(normalization_nested_goals.is_empty());
641 Ok(goal_evaluation)
642 }
643
644 pub(super) fn evaluate_goal_raw(
652 &mut self,
653 source: GoalSource,
654 goal: Goal<I, I::Predicate>,
655 increase_depth_for_nested: LowerAvailableDepth,
656 ) -> Result<(NestedNormalizationGoals<I>, GoalEvaluation<I>), NoSolutionOrRerunNonErased> {
657 let opaque_types = self.delegate.clone_opaque_types_lookup_table();
661 let (goal, opaque_types) = eager_resolve_vars(&**self.delegate, (goal, opaque_types));
662 let typing_mode = self.typing_mode();
663 let step_kind = self.step_kind_for_source(source);
664
665 let tracing_span = {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("evaluate_goal_raw in typing mode",
"rustc_next_trait_solver::solve::eval_ctxt", Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(665u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() } &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("{0:?} opaques={1:?}",
typing_mode, opaque_types) as
&dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
}tracing::span!(
666 Level::DEBUG,
667 "evaluate_goal_raw in typing mode",
668 "{:?} opaques={:?}",
669 typing_mode,
670 opaque_types
671 )
672 .entered();
673
674 let (result, orig_values, canonical_goal, succeeded_in_erased) = 'retry_canonicalize: {
675 let skip_erased_attempt = match typing_mode {
676 TypingMode::Reflection | TypingMode::Coherence => true,
677 TypingMode::Typeck { .. }
678 | TypingMode::PostTypeckUntilBorrowck { .. }
679 | TypingMode::PostBorrowck { .. }
680 | TypingMode::Codegen
681 | TypingMode::PostAnalysis
682 | TypingMode::ErasedNotCoherence(_) => {
683 let mut skip = false;
684 if opaque_types.iter().any(|(_, ty)| ty.is_ty_var())
685 && let PredicateKind::Clause(ClauseKind::Trait(..)) =
686 goal.predicate.kind().skip_binder()
687 {
688 skip = true;
689 }
690
691 if let PredicateKind::Clause(ClauseKind::Trait(tr)) =
692 goal.predicate.kind().skip_binder()
693 && tr.self_ty().has_coroutines()
694 && self.cx().trait_is_auto(tr.trait_ref.def_id)
695 {
696 }
700
701 skip
702 }
703 };
704
705 if skip_erased_attempt {
706 if typing_mode.is_erased_not_coherence() {
707 match self.opaque_accesses.rerun_always(RerunReason::SkipErasedAttempt)? {}
708 } else {
709 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:709",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(709u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("running in original typing mode")
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!("running in original typing mode");
710 }
711 } else {
712 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:712",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(712u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("trying without opaques: {0:?}",
goal) as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!("trying without opaques: {goal:?}");
713
714 let (orig_values, canonical_goal) = canonicalize_goal(
715 self.delegate,
716 goal,
717 &[],
718 TypingMode::ErasedNotCoherence(MayBeErased),
719 );
720
721 let (canonical_result, accessed_opaques) = self.search_graph.evaluate_goal(
722 self.cx(),
723 canonical_goal,
724 step_kind,
725 increase_depth_for_nested,
726 &mut inspect::ProofTreeBuilder::new_noop(),
727 );
728
729 let should_rerun = should_rerun_after_erased_canonicalization(
730 accessed_opaques,
731 self.typing_mode(),
732 &opaque_types,
733 );
734 match should_rerun {
735 RerunDecision::Yes => {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:735",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(735u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("rerunning in original typing mode")
as &dyn ::tracing::field::Value))])
});
} else { ; }
}debug!("rerunning in original typing mode"),
736 RerunDecision::No => {
737 break 'retry_canonicalize (
738 canonical_result,
739 orig_values,
740 canonical_goal,
741 SucceededInErased::Yes { accessed_opaques },
742 );
743 }
744 RerunDecision::EagerlyPropagateToParent => {
745 self.opaque_accesses.update(accessed_opaques)?;
746 break 'retry_canonicalize (
747 canonical_result,
748 orig_values,
749 canonical_goal,
750 SucceededInErased::No,
753 );
754 }
755 }
756 }
757
758 let (orig_values, canonical_goal) =
759 canonicalize_goal(self.delegate, goal, &opaque_types, typing_mode);
760
761 let (canonical_result, accessed_opaques) = self.search_graph.evaluate_goal(
762 self.cx(),
763 canonical_goal,
764 step_kind,
765 increase_depth_for_nested,
766 &mut inspect::ProofTreeBuilder::new_noop(),
767 );
768 if !!accessed_opaques.might_rerun() {
{
::core::panicking::panic_fmt(format_args!("we run without TypingMode::ErasedNotCoherence, so opaques are available, and we don\'t retry if the outer typing mode is ErasedNotCoherence: {0:?} after {1:?}",
accessed_opaques, goal));
}
};assert!(
769 !accessed_opaques.might_rerun(),
770 "we run without TypingMode::ErasedNotCoherence, so opaques are available, and we don't retry if the outer typing mode is ErasedNotCoherence: {accessed_opaques:?} after {goal:?}"
771 );
772
773 (canonical_result, orig_values, canonical_goal, SucceededInErased::No)
774 };
775
776 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:776",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(776u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("result")
}> =
::tracing::__macro_support::FieldName::new("result");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&result)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(?result);
777 let response = match result {
778 Ok(response) => {
779 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:779",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(779u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("success")
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!("success");
780 response
781 }
782 Err(NoSolution) => {
783 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:783",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(783u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("normal failure")
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!("normal failure");
784 return Err(NoSolution.into());
785 }
786 };
787
788 drop(tracing_span);
789
790 let has_changed =
791 if !has_only_region_constraints(response) { HasChanged::Yes } else { HasChanged::No };
792
793 let (normalization_nested_goals, certainty) = instantiate_and_apply_query_response(
794 self.delegate,
795 goal.param_env,
796 &orig_values,
797 response,
798 self.origin_span,
799 );
800
801 let stalled_on = match certainty {
812 Certainty::Yes => None,
813 Certainty::Maybe(maybe_info) => match has_changed {
814 HasChanged::Yes => None,
819 HasChanged::No => Some(self.build_stalled_on(
820 canonical_goal,
821 maybe_info,
822 orig_values,
823 succeeded_in_erased,
824 )),
825 },
826 };
827
828 Ok((
829 normalization_nested_goals,
830 GoalEvaluation { goal, certainty, has_changed, stalled_on },
831 ))
832 }
833
834 fn build_stalled_on(
835 &self,
836 canonical_goal: I::CanonicalInput,
837 maybe_info: MaybeInfo,
838 stalled_vars: ThinVec<I::GenericArg>,
839 previously_succeeded_in_erased: SucceededInErased<I>,
840 ) -> GoalStalledOn<I> {
841 let mut sub_roots = ThinVec::new();
843 let stalled_vars = stalled_vars
844 .into_iter()
845 .filter_map(|arg| match arg.kind() {
846 ty::GenericArgKind::Lifetime(_) => None,
848 ty::GenericArgKind::Type(ty) => match ty.kind() {
849 ty::Infer(ty::TyVar(vid)) => {
850 sub_roots.push(self.delegate.sub_unification_table_root_var(vid));
851 Some(TyOrConstInferVar::Ty(vid))
852 }
853 ty::Infer(ty::IntVar(vid)) => Some(TyOrConstInferVar::TyInt(vid)),
854 ty::Infer(ty::FloatVar(vid)) => Some(TyOrConstInferVar::TyFloat(vid)),
855 ty::Param(_) | ty::Placeholder(_) => None,
856 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ty)));
}unreachable!("unexpected orig_value: {ty:?}"),
857 },
858 ty::GenericArgKind::Const(ct) => match ct.kind() {
859 ty::ConstKind::Infer(ty::InferConst::Var(v)) => {
860 Some(TyOrConstInferVar::Const(v))
861 }
862 ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(_) => None,
863 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ct)));
}unreachable!("unexpected orig_value: {ct:?}"),
864 },
865 })
866 .collect();
867
868 GoalStalledOn {
869 stalled_vars,
870 sub_roots,
871 stalled_maybe_info: maybe_info,
872 opaques: GoalStalledOnOpaques::Yes {
873 num_opaques_in_storage: canonical_goal
874 .canonical
875 .value
876 .predefined_opaques_in_body
877 .len(),
878 previously_succeeded_in_erased,
879 },
880 }
881 }
882
883 pub(super) fn compute_goal(
884 &mut self,
885 goal: Goal<I, I::Predicate>,
886 ) -> QueryResultOrRerunNonErased<I> {
887 let Goal { param_env, predicate } = goal;
888 let kind = predicate.kind();
889 self.enter_forall_with_assumptions(kind, param_env, |ecx, kind| {
890 Ok(match kind {
891 ty::PredicateKind::Clause(ty::ClauseKind::Trait(predicate)) => {
892 ecx.compute_trait_goal(Goal { param_env, predicate }).map(|(r, _via)| r)?
893 }
894 ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(predicate)) => {
895 ecx.compute_host_effect_goal(Goal { param_env, predicate })?
896 }
897 ty::PredicateKind::Clause(ty::ClauseKind::Projection(predicate)) => {
898 ecx.compute_projection_goal(Goal { param_env, predicate })?
899 }
900 ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(predicate)) => {
901 ecx.compute_type_outlives_goal(Goal { param_env, predicate })?
902 }
903 ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(predicate)) => {
904 ecx.compute_region_outlives_goal(Goal { param_env, predicate })?
905 }
906 ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
907 ecx.compute_const_arg_has_type_goal(Goal { param_env, predicate: (ct, ty) })?
908 }
909 ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
910 ecx.compute_unstable_feature_goal(param_env, symbol)?
911 }
912 ty::PredicateKind::Subtype(predicate) => {
913 ecx.compute_subtype_goal(Goal { param_env, predicate })?
914 }
915 ty::PredicateKind::Coerce(predicate) => {
916 ecx.compute_coerce_goal(Goal { param_env, predicate })?
917 }
918 ty::PredicateKind::DynCompatible(trait_def_id) => {
919 ecx.compute_dyn_compatible_goal(trait_def_id)?
920 }
921 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(term)) => {
922 ecx.compute_well_formed_goal(Goal { param_env, predicate: term })?
923 }
924 ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(ct)) => {
925 ecx.compute_const_evaluatable_goal(Goal { param_env, predicate: ct })?
926 }
927 ty::PredicateKind::ConstEquate(_, _) => {
928 {
::core::panicking::panic_fmt(format_args!("ConstEquate should not be emitted when `-Znext-solver` is active"));
}panic!("ConstEquate should not be emitted when `-Znext-solver` is active")
929 }
930 ty::PredicateKind::NormalizesTo(predicate) => {
931 ecx.compute_normalizes_to_goal(Goal { param_env, predicate })?
932 }
933 ty::PredicateKind::Ambiguous => {
934 ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)?
935 }
936 })
937 })
938 }
939
940 {}
#[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() ||
{ false } {
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("try_evaluate_added_goals",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(942u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{ meta.fields().value_set_all(&[]) })
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<Certainty, NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{
for _ in 0..FIXPOINT_STEP_LIMIT {
match self.evaluate_added_goals_step().map_err_to_rerun()? {
Ok(None) => {}
Ok(Some(cert)) => return Ok(cert),
Err(NoSolution) => {
self.tainted = Err(NoSolution);
return Err(NoSolution.into());
}
}
}
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:957",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(957u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("try_evaluate_added_goals: encountered overflow")
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
Ok(Certainty::overflow(false))
}
}
}#[instrument(level = "trace", skip(self))]
943 pub(super) fn try_evaluate_added_goals(
944 &mut self,
945 ) -> Result<Certainty, NoSolutionOrRerunNonErased> {
946 for _ in 0..FIXPOINT_STEP_LIMIT {
947 match self.evaluate_added_goals_step().map_err_to_rerun()? {
948 Ok(None) => {}
949 Ok(Some(cert)) => return Ok(cert),
950 Err(NoSolution) => {
951 self.tainted = Err(NoSolution);
952 return Err(NoSolution.into());
953 }
954 }
955 }
956
957 debug!("try_evaluate_added_goals: encountered overflow");
958 Ok(Certainty::overflow(false))
959 }
960
961 fn evaluate_added_goals_step(
965 &mut self,
966 ) -> Result<Option<Certainty>, NoSolutionOrRerunNonErased> {
967 let mut unchanged_certainty = Some(Certainty::Yes);
969 for (source, goal, stalled_on) in mem::take(&mut self.nested_goals) {
973 if true {
if !!#[allow(non_exhaustive_omitted_patterns)] match goal.predicate.kind().skip_binder()
{
PredicateKind::NormalizesTo(_) => true,
_ => false,
} {
::core::panicking::panic("assertion failed: !matches!(goal.predicate.kind().skip_binder(), PredicateKind::NormalizesTo(_))")
};
};debug_assert!(!matches!(
975 goal.predicate.kind().skip_binder(),
976 PredicateKind::NormalizesTo(_)
977 ));
978
979 let GoalEvaluation { goal, certainty, has_changed, stalled_on } =
980 self.evaluate_goal(source, goal, stalled_on)?;
981 if has_changed == HasChanged::Yes {
982 unchanged_certainty = None;
983 }
984
985 match certainty {
986 Certainty::Yes => {}
987 Certainty::Maybe { .. } => {
988 self.nested_goals.push((source, goal, stalled_on));
989 unchanged_certainty = unchanged_certainty.map(|c| c.and(certainty));
990 }
991 }
992 }
993
994 Ok(unchanged_certainty)
995 }
996
997 pub(crate) fn record_impl_args(&mut self, impl_args: I::GenericArgs) {
999 self.inspect.record_impl_args(self.delegate, self.max_input_universe, impl_args)
1000 }
1001
1002 pub(super) fn cx(&self) -> I {
1003 self.delegate.cx()
1004 }
1005
1006 {}
#[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() ||
{ false } {
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("add_goal",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1006u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("source")
}> =
::tracing::__macro_support::FieldName::new("source");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&source)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<(), NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{
goal.predicate =
self.normalize(GoalSource::NormalizeGoal(self.step_kind_for_source(source)),
goal.param_env, ty::Unnormalized::new_wip(goal.predicate))?;
self.inspect.add_goal(self.delegate, self.max_input_universe,
source, goal);
if let Some(GoalEvaluation {
goal, certainty, has_changed: _, stalled_on }) =
compute_goal_fast_path(self.delegate, goal,
self.origin_span) {
match certainty {
Certainty::Yes => {}
Certainty::Maybe(_) => {
self.nested_goals.push((source, goal, stalled_on));
}
}
} else { self.nested_goals.push((source, goal, None)); }
Ok(())
}
}
}#[instrument(level = "debug", skip(self))]
1007 pub(super) fn add_goal(
1008 &mut self,
1009 source: GoalSource,
1010 mut goal: Goal<I, I::Predicate>,
1011 ) -> Result<(), NoSolutionOrRerunNonErased> {
1012 goal.predicate = self.normalize(
1013 GoalSource::NormalizeGoal(self.step_kind_for_source(source)),
1014 goal.param_env,
1015 ty::Unnormalized::new_wip(goal.predicate),
1016 )?;
1017 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1018
1019 if let Some(GoalEvaluation { goal, certainty, has_changed: _, stalled_on }) =
1020 compute_goal_fast_path(self.delegate, goal, self.origin_span)
1021 {
1022 match certainty {
1023 Certainty::Yes => {}
1025 Certainty::Maybe(_) => {
1026 self.nested_goals.push((source, goal, stalled_on));
1027 }
1028 }
1029 } else {
1030 self.nested_goals.push((source, goal, None));
1031 }
1032 Ok(())
1033 }
1034
1035 {}
#[allow(clippy :: suspicious_else_formatting)]
{
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() ||
{ false } {
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("add_goals",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1035u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("source")
}> =
::tracing::__macro_support::FieldName::new("source");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&source)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<(), NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{ for goal in goals { self.add_goal(source, goal)?; } Ok(()) }
}
}#[instrument(level = "trace", skip(self, goals))]
1036 pub(super) fn add_goals(
1037 &mut self,
1038 source: GoalSource,
1039 goals: impl IntoIterator<Item = Goal<I, I::Predicate>>,
1040 ) -> Result<(), NoSolutionOrRerunNonErased> {
1041 for goal in goals {
1042 self.add_goal(source, goal)?;
1043 }
1044 Ok(())
1045 }
1046
1047 pub(super) fn next_region_var(&mut self) -> Region<I> {
1048 let region = self.delegate.next_region_infer();
1049 self.inspect.add_var_value(region);
1050 region
1051 }
1052
1053 pub(super) fn next_ty_infer(&mut self) -> I::Ty {
1054 let ty = self.delegate.next_ty_infer();
1055 self.inspect.add_var_value(ty);
1056 ty
1057 }
1058
1059 pub(super) fn next_const_infer(&mut self) -> I::Const {
1060 let ct = self.delegate.next_const_infer();
1061 self.inspect.add_var_value(ct);
1062 ct
1063 }
1064
1065 pub(super) fn next_term_infer_of_alias_kind(
1068 &mut self,
1069 alias_term: ty::AliasTerm<I>,
1070 ) -> I::Term {
1071 match alias_term.kind {
1072 ty::AliasTermKind::ProjectionTy { .. }
1073 | ty::AliasTermKind::InherentTy { .. }
1074 | ty::AliasTermKind::OpaqueTy { .. }
1075 | ty::AliasTermKind::FreeTy { .. } => self.next_ty_infer().into(),
1076 ty::AliasTermKind::FreeConst { .. }
1077 | ty::AliasTermKind::InherentConstSelf { .. }
1078 | ty::AliasTermKind::InherentConstImpl { .. }
1079 | ty::AliasTermKind::AnonConst { .. }
1080 | ty::AliasTermKind::ProjectionConst { .. } => self.next_const_infer().into(),
1081 }
1082 }
1083
1084 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("term_is_fully_unconstrained",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1088u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: bool = loop {};
return __tracing_attr_fake_return;
}
{
let universe_of_term =
match goal.predicate.term.kind() {
ty::TermKind::Ty(ty) => {
if let ty::Infer(ty::TyVar(vid)) = ty.kind() {
self.delegate.universe_of_ty(vid).unwrap()
} else { return false; }
}
ty::TermKind::Const(ct) => {
if let ty::ConstKind::Infer(ty::InferConst::Var(vid)) =
ct.kind() {
self.delegate.universe_of_ct(vid).unwrap()
} else { return false; }
}
};
struct ContainsTermOrNotNameable<'a,
D: SolverDelegate<Interner = I>, I: Interner> {
term: I::Term,
universe_of_term: ty::UniverseIndex,
delegate: &'a D,
cache: HashSet<I::Ty>,
}
impl<D: SolverDelegate<Interner = I>, I: Interner>
ContainsTermOrNotNameable<'_, D, I> {
fn check_nameable(&self, universe: ty::UniverseIndex)
-> ControlFlow<()> {
if self.universe_of_term.can_name(universe) {
ControlFlow::Continue(())
} else { ControlFlow::Break(()) }
}
}
impl<D: SolverDelegate<Interner = I>, I: Interner>
TypeVisitor<I> for ContainsTermOrNotNameable<'_, D, I> {
type Result = ControlFlow<()>;
fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
if self.cache.contains(&t) {
return ControlFlow::Continue(());
}
match t.kind() {
ty::Infer(ty::TyVar(vid)) => {
if let ty::TermKind::Ty(term) = self.term.kind() &&
let ty::Infer(ty::TyVar(term_vid)) = term.kind() &&
self.delegate.root_ty_var(vid) ==
self.delegate.root_ty_var(term_vid) {
return ControlFlow::Break(());
}
self.check_nameable(self.delegate.universe_of_ty(vid).unwrap())?;
}
ty::Placeholder(p) => self.check_nameable(p.universe())?,
_ => {
if t.has_non_region_infer() || t.has_placeholders() {
t.super_visit_with(self)?
}
}
}
if !self.cache.insert(t) {
::core::panicking::panic("assertion failed: self.cache.insert(t)")
};
ControlFlow::Continue(())
}
fn visit_const(&mut self, c: I::Const) -> Self::Result {
match c.kind() {
ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
if let ty::TermKind::Const(term) = self.term.kind() &&
let ty::ConstKind::Infer(ty::InferConst::Var(term_vid)) =
term.kind() &&
self.delegate.root_const_var(vid) ==
self.delegate.root_const_var(term_vid) {
return ControlFlow::Break(());
}
self.check_nameable(self.delegate.universe_of_ct(vid).unwrap())
}
ty::ConstKind::Placeholder(p) =>
self.check_nameable(p.universe()),
_ => {
if c.has_non_region_infer() || c.has_placeholders() {
c.super_visit_with(self)
} else { ControlFlow::Continue(()) }
}
}
}
fn visit_predicate(&mut self, p: I::Predicate)
-> Self::Result {
if p.has_non_region_infer() || p.has_placeholders() {
p.super_visit_with(self)
} else { ControlFlow::Continue(()) }
}
fn visit_clauses(&mut self, c: I::Clauses) -> Self::Result {
if c.has_non_region_infer() || c.has_placeholders() {
c.super_visit_with(self)
} else { ControlFlow::Continue(()) }
}
}
let mut visitor =
ContainsTermOrNotNameable {
delegate: self.delegate,
universe_of_term,
term: goal.predicate.term,
cache: Default::default(),
};
goal.predicate.alias.visit_with(&mut visitor).is_continue()
&& goal.param_env.visit_with(&mut visitor).is_continue()
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1088",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1088u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self), ret)]
1089 pub(super) fn term_is_fully_unconstrained(&self, goal: Goal<I, ty::NormalizesTo<I>>) -> bool {
1090 let universe_of_term = match goal.predicate.term.kind() {
1091 ty::TermKind::Ty(ty) => {
1092 if let ty::Infer(ty::TyVar(vid)) = ty.kind() {
1093 self.delegate.universe_of_ty(vid).unwrap()
1094 } else {
1095 return false;
1096 }
1097 }
1098 ty::TermKind::Const(ct) => {
1099 if let ty::ConstKind::Infer(ty::InferConst::Var(vid)) = ct.kind() {
1100 self.delegate.universe_of_ct(vid).unwrap()
1101 } else {
1102 return false;
1103 }
1104 }
1105 };
1106
1107 struct ContainsTermOrNotNameable<'a, D: SolverDelegate<Interner = I>, I: Interner> {
1108 term: I::Term,
1109 universe_of_term: ty::UniverseIndex,
1110 delegate: &'a D,
1111 cache: HashSet<I::Ty>,
1112 }
1113
1114 impl<D: SolverDelegate<Interner = I>, I: Interner> ContainsTermOrNotNameable<'_, D, I> {
1115 fn check_nameable(&self, universe: ty::UniverseIndex) -> ControlFlow<()> {
1116 if self.universe_of_term.can_name(universe) {
1117 ControlFlow::Continue(())
1118 } else {
1119 ControlFlow::Break(())
1120 }
1121 }
1122 }
1123
1124 impl<D: SolverDelegate<Interner = I>, I: Interner> TypeVisitor<I>
1125 for ContainsTermOrNotNameable<'_, D, I>
1126 {
1127 type Result = ControlFlow<()>;
1128 fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
1129 if self.cache.contains(&t) {
1130 return ControlFlow::Continue(());
1131 }
1132
1133 match t.kind() {
1134 ty::Infer(ty::TyVar(vid)) => {
1135 if let ty::TermKind::Ty(term) = self.term.kind()
1136 && let ty::Infer(ty::TyVar(term_vid)) = term.kind()
1137 && self.delegate.root_ty_var(vid) == self.delegate.root_ty_var(term_vid)
1138 {
1139 return ControlFlow::Break(());
1140 }
1141
1142 self.check_nameable(self.delegate.universe_of_ty(vid).unwrap())?;
1143 }
1144 ty::Placeholder(p) => self.check_nameable(p.universe())?,
1145 _ => {
1146 if t.has_non_region_infer() || t.has_placeholders() {
1147 t.super_visit_with(self)?
1148 }
1149 }
1150 }
1151
1152 assert!(self.cache.insert(t));
1153 ControlFlow::Continue(())
1154 }
1155
1156 fn visit_const(&mut self, c: I::Const) -> Self::Result {
1157 match c.kind() {
1158 ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
1159 if let ty::TermKind::Const(term) = self.term.kind()
1160 && let ty::ConstKind::Infer(ty::InferConst::Var(term_vid)) = term.kind()
1161 && self.delegate.root_const_var(vid)
1162 == self.delegate.root_const_var(term_vid)
1163 {
1164 return ControlFlow::Break(());
1165 }
1166
1167 self.check_nameable(self.delegate.universe_of_ct(vid).unwrap())
1168 }
1169 ty::ConstKind::Placeholder(p) => self.check_nameable(p.universe()),
1170 _ => {
1171 if c.has_non_region_infer() || c.has_placeholders() {
1172 c.super_visit_with(self)
1173 } else {
1174 ControlFlow::Continue(())
1175 }
1176 }
1177 }
1178 }
1179
1180 fn visit_predicate(&mut self, p: I::Predicate) -> Self::Result {
1181 if p.has_non_region_infer() || p.has_placeholders() {
1182 p.super_visit_with(self)
1183 } else {
1184 ControlFlow::Continue(())
1185 }
1186 }
1187
1188 fn visit_clauses(&mut self, c: I::Clauses) -> Self::Result {
1189 if c.has_non_region_infer() || c.has_placeholders() {
1190 c.super_visit_with(self)
1191 } else {
1192 ControlFlow::Continue(())
1193 }
1194 }
1195 }
1196
1197 let mut visitor = ContainsTermOrNotNameable {
1198 delegate: self.delegate,
1199 universe_of_term,
1200 term: goal.predicate.term,
1201 cache: Default::default(),
1202 };
1203 goal.predicate.alias.visit_with(&mut visitor).is_continue()
1204 && goal.param_env.visit_with(&mut visitor).is_continue()
1205 }
1206
1207 pub(super) fn sub_unify_ty_vids_raw(&self, a: ty::TyVid, b: ty::TyVid) {
1208 self.delegate.sub_unify_ty_vids_raw(a, b)
1209 }
1210
1211 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("eq",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1211u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("lhs")
}> =
::tracing::__macro_support::FieldName::new("lhs");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("rhs")
}> =
::tracing::__macro_support::FieldName::new("rhs");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&lhs)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&rhs)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<(), NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{
self.relate(param_env, lhs, ty::Variance::Invariant, rhs)
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1211",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1211u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self, param_env), ret)]
1212 pub(super) fn eq<T: Relate<I>>(
1213 &mut self,
1214 param_env: I::ParamEnv,
1215 lhs: T,
1216 rhs: T,
1217 ) -> Result<(), NoSolutionOrRerunNonErased> {
1218 self.relate(param_env, lhs, ty::Variance::Invariant, rhs)
1219 }
1220
1221 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("sub",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1221u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("sub")
}> =
::tracing::__macro_support::FieldName::new("sub");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("sup")
}> =
::tracing::__macro_support::FieldName::new("sup");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&sub)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&sup)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<(), NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{
self.relate(param_env, sub, ty::Variance::Covariant, sup)
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1221",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1221u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self, param_env), ret)]
1222 pub(super) fn sub<T: Relate<I>>(
1223 &mut self,
1224 param_env: I::ParamEnv,
1225 sub: T,
1226 sup: T,
1227 ) -> Result<(), NoSolutionOrRerunNonErased> {
1228 self.relate(param_env, sub, ty::Variance::Covariant, sup)
1229 }
1230
1231 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("relate",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1231u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("lhs")
}> =
::tracing::__macro_support::FieldName::new("lhs");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("variance")
}> =
::tracing::__macro_support::FieldName::new("variance");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("rhs")
}> =
::tracing::__macro_support::FieldName::new("rhs");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&lhs)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&variance)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&rhs)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<(), NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{
let goals =
self.delegate.relate(param_env, lhs, variance, rhs,
self.origin_span)?;
for &goal in goals.iter() {
let source =
match goal.predicate.kind().skip_binder() {
ty::PredicateKind::Subtype { .. } |
ty::PredicateKind::Clause(ty::ClauseKind::Projection(..)) =>
{
GoalSource::TypeRelating
}
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) =>
GoalSource::Misc,
p => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected nested goal in `relate`: {0:?}",
p)));
}
};
self.add_goal(source, goal)?;
}
Ok(())
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1231",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1231u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self, param_env), ret)]
1232 pub(super) fn relate<T: Relate<I>>(
1233 &mut self,
1234 param_env: I::ParamEnv,
1235 lhs: T,
1236 variance: ty::Variance,
1237 rhs: T,
1238 ) -> Result<(), NoSolutionOrRerunNonErased> {
1239 let goals = self.delegate.relate(param_env, lhs, variance, rhs, self.origin_span)?;
1240 for &goal in goals.iter() {
1241 let source = match goal.predicate.kind().skip_binder() {
1242 ty::PredicateKind::Subtype { .. }
1243 | ty::PredicateKind::Clause(ty::ClauseKind::Projection(..)) => {
1244 GoalSource::TypeRelating
1245 }
1246 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => GoalSource::Misc,
1248 p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
1249 };
1250 self.add_goal(source, goal)?;
1251 }
1252 Ok(())
1253 }
1254
1255 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("eq_and_get_goals",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1260u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("lhs")
}> =
::tracing::__macro_support::FieldName::new("lhs");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("rhs")
}> =
::tracing::__macro_support::FieldName::new("rhs");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&lhs)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&rhs)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<Vec<Goal<I, I::Predicate>>, NoSolution> = loop {};
return __tracing_attr_fake_return;
}
{
Ok(self.delegate.relate(param_env, lhs,
ty::Variance::Invariant, rhs, self.origin_span)?)
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1260",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1260u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self, param_env), ret)]
1261 pub(super) fn eq_and_get_goals<T: Relate<I>>(
1262 &self,
1263 param_env: I::ParamEnv,
1264 lhs: T,
1265 rhs: T,
1266 ) -> Result<Vec<Goal<I, I::Predicate>>, NoSolution> {
1267 Ok(self.delegate.relate(param_env, lhs, ty::Variance::Invariant, rhs, self.origin_span)?)
1268 }
1269
1270 pub(super) fn instantiate_binder_with_infer<T: TypeFoldable<I> + Copy>(
1271 &self,
1272 value: ty::Binder<I, T>,
1273 ) -> T {
1274 self.delegate.instantiate_binder_with_infer(value)
1275 }
1276
1277 pub(super) fn enter_forall_with_assumptions<T: TypeFoldable<I>, U>(
1285 &mut self,
1286 value: ty::Binder<I, T>,
1287 param_env: I::ParamEnv,
1288 f: impl FnOnce(&mut Self, T) -> U,
1289 ) -> U {
1290 self.delegate.enter_forall_without_assumptions(value, |value| {
1291 let u = self.delegate.universe();
1292 let assumptions = if self.cx().assumptions_on_binders() {
1293 self.region_assumptions_for_placeholders_in_universe(value.clone(), u, param_env)
1294 } else {
1295 None
1296 };
1297 self.delegate.insert_placeholder_assumptions(u, assumptions);
1298 f(self, value)
1299 })
1300 }
1301
1302 pub(super) fn resolve_vars_if_possible<T>(&self, value: T) -> T
1303 where
1304 T: TypeFoldable<I>,
1305 {
1306 self.delegate.resolve_vars_if_possible(value)
1307 }
1308
1309 pub(super) fn shallow_resolve(&self, ty: I::Ty) -> I::Ty {
1310 self.delegate.shallow_resolve(ty)
1311 }
1312
1313 pub(super) fn eager_resolve_region(&self, r: Region<I>) -> Region<I> {
1314 if let ty::ReVar(vid) = r.kind() {
1315 self.delegate.opportunistic_resolve_lt_var(vid)
1316 } else {
1317 r
1318 }
1319 }
1320
1321 pub(super) fn fresh_args_for_item(&mut self, def_id: I::DefId) -> I::GenericArgs {
1322 let args = self.delegate.fresh_args_for_item(def_id);
1323 for arg in args.iter() {
1324 self.inspect.add_var_value(arg);
1325 }
1326 args
1327 }
1328
1329 pub(super) fn register_solver_region_constraint(&self, c: RegionConstraint<I>) {
1330 self.delegate.register_solver_region_constraint(c, self.origin_span);
1331 }
1332
1333 pub(super) fn register_ty_outlives(&self, ty: I::Ty, lt: Region<I>) {
1334 self.delegate.register_ty_outlives(ty, lt, self.origin_span);
1335 }
1336
1337 pub(super) fn register_region_outlives(
1338 &self,
1339 a: Region<I>,
1340 b: Region<I>,
1341 vis: VisibleForLeakCheck,
1342 ) {
1343 self.delegate.sub_regions(b, a, vis, self.origin_span);
1345 }
1346
1347 pub(super) fn well_formed_goals(
1349 &self,
1350 param_env: I::ParamEnv,
1351 term: I::Term,
1352 ) -> Option<Vec<Goal<I, I::Predicate>>> {
1353 self.delegate.well_formed_goals(param_env, term)
1354 }
1355
1356 pub(super) fn trait_ref_is_knowable(
1357 &mut self,
1358 param_env: I::ParamEnv,
1359 trait_ref: ty::TraitRef<I>,
1360 ) -> Result<bool, NoSolutionOrRerunNonErased> {
1361 let delegate = self.delegate;
1362 let lazily_normalize_ty = |ty| self.structurally_normalize_ty(param_env, ty);
1363 coherence::trait_ref_is_knowable(&**delegate, trait_ref, lazily_normalize_ty)
1364 .map(|is_knowable| is_knowable.is_ok())
1365 }
1366
1367 pub(super) fn fetch_eligible_assoc_item(
1368 &self,
1369 goal_trait_ref: ty::TraitRef<I>,
1370 trait_assoc_def_id: I::TraitAssocTermId,
1371 impl_def_id: I::ImplId,
1372 ) -> FetchEligibleAssocItemResponse<I> {
1373 self.delegate.fetch_eligible_assoc_item(goal_trait_ref, trait_assoc_def_id, impl_def_id)
1374 }
1375
1376 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("register_hidden_type_in_storage",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1376u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("opaque_type_key")
}> =
::tracing::__macro_support::FieldName::new("opaque_type_key");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("hidden_ty")
}> =
::tracing::__macro_support::FieldName::new("hidden_ty");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&opaque_type_key)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&hidden_ty)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: Option<I::Ty> = loop {};
return __tracing_attr_fake_return;
}
{
self.delegate.register_hidden_type_in_storage(opaque_type_key,
hidden_ty, self.origin_span)
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1376",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1376u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "debug", skip(self), ret)]
1377 pub(super) fn register_hidden_type_in_storage(
1378 &mut self,
1379 opaque_type_key: ty::OpaqueTypeKey<I>,
1380 hidden_ty: I::Ty,
1381 ) -> Option<I::Ty> {
1382 self.delegate.register_hidden_type_in_storage(opaque_type_key, hidden_ty, self.origin_span)
1383 }
1384
1385 pub(super) fn add_item_bounds_for_hidden_type(
1386 &mut self,
1387 opaque_def_id: I::OpaqueTyId,
1388 opaque_args: I::GenericArgs,
1389 param_env: I::ParamEnv,
1390 hidden_ty: I::Ty,
1391 ) -> Result<(), NoSolutionOrRerunNonErased> {
1392 let mut goals = Vec::new();
1393 self.delegate.add_item_bounds_for_hidden_type(
1394 opaque_def_id,
1395 opaque_args,
1396 param_env,
1397 hidden_ty,
1398 &mut goals,
1399 );
1400 self.add_goals(GoalSource::AliasWellFormed, goals)?;
1401 Ok(())
1402 }
1403
1404 pub(super) fn evaluate_const(
1408 &mut self,
1409 param_env: I::ParamEnv,
1410 alias_const: ty::AliasConst<I>,
1411 ) -> Result<Option<I::Const>, NoSolutionOrRerunNonErased> {
1412 if self.typing_mode().is_erased_not_coherence() {
1413 match self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)? {}
1414 }
1415
1416 self.delegate.evaluate_const(param_env, alias_const, |ty| {
1417 self.normalize(GoalSource::Misc, param_env, ty)
1418 })
1419 }
1420
1421 pub(super) fn evaluate_const_and_instantiate_projection_term(
1422 &mut self,
1423 param_env: I::ParamEnv,
1424 projection_term: ty::AliasTerm<I>,
1425 expected_term: I::Term,
1426 alias_const: ty::AliasConst<I>,
1427 ) -> QueryResultOrRerunNonErased<I> {
1428 match self.evaluate_const(param_env, alias_const)? {
1429 Some(evaluated) => {
1430 self.eq(param_env, expected_term, evaluated.into())?;
1431 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1432 }
1433 None if self.cx().features().generic_const_args() => {
1434 if self.resolve_vars_if_possible(alias_const).has_non_region_infer() {
1442 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1443 } else {
1444 self.eq(
1454 param_env,
1455 projection_term.to_term(self.cx(), ty::IsRigid::Yes),
1456 expected_term,
1457 )?;
1458 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1459 }
1460 }
1461 None => {
1462 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1464 }
1465 }
1466 }
1467
1468 pub(super) fn is_transmutable(
1469 &mut self,
1470 src: I::Ty,
1471 dst: I::Ty,
1472 assume: I::Const,
1473 ) -> Result<Certainty, NoSolution> {
1474 self.delegate.is_transmutable(dst, src, assume)
1475 }
1476
1477 pub(super) fn replace_bound_vars<T: TypeFoldable<I>>(
1478 &self,
1479 t: T,
1480 universes: &mut Vec<Option<ty::UniverseIndex>>,
1481 ) -> T {
1482 BoundVarReplacer::replace_bound_vars(&**self.delegate, universes, t).0
1483 }
1484
1485 pub(super) fn may_use_unstable_feature(
1486 &mut self,
1487 param_env: I::ParamEnv,
1488 symbol: I::Symbol,
1489 ) -> Result<bool, RerunNonErased> {
1490 if self.typing_mode().is_erased_not_coherence() {
1491 match self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)? {}
1492 }
1493
1494 Ok(may_use_unstable_feature(&**self.delegate, param_env, symbol))
1495 }
1496
1497 pub(crate) fn opaques_with_sub_unified_hidden_type(
1498 &self,
1499 self_ty: I::Ty,
1500 ) -> Vec<ty::OpaqueAliasTy<I>> {
1501 if let ty::Infer(ty::TyVar(vid)) = self_ty.kind() {
1502 self.delegate.opaques_with_sub_unified_hidden_type(vid)
1503 } else {
1504 ::alloc::vec::Vec::new()vec![]
1505 }
1506 }
1507
1508 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("evaluate_added_goals_and_make_canonical_response",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1521u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("shallow_certainty")
}> =
::tracing::__macro_support::FieldName::new("shallow_certainty");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&shallow_certainty)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
QueryResultOrRerunNonErased<I> = loop {};
return __tracing_attr_fake_return;
}
{
self.inspect.make_canonical_response(shallow_certainty);
let goals_certainty = self.try_evaluate_added_goals()?;
{
match (&self.tainted, &Ok(())) {
(left_val, right_val) => {
if !(*left_val == *right_val) {
let kind = ::core::panicking::AssertKind::Eq;
::core::panicking::assert_failed(kind, &*left_val,
&*right_val,
::core::option::Option::Some(format_args!("EvalCtxt is tainted -- nested goals may have been dropped in a previous call to `try_evaluate_added_goals!`")));
}
}
}
};
let goals_certainty =
match self.delegate.cx().assumptions_on_binders() {
true => {
let certainty = self.eagerly_handle_placeholders()?;
certainty.and(goals_certainty)
}
false => {
self.delegate.leak_check(self.max_input_universe).map_err(|NoSolution|
{
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1545",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1545u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("failed the leak check")
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
NoSolution
})?;
goals_certainty
}
};
let (certainty, normalization_nested_goals) =
match (self.current_goal_kind, shallow_certainty) {
(CurrentGoalKind::ProjectionComputeAssocTermCandidate,
Certainty::Yes) => {
let goals = std::mem::take(&mut self.nested_goals);
if goals.is_empty() {
if !#[allow(non_exhaustive_omitted_patterns)] match goals_certainty
{
Certainty::Yes => true,
_ => false,
} {
::core::panicking::panic("assertion failed: matches!(goals_certainty, Certainty::Yes)")
};
}
(Certainty::Yes,
NestedNormalizationGoals(goals.into_iter().map(|(s, g, _)|
(s, g)).collect()))
}
_ => {
let certainty = shallow_certainty.and(goals_certainty);
(certainty, NestedNormalizationGoals::empty())
}
};
if let Certainty::Maybe(maybe_info @ MaybeInfo {
cause: MaybeCause::Overflow { keep_constraints: false, .. },
opaque_types_jank: _,
stalled_on_coroutines: _ }) = certainty {
return Ok(self.make_ambiguous_response_no_constraints(maybe_info));
}
let external_constraints =
self.compute_external_query_constraints(certainty,
normalization_nested_goals);
let (var_values, mut external_constraints) =
eager_resolve_vars(&**self.delegate,
(self.var_values, external_constraints));
let mut unique = HashSet::default();
if let ExternalRegionConstraints::Old(r) =
&mut external_constraints.region_constraints {
r.retain(|(outlives, _)|
!outlives.is_trivial() && unique.insert(*outlives));
}
let canonical =
canonicalize_response(self.delegate,
self.max_input_universe,
Response {
var_values,
certainty,
external_constraints: self.cx().mk_external_constraints(external_constraints),
});
Ok(canonical)
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1521",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1521u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self), ret)]
1522 pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
1523 &mut self,
1524 shallow_certainty: Certainty,
1525 ) -> QueryResultOrRerunNonErased<I> {
1526 self.inspect.make_canonical_response(shallow_certainty);
1527
1528 let goals_certainty = self.try_evaluate_added_goals()?;
1529 assert_eq!(
1530 self.tainted,
1531 Ok(()),
1532 "EvalCtxt is tainted -- nested goals may have been dropped in a \
1533 previous call to `try_evaluate_added_goals!`"
1534 );
1535
1536 let goals_certainty = match self.delegate.cx().assumptions_on_binders() {
1537 true => {
1538 let certainty = self.eagerly_handle_placeholders()?;
1539 certainty.and(goals_certainty)
1540 }
1541 false => {
1542 self.delegate.leak_check(self.max_input_universe).map_err(|NoSolution| {
1545 trace!("failed the leak check");
1546 NoSolution
1547 })?;
1548
1549 goals_certainty
1550 }
1551 };
1552
1553 let (certainty, normalization_nested_goals) =
1554 match (self.current_goal_kind, shallow_certainty) {
1555 (CurrentGoalKind::ProjectionComputeAssocTermCandidate, Certainty::Yes) => {
1563 let goals = std::mem::take(&mut self.nested_goals);
1564 if goals.is_empty() {
1567 assert!(matches!(goals_certainty, Certainty::Yes));
1568 }
1569 (
1570 Certainty::Yes,
1571 NestedNormalizationGoals(
1572 goals.into_iter().map(|(s, g, _)| (s, g)).collect(),
1573 ),
1574 )
1575 }
1576 _ => {
1577 let certainty = shallow_certainty.and(goals_certainty);
1578 (certainty, NestedNormalizationGoals::empty())
1579 }
1580 };
1581
1582 if let Certainty::Maybe(
1583 maybe_info @ MaybeInfo {
1584 cause: MaybeCause::Overflow { keep_constraints: false, .. },
1585 opaque_types_jank: _,
1586 stalled_on_coroutines: _,
1587 },
1588 ) = certainty
1589 {
1590 return Ok(self.make_ambiguous_response_no_constraints(maybe_info));
1602 }
1603
1604 let external_constraints =
1605 self.compute_external_query_constraints(certainty, normalization_nested_goals);
1606 let (var_values, mut external_constraints) =
1607 eager_resolve_vars(&**self.delegate, (self.var_values, external_constraints));
1608
1609 let mut unique = HashSet::default();
1611 if let ExternalRegionConstraints::Old(r) = &mut external_constraints.region_constraints {
1612 r.retain(|(outlives, _)| !outlives.is_trivial() && unique.insert(*outlives));
1613 }
1614
1615 let canonical = canonicalize_response(
1616 self.delegate,
1617 self.max_input_universe,
1618 Response {
1619 var_values,
1620 certainty,
1621 external_constraints: self.cx().mk_external_constraints(external_constraints),
1622 },
1623 );
1624
1625 Ok(canonical)
1626 }
1627
1628 pub(in crate::solve) fn make_ambiguous_response_no_constraints(
1633 &self,
1634 maybe: MaybeInfo,
1635 ) -> CanonicalResponse<I> {
1636 response_no_constraints_raw(
1637 self.cx(),
1638 self.max_input_universe,
1639 self.var_kinds,
1640 Certainty::Maybe(maybe),
1641 )
1642 }
1643
1644 {}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("compute_external_query_constraints",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1651u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("certainty")
}> =
::tracing::__macro_support::FieldName::new("certainty");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("normalization_nested_goals")
}> =
::tracing::__macro_support::FieldName::new("normalization_nested_goals");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&certainty)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&normalization_nested_goals)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: ExternalConstraintsData<I> =
loop {};
return __tracing_attr_fake_return;
}
{
let region_constraints =
if self.cx().assumptions_on_binders() {
ExternalRegionConstraints::NextGen(if let Certainty::Yes =
certainty {
let constraint =
self.delegate.get_solver_region_constraint();
if true {
{
match (&constraint,
®ion_constraint::propagate_ambiguity(constraint.clone()))
{
(left_val, right_val) => {
if !(*left_val == *right_val) {
let kind = ::core::panicking::AssertKind::Eq;
::core::panicking::assert_failed(kind, &*left_val,
&*right_val, ::core::option::Option::None);
}
}
}
};
};
constraint
} else { RegionConstraint::new_true() })
} else {
ExternalRegionConstraints::Old(if let Certainty::Yes =
certainty {
self.delegate.make_deduplicated_region_constraints()
} else { ::alloc::vec::Vec::new() })
};
let opaque_types =
self.delegate.clone_opaque_types_added_since(self.initial_opaque_types_storage_num_entries);
if self.typing_mode().is_erased_not_coherence() {
if !opaque_types.is_empty() {
::core::panicking::panic("assertion failed: opaque_types.is_empty()")
};
}
ExternalConstraintsData {
region_constraints,
opaque_types,
normalization_nested_goals,
}
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1651",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1651u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self), ret)]
1652 fn compute_external_query_constraints(
1653 &self,
1654 certainty: Certainty,
1655 normalization_nested_goals: NestedNormalizationGoals<I>,
1656 ) -> ExternalConstraintsData<I> {
1657 let region_constraints = if self.cx().assumptions_on_binders() {
1666 ExternalRegionConstraints::NextGen(if let Certainty::Yes = certainty {
1667 let constraint = self.delegate.get_solver_region_constraint();
1668 debug_assert_eq!(
1669 constraint,
1670 region_constraint::propagate_ambiguity(constraint.clone())
1671 );
1672 constraint
1673 } else {
1674 RegionConstraint::new_true()
1675 })
1676 } else {
1677 ExternalRegionConstraints::Old(if let Certainty::Yes = certainty {
1678 self.delegate.make_deduplicated_region_constraints()
1679 } else {
1680 vec![]
1681 })
1682 };
1683
1684 let opaque_types = self
1689 .delegate
1690 .clone_opaque_types_added_since(self.initial_opaque_types_storage_num_entries);
1691
1692 if self.typing_mode().is_erased_not_coherence() {
1693 assert!(opaque_types.is_empty());
1694 }
1695
1696 ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals }
1697 }
1698
1699 pub(super) fn normalize<T: TypeFoldable<I>>(
1700 &mut self,
1701 source: GoalSource,
1702 param_env: I::ParamEnv,
1703 value: ty::Unnormalized<I, T>,
1704 ) -> Result<T, NoSolutionOrRerunNonErased> {
1705 let value = self.delegate.resolve_vars_if_possible(value.skip_normalization());
1706
1707 if !self.cx().renormalize_rigid_aliases() && !value.has_non_rigid_aliases() {
1708 return Ok(value);
1709 }
1710
1711 let infcx = self.delegate.deref();
1713 let mut folder = NormalizationFolder::new(infcx, ::alloc::vec::Vec::new()vec![], |alias_term| {
1714 let infer_term = self.next_term_infer_of_alias_kind(alias_term);
1715 let pred = ty::ProjectionClause { projection_term: alias_term, term: infer_term };
1716 let goal = Goal::new(self.cx(), param_env, pred);
1717 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1718 let GoalEvaluation { goal, certainty, has_changed: _, stalled_on } =
1719 self.evaluate_goal(source, goal, None)?;
1720 let normalization_was_ambiguous = match certainty {
1721 Certainty::Yes => NormalizationWasAmbiguous::No,
1722 Certainty::Maybe(_) => {
1723 self.nested_goals.push((source, goal, stalled_on));
1724 NormalizationWasAmbiguous::Yes
1725 }
1726 };
1727
1728 Ok((self.resolve_vars_if_possible(infer_term), normalization_was_ambiguous))
1729 });
1730 value.try_fold_with(&mut folder)
1731 }
1732}
1733
1734#[derive(#[automatically_derived]
impl ::core::fmt::Debug for RerunDecision {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
RerunDecision::Yes => "Yes",
RerunDecision::No => "No",
RerunDecision::EagerlyPropagateToParent =>
"EagerlyPropagateToParent",
})
}
}Debug)]
1735enum RerunDecision {
1736 Yes,
1737 No,
1738 EagerlyPropagateToParent,
1739}
1740
1741{}
let __tracing_attr_span;
let __tracing_attr_guard;
if ::tracing::Level::INFO <= ::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::INFO <=
::tracing::level_filters::LevelFilter::current() || { false }
{
__tracing_attr_span =
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("should_rerun_after_erased_canonicalization",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::INFO,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1741u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("rerun")
}> =
::tracing::__macro_support::FieldName::new("rerun");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("original_typing_mode")
}> =
::tracing::__macro_support::FieldName::new("original_typing_mode");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("parent_opaque_types")
}> =
::tracing::__macro_support::FieldName::new("parent_opaque_types");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::INFO <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::INFO <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&rerun)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&original_typing_mode)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&parent_opaque_types)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: RerunDecision = loop {};
return __tracing_attr_fake_return;
}
{
let parent_opaque_def_ids =
parent_opaque_types.iter().map(|(key, _)|
key.def_id.into());
let opaque_in_storage =
|opaques: I::LocalDefIds, def_ids: SmallCopySet<_>|
{
if def_ids.as_ref().is_empty() {
RerunDecision::No
} else if opaques.iter().chain(parent_opaque_def_ids).any(|opaque|
def_ids.as_ref().contains(&opaque)) {
RerunDecision::Yes
} else { RerunDecision::No }
};
let any_opaque_has_infer_as_hidden =
||
{
if parent_opaque_types.iter().any(|(_, ty)| ty.is_ty_var())
{
RerunDecision::Yes
} else { RerunDecision::No }
};
match (rerun, original_typing_mode) {
(RerunCondition::Never, _) => RerunDecision::No,
(_, TypingMode::ErasedNotCoherence(MayBeErased)) =>
RerunDecision::EagerlyPropagateToParent,
(_, TypingMode::Coherence) =>
::core::panicking::panic("internal error: entered unreachable code"),
(RerunCondition::Always, _) => RerunDecision::Yes,
(RerunCondition::OpaqueInStorage(..),
TypingMode::PostAnalysis | TypingMode::Codegen |
TypingMode::Reflection) => RerunDecision::Yes,
(RerunCondition::OpaqueInStorage(defids),
TypingMode::PostBorrowck { defined_opaque_types: opaques } |
TypingMode::Typeck {
defining_opaque_types_and_generators: opaques } |
TypingMode::PostTypeckUntilBorrowck {
defining_opaque_types: opaques }) =>
opaque_in_storage(opaques, defids),
(RerunCondition::AnyOpaqueHasInferAsHidden,
TypingMode::Typeck { .. }) => {
any_opaque_has_infer_as_hidden()
}
(RerunCondition::AnyOpaqueHasInferAsHidden,
TypingMode::PostBorrowck { .. } | TypingMode::PostAnalysis |
TypingMode::Codegen | TypingMode::Reflection |
TypingMode::PostTypeckUntilBorrowck { .. }) =>
RerunDecision::No,
(RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_),
TypingMode::PostAnalysis | TypingMode::Codegen |
TypingMode::Reflection) => RerunDecision::Yes,
(RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
TypingMode::Typeck {
defining_opaque_types_and_generators: opaques }) => {
if let RerunDecision::Yes = any_opaque_has_infer_as_hidden()
{
RerunDecision::Yes
} else if let RerunDecision::Yes =
opaque_in_storage(opaques, defids) {
RerunDecision::Yes
} else { RerunDecision::No }
}
(RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
TypingMode::PostBorrowck { defined_opaque_types: opaques } |
TypingMode::PostTypeckUntilBorrowck {
defining_opaque_types: opaques }) =>
opaque_in_storage(opaques, defids),
}
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1741",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::INFO,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0ed41eb4142dda2df61eb1145a312c1a9d62eb56/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1741u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::INFO <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::INFO <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[tracing::instrument(ret)]
1742fn should_rerun_after_erased_canonicalization<I: Interner>(
1743 AccessedOpaques { reason: _, rerun }: AccessedOpaques<I>,
1744 original_typing_mode: TypingMode<I>,
1745 parent_opaque_types: &[(OpaqueTypeKey<I>, I::Ty)],
1746) -> RerunDecision {
1747 let parent_opaque_def_ids = parent_opaque_types.iter().map(|(key, _)| key.def_id.into());
1748 let opaque_in_storage = |opaques: I::LocalDefIds, def_ids: SmallCopySet<_>| {
1749 if def_ids.as_ref().is_empty() {
1750 RerunDecision::No
1751 } else if opaques
1752 .iter()
1753 .chain(parent_opaque_def_ids)
1754 .any(|opaque| def_ids.as_ref().contains(&opaque))
1755 {
1756 RerunDecision::Yes
1757 } else {
1758 RerunDecision::No
1759 }
1760 };
1761 let any_opaque_has_infer_as_hidden = || {
1762 if parent_opaque_types.iter().any(|(_, ty)| ty.is_ty_var()) {
1763 RerunDecision::Yes
1764 } else {
1765 RerunDecision::No
1766 }
1767 };
1768
1769 match (rerun, original_typing_mode) {
1770 (RerunCondition::Never, _) => RerunDecision::No,
1772 (_, TypingMode::ErasedNotCoherence(MayBeErased)) => RerunDecision::EagerlyPropagateToParent,
1774 (_, TypingMode::Coherence) => unreachable!(),
1778 (RerunCondition::Always, _) => RerunDecision::Yes,
1780 (
1782 RerunCondition::OpaqueInStorage(..),
1783 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
1784 ) => RerunDecision::Yes,
1785 (
1786 RerunCondition::OpaqueInStorage(defids),
1787 TypingMode::PostBorrowck { defined_opaque_types: opaques }
1788 | TypingMode::Typeck { defining_opaque_types_and_generators: opaques }
1789 | TypingMode::PostTypeckUntilBorrowck { defining_opaque_types: opaques },
1790 ) => opaque_in_storage(opaques, defids),
1791 (RerunCondition::AnyOpaqueHasInferAsHidden, TypingMode::Typeck { .. }) => {
1793 any_opaque_has_infer_as_hidden()
1794 }
1795 (
1796 RerunCondition::AnyOpaqueHasInferAsHidden,
1797 TypingMode::PostBorrowck { .. }
1798 | TypingMode::PostAnalysis
1799 | TypingMode::Codegen
1800 | TypingMode::Reflection
1801 | TypingMode::PostTypeckUntilBorrowck { .. },
1802 ) => RerunDecision::No,
1803 (
1805 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_),
1806 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
1807 ) => RerunDecision::Yes,
1808 (
1809 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
1810 TypingMode::Typeck { defining_opaque_types_and_generators: opaques },
1811 ) => {
1812 if let RerunDecision::Yes = any_opaque_has_infer_as_hidden() {
1813 RerunDecision::Yes
1814 } else if let RerunDecision::Yes = opaque_in_storage(opaques, defids) {
1815 RerunDecision::Yes
1816 } else {
1817 RerunDecision::No
1818 }
1819 }
1820 (
1821 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
1822 TypingMode::PostBorrowck { defined_opaque_types: opaques }
1823 | TypingMode::PostTypeckUntilBorrowck { defining_opaque_types: opaques },
1824 ) => opaque_in_storage(opaques, defids),
1825 }
1826}
1827
1828pub fn evaluate_root_goal_for_proof_tree_raw_provider<
1830 D: SolverDelegate<Interner = I>,
1831 I: Interner,
1832>(
1833 cx: I,
1834 canonical_goal: I::CanonicalInput,
1835 root_depth: usize,
1836) -> (QueryResult<I>, I::Probe, RequiredDepth) {
1837 let mut inspect = inspect::ProofTreeBuilder::new();
1838 let ((canonical_result, accessed_opaques), required_depth) =
1839 SearchGraph::<D>::evaluate_root_goal_for_proof_tree(
1840 cx,
1841 root_depth,
1842 canonical_goal,
1843 &mut inspect,
1844 );
1845 let final_revision = inspect.unwrap();
1846
1847 if !!accessed_opaques.might_rerun() {
::core::panicking::panic("assertion failed: !accessed_opaques.might_rerun()")
};assert!(!accessed_opaques.might_rerun());
1848 (canonical_result, cx.mk_probe(final_revision), required_depth)
1849}
1850
1851pub(super) fn evaluate_root_goal_for_proof_tree<D: SolverDelegate<Interner = I>, I: Interner>(
1856 delegate: &D,
1857 goal: Goal<I, I::Predicate>,
1858 origin_span: I::Span,
1859 root_depth: usize,
1860) -> (Result<NestedNormalizationGoals<I>, NoSolution>, inspect::GoalEvaluation<I>) {
1861 let opaque_types = delegate.clone_opaque_types_lookup_table();
1862 let (goal, opaque_types) = eager_resolve_vars(&**delegate, (goal, opaque_types));
1863 let typing_mode = delegate.typing_mode_raw().assert_not_erased();
1864
1865 let (orig_values, canonical_goal) =
1866 canonicalize_goal(delegate, goal, &opaque_types, typing_mode.into());
1867
1868 let (canonical_result, final_revision, required_depth) =
1869 delegate.cx().evaluate_root_goal_for_proof_tree_raw(canonical_goal, root_depth);
1870
1871 let proof_tree = inspect::GoalEvaluation {
1872 uncanonicalized_goal: goal,
1873 orig_values,
1874 final_revision,
1875 result: canonical_result,
1876 required_depth,
1877 };
1878
1879 let response = match canonical_result {
1880 Err(e) => return (Err(e), proof_tree),
1881 Ok(response) => response,
1882 };
1883
1884 let (normalization_nested_goals, _certainty) = instantiate_and_apply_query_response(
1885 delegate,
1886 goal.param_env,
1887 &proof_tree.orig_values,
1888 response,
1889 origin_span,
1890 );
1891
1892 (Ok(normalization_nested_goals), proof_tree)
1893}