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::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, Const, InferCtxtLike, Interner, MayBeErased,
21 OpaqueTypeKey, PredicateKind, PredicateProxy, Region, RegionVid, TypeFoldable,
22 TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode, max_universe,
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::Projection => "Projection",
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) -> Self { *self }
}Clone)]
59enum CurrentGoalKind {
60 Misc,
61 CoinductiveTrait,
66 Projection,
68 ProjectionComputeAssocTermCandidate,
82}
83
84impl CurrentGoalKind {
85 fn from_query_input<I: Interner>(cx: I, input: QueryInput<I, I::Predicate>) -> CurrentGoalKind {
86 match input.goal.predicate.kind().skip_binder() {
87 ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
88 if cx.trait_is_coinductive(pred.trait_ref.def_id) {
89 CurrentGoalKind::CoinductiveTrait
90 } else {
91 CurrentGoalKind::Misc
92 }
93 }
94 ty::PredicateKind::Clause(ty::ClauseKind::Projection(_)) => CurrentGoalKind::Projection,
95 ty::PredicateKind::NormalizesTo(_) => {
96 CurrentGoalKind::ProjectionComputeAssocTermCandidate
97 }
98 _ => CurrentGoalKind::Misc,
99 }
100 }
101}
102
103pub struct EvalCtxt<'a, D, I = <D as SolverDelegate>::Interner>
104where
105 D: SolverDelegate<Interner = I>,
106 I: Interner,
107{
108 delegate: &'a D,
124
125 var_kinds: I::CanonicalVarKinds,
128
129 current_goal_kind: CurrentGoalKind,
132 pub(super) var_values: CanonicalVarValues<I>,
133
134 pub(super) max_input_universe: ty::UniverseIndex,
144 pub(super) initial_opaque_types_storage_num_entries:
147 <D::Infcx as InferCtxtLike>::OpaqueTypeStorageEntries,
148
149 pub(super) search_graph: &'a mut SearchGraph<D>,
150
151 nested_goals: Vec<(GoalSource, Goal<I, I::Predicate>, Option<GoalStalledOn<I>>)>,
152
153 pub(super) origin_span: I::Span,
154
155 tainted: Result<(), NoSolution>,
162
163 pub(super) opaque_accesses: AccessedOpaques<I>,
165
166 pub(super) inspect: inspect::EvaluationStepBuilder<D>,
167}
168
169#[derive(#[automatically_derived]
impl ::core::marker::StructuralPartialEq for GenerateProofTree { }
#[automatically_derived]
impl ::core::cmp::PartialEq for GenerateProofTree {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GenerateProofTree { }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) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
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) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for GenerateProofTree { }Copy)]
170#[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))]
171pub enum GenerateProofTree {
172 Yes,
173 No,
174}
175
176pub trait SolverDelegateEvalExt: SolverDelegate {
177 fn evaluate_root_goal(
182 &self,
183 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
184 span: <Self::Interner as Interner>::Span,
185 stalled_on: Option<GoalStalledOn<Self::Interner>>,
186 ) -> Result<GoalEvaluation<Self::Interner>, NoSolution>;
187
188 fn goal_remains_stalled(&self, stalled_on: &GoalStalledOn<Self::Interner>) -> bool;
191
192 fn root_goal_may_hold_opaque_types_jank(
197 &self,
198 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
199 ) -> bool;
200
201 fn root_goal_may_hold_with_depth(
209 &self,
210 root_depth: usize,
211 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
212 ) -> bool;
213
214 fn evaluate_root_goal_for_proof_tree(
217 &self,
218 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
219 span: <Self::Interner as Interner>::Span,
220 ) -> (
221 Result<NestedNormalizationGoals<Self::Interner>, NoSolution>,
222 inspect::GoalEvaluation<Self::Interner>,
223 );
224}
225
226impl<D, I> SolverDelegateEvalExt for D
227where
228 D: SolverDelegate<Interner = I>,
229 I: Interner,
230{
231 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(231u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:231",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(231u32),
::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)]
232 fn evaluate_root_goal(
233 &self,
234 goal: Goal<I, I::Predicate>,
235 span: I::Span,
236 stalled_on: Option<GoalStalledOn<I>>,
237 ) -> Result<GoalEvaluation<I>, NoSolution> {
238 if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
240 rerunning_stalled_goal_may_make_progress(self, stalled_on.as_ref())
241 {
242 return Ok(GoalEvaluation {
243 goal,
244 certainty: Certainty::Maybe(stalled_maybe_info),
245 has_changed: HasChanged::No,
246 stalled_on,
247 });
248 }
249
250 if stalled_on.is_some()
254 && let Some(res) = compute_goal_fast_path_cold(self, goal, span)
255 {
256 return Ok(res);
257 }
258
259 let mut result = EvalCtxt::enter_root(self, self.cx().recursion_limit(), span, |ecx| {
260 ecx.evaluate_goal_no_fast_paths(GoalSource::Misc, goal)
261 });
262 maybe_evaluate_root_goal_with_higher_recursion_limit(self, goal, span, &mut result);
263
264 match result {
265 Ok(i) => Ok(i),
266 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
267 Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
268 unreachable!("this never happens at the root, we're never in erased mode here");
269 }
270 }
271 }
272
273 #[inline(always)]
275 fn goal_remains_stalled(&self, stalled_on: &GoalStalledOn<Self::Interner>) -> bool {
276 match inlined_rerunning_stalled_goal_may_make_progress(self, Some(stalled_on)) {
277 RerunStalled::WontMakeProgress(_) => true,
278 RerunStalled::MayMakeProgress => false,
279 }
280 }
281
282 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(282u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:282",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(282u32),
::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)]
283 fn root_goal_may_hold_opaque_types_jank(
284 &self,
285 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
286 ) -> bool {
287 self.probe(|| {
288 self.evaluate_root_goal(goal, I::Span::dummy(), None).is_ok_and(|r| match r.certainty {
289 Certainty::Yes => true,
290 Certainty::Maybe(MaybeInfo {
291 cause: _,
292 opaque_types_jank,
293 stalled_on_coroutines: _,
294 }) => match opaque_types_jank {
295 OpaqueTypesJank::AllGood => true,
296 OpaqueTypesJank::ErrorIfRigidSelfTy => false,
297 },
298 })
299 })
300 }
301
302 fn root_goal_may_hold_with_depth(
303 &self,
304 root_depth: usize,
305 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
306 ) -> bool {
307 self.probe(|| {
308 EvalCtxt::enter_root(self, root_depth, I::Span::dummy(), |ecx| {
309 ecx.evaluate_goal(GoalSource::Misc, goal, None)
310 })
311 })
312 .is_ok()
313 }
314
315 {}
#[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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(315u32),
::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))]
316 fn evaluate_root_goal_for_proof_tree(
317 &self,
318 goal: Goal<I, I::Predicate>,
319 span: I::Span,
320 ) -> (Result<NestedNormalizationGoals<I>, NoSolution>, inspect::GoalEvaluation<I>) {
321 let mut result =
322 evaluate_root_goal_for_proof_tree(self, goal, span, self.cx().recursion_limit());
323 maybe_evaluate_root_goal_for_proof_tree_with_higher_recursion_limit(
324 self,
325 goal,
326 span,
327 &mut result,
328 );
329 result
330 }
331}
332
333fn maybe_evaluate_root_goal_with_higher_recursion_limit<D, I>(
339 delegate: &D,
340 goal: Goal<I, I::Predicate>,
341 span: I::Span,
342 initial_result: &mut Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased>,
343) where
344 D: SolverDelegate<Interner = I>,
345 I: Interner,
346{
347 if !delegate.enable_next_solver_overflow_fcw() {
348 return;
349 }
350
351 let predicate = match initial_result {
352 Err(_) => return,
353 Ok(goal_evaluation) if !goal_evaluation.certainty.is_overflow() => return,
354 Ok(goal_evaluation) => goal_evaluation.goal.predicate,
355 };
356
357 let rerun_result = delegate.commit_if_ok(|| {
358 let rerun_result =
359 EvalCtxt::enter_root(delegate, delegate.cx().recursion_limit() * 2, span, |ecx| {
360 ecx.evaluate_goal_no_fast_paths(GoalSource::Misc, goal)
361 });
362
363 if rerun_result.as_ref().is_ok_and(|evaluation| evaluation.certainty.is_overflow()) {
364 Err(())
365 } else {
366 Ok(rerun_result)
367 }
368 });
369 if let Ok(rerun_result) = rerun_result {
370 delegate.emit_next_solver_overflow_fcw(goal.with(delegate.cx(), predicate), span);
371 *initial_result = rerun_result;
372 }
373}
374
375fn maybe_evaluate_root_goal_for_proof_tree_with_higher_recursion_limit<D, I>(
381 delegate: &D,
382 goal: Goal<I, I::Predicate>,
383 span: I::Span,
384 initial_result: &mut (
385 Result<NestedNormalizationGoals<I>, NoSolution>,
386 inspect::GoalEvaluation<I>,
387 ),
388) where
389 D: SolverDelegate<Interner = I>,
390 I: Interner,
391{
392 if !delegate.enable_next_solver_overflow_fcw() {
393 return;
394 }
395
396 let goal_evaluation = &initial_result.1;
397 match goal_evaluation.result {
398 Err(_) => return,
399 Ok(response) if !response.value.certainty.is_overflow() => return,
400 Ok(_) => {}
401 }
402
403 let rerun_result = delegate.commit_if_ok(|| {
404 let (new_result, new_goal_evaluation) = evaluate_root_goal_for_proof_tree(
405 delegate,
406 goal,
407 span,
408 delegate.cx().recursion_limit() * 2,
409 );
410
411 if new_goal_evaluation.result.is_ok_and(|response| response.value.certainty.is_overflow()) {
412 Err(())
413 } else {
414 Ok((new_result, new_goal_evaluation))
415 }
416 });
417 if let Ok(rerun_result) = rerun_result {
418 let predicate: I::Predicate = goal_evaluation.uncanonicalized_goal.predicate;
419 delegate.emit_next_solver_overflow_fcw(goal.with(delegate.cx(), predicate), span);
420 *initial_result = rerun_result;
421 }
422}
423
424impl<'a, D, I> EvalCtxt<'a, D>
425where
426 D: SolverDelegate<Interner = I>,
427 I: Interner,
428{
429 pub(super) fn typing_mode(&self) -> TypingMode<I> {
430 self.delegate.typing_mode_raw()
431 }
432
433 pub(super) fn step_kind_to_nested(&self, _source: GoalSource) -> PathKind {
444 match self.current_goal_kind {
445 CurrentGoalKind::CoinductiveTrait => PathKind::Coinductive,
448 CurrentGoalKind::ProjectionComputeAssocTermCandidate | CurrentGoalKind::Projection => {
451 PathKind::Unknown
452 }
453 CurrentGoalKind::Misc => PathKind::ForcedAmbiguity,
457 }
458 }
459
460 pub(super) fn enter_root<R>(
464 delegate: &D,
465 root_depth: usize,
466 origin_span: I::Span,
467 f: impl FnOnce(&mut EvalCtxt<'_, D>) -> R,
468 ) -> R {
469 let mut search_graph = SearchGraph::new(root_depth);
470
471 let mut ecx = EvalCtxt {
472 delegate,
473 search_graph: &mut search_graph,
474 nested_goals: Default::default(),
475 inspect: inspect::EvaluationStepBuilder::new_noop(),
476
477 max_input_universe: ty::UniverseIndex::ROOT,
480 initial_opaque_types_storage_num_entries: Default::default(),
481 var_kinds: Default::default(),
482 var_values: CanonicalVarValues::dummy(),
483 current_goal_kind: CurrentGoalKind::Misc,
484 origin_span,
485 tainted: Ok(()),
486 opaque_accesses: AccessedOpaques::default(),
487 };
488 let result = f(&mut ecx);
489 if !ecx.nested_goals.is_empty() {
{
::core::panicking::panic_fmt(format_args!("root `EvalCtxt` should not have any goals added to it"));
}
};assert!(
490 ecx.nested_goals.is_empty(),
491 "root `EvalCtxt` should not have any goals added to it"
492 );
493 if !!ecx.opaque_accesses.might_rerun() {
::core::panicking::panic("assertion failed: !ecx.opaque_accesses.might_rerun()")
};assert!(!ecx.opaque_accesses.might_rerun());
494 if !search_graph.is_empty() {
::core::panicking::panic("assertion failed: search_graph.is_empty()")
};assert!(search_graph.is_empty());
495 result
496 }
497
498 pub(super) fn enter_canonical<T>(
506 cx: I,
507 search_graph: &'a mut SearchGraph<D>,
508 canonical_input: I::CanonicalInput,
509 proof_tree_builder: &mut inspect::ProofTreeBuilder<D>,
510 f: impl FnOnce(
511 &mut EvalCtxt<'_, D>,
512 Goal<I, I::Predicate>,
513 ) -> Result<T, NoSolutionOrRerunNonErased>,
514 ) -> (Result<T, NoSolution>, AccessedOpaques<I>) {
515 let (ref delegate, input, var_values) = D::build_with_canonical(cx, &canonical_input);
516 for (key, ty) in input.predefined_opaques_in_body.iter() {
517 let prev = delegate.register_hidden_type_in_storage(key, ty, I::Span::dummy());
518 if let Some(prev) = prev {
530 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:530",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(530u32),
::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`");
531 }
532 }
533
534 let initial_opaque_types_storage_num_entries = delegate.opaque_types_storage_num_entries();
535 if truecfg!(debug_assertions) && delegate.typing_mode_raw().is_erased_not_coherence() {
536 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());
537 }
538
539 let mut ecx = EvalCtxt {
540 delegate,
541 var_kinds: canonical_input.canonical.var_kinds,
542 var_values,
543 current_goal_kind: CurrentGoalKind::from_query_input(cx, input),
544 max_input_universe: canonical_input.canonical.max_universe,
545 initial_opaque_types_storage_num_entries,
546 search_graph,
547 nested_goals: Default::default(),
548 origin_span: I::Span::dummy(),
549 tainted: Ok(()),
550 inspect: proof_tree_builder.new_evaluation_step(var_values),
551 opaque_accesses: AccessedOpaques::default(),
552 };
553
554 let result = f(&mut ecx, input.goal);
555 ecx.inspect.probe_final_state(ecx.delegate, ecx.max_input_universe);
556 proof_tree_builder.finish_evaluation_step(ecx.inspect);
557
558 if canonical_input.typing_mode.0.is_erased_not_coherence() {
559 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());
560 }
561
562 delegate.reset_opaque_types();
568
569 let opaque_accesses = ecx.opaque_accesses;
570 (
571 match result {
572 Ok(i) => Ok(i),
573 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
574 Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
575 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());
577 Err(NoSolution)
578 }
579 },
580 opaque_accesses,
581 )
582 }
583
584 pub(super) fn ignore_candidate_head_usages(&mut self, usages: CandidateHeadUsages) {
585 self.search_graph.ignore_candidate_head_usages(usages);
586 }
587
588 fn evaluate_goal(
591 &mut self,
592 source: GoalSource,
593 goal: Goal<I, I::Predicate>,
594 stalled_on: Option<GoalStalledOn<I>>,
595 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
596 if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
597 rerunning_stalled_goal_may_make_progress(self.delegate, stalled_on.as_ref())
598 {
599 return Ok(GoalEvaluation {
600 goal,
601 certainty: Certainty::Maybe(stalled_maybe_info),
602 has_changed: HasChanged::No,
603 stalled_on,
604 });
605 }
606
607 if stalled_on.is_some()
611 && let Some(res) = compute_goal_fast_path_cold(self.delegate, goal, self.origin_span)
612 {
613 return Ok(res);
614 }
615
616 self.evaluate_goal_no_fast_paths(source, goal)
617 }
618
619 #[cold]
621 #[inline(never)]
622 fn evaluate_goal_no_fast_paths(
623 &mut self,
624 source: GoalSource,
625 goal: Goal<I, I::Predicate>,
626 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
627 let (normalization_nested_goals, goal_evaluation) = self.evaluate_goal_raw(source, goal)?;
628 if !normalization_nested_goals.is_empty() {
::core::panicking::panic("assertion failed: normalization_nested_goals.is_empty()")
};assert!(normalization_nested_goals.is_empty());
629 Ok(goal_evaluation)
630 }
631
632 fn evaluate_in_search_graph(
633 &mut self,
634 canonical_goal: I::CanonicalInput,
635 step_kind: PathKind,
636 ) -> (Result<CanonicalResponse<I>, NoSolution>, AccessedOpaques<I>) {
637 let increase_depth_for_nested =
638 match canonical_goal.canonical.value.goal.predicate.kind().skip_binder() {
639 ty::PredicateKind::NormalizesTo(_) => LowerAvailableDepth::No,
645 ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
654 if self.cx().trait_is_auto(pred.trait_ref.def_id) {
655 match pred.self_ty().kind() {
656 ty::CoroutineWitness(..) => LowerAvailableDepth::No,
657 ty::Alias(
658 ty::IsRigid::Yes,
659 ty::AliasTy { kind: ty::Opaque { def_id, .. }, .. },
660 ) => {
661 if self
669 .cx()
670 .item_self_bounds(def_id.into())
671 .skip_binder()
672 .into_iter()
673 .any(|bound| {
674 bound
675 .as_trait_clause()
676 .is_some_and(|b| b.def_id() == pred.def_id())
677 })
678 {
679 LowerAvailableDepth::Yes
680 } else {
681 LowerAvailableDepth::No
682 }
683 }
684 ty::Bool
685 | ty::Char
686 | ty::Int(..)
687 | ty::Uint(..)
688 | ty::Float(..)
689 | ty::Str
690 | ty::Pat(..)
691 | ty::FnPtr(..)
692 | ty::Array(..)
693 | ty::Slice(..)
694 | ty::RawPtr(..)
695 | ty::Never
696 | ty::Tuple(..)
697 | ty::UnsafeBinder(_)
698 | ty::Param(..)
699 | ty::Placeholder(..)
700 | ty::Bound(..)
701 | ty::Infer(..)
702 | ty::Alias(_, _)
703 | ty::Ref(_, _, _)
704 | ty::Adt(_, _)
705 | ty::Foreign(_)
706 | ty::Dynamic(..)
707 | ty::Error(_)
708 | ty::FnDef(..)
709 | ty::Closure(..)
710 | ty::CoroutineClosure(..)
711 | ty::Coroutine(..) => LowerAvailableDepth::Yes,
712 }
713 } else {
714 LowerAvailableDepth::Yes
715 }
716 }
717 ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(_))
718 | ty::PredicateKind::Clause(ty::ClauseKind::Projection(_))
719 | ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(_))
720 | ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(_))
721 | ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(_, _))
722 | ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(_))
723 | ty::PredicateKind::Subtype(_)
724 | ty::PredicateKind::Coerce(_)
725 | ty::PredicateKind::DynCompatible(_)
726 | ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_))
727 | ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(_))
728 | ty::PredicateKind::ConstEquate(_, _)
729 | ty::PredicateKind::Ambiguous => LowerAvailableDepth::Yes,
730 };
731 self.search_graph.evaluate_goal(
732 self.cx(),
733 canonical_goal,
734 step_kind,
735 increase_depth_for_nested,
736 &mut inspect::ProofTreeBuilder::new_noop(),
737 )
738 }
739
740 pub(super) fn evaluate_goal_raw(
748 &mut self,
749 source: GoalSource,
750 goal: Goal<I, I::Predicate>,
751 ) -> Result<(NestedNormalizationGoals<I>, GoalEvaluation<I>), NoSolutionOrRerunNonErased> {
752 let opaque_types = self.delegate.clone_opaque_types_lookup_table();
756
757 let (goal, opaque_types) =
758 self.delegate.deeply_resolve_via_unification_table((goal, opaque_types));
759 let typing_mode = self.typing_mode();
760 let step_kind = self.step_kind_to_nested(source);
761
762 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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(762u32),
::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!(
763 Level::DEBUG,
764 "evaluate_goal_raw in typing mode",
765 "{:?} opaques={:?}",
766 typing_mode,
767 opaque_types
768 )
769 .entered();
770
771 let (result, orig_values, canonical_goal, succeeded_in_erased) = 'retry_canonicalize: {
772 let skip_erased_attempt = match typing_mode {
773 TypingMode::Reflection | TypingMode::Coherence => true,
774 TypingMode::Typeck { .. }
775 | TypingMode::PostTypeckUntilBorrowck { .. }
776 | TypingMode::PostBorrowck { .. }
777 | TypingMode::Codegen
778 | TypingMode::PostAnalysis
779 | TypingMode::ErasedNotCoherence(_) => {
780 let mut skip = false;
781 if opaque_types.iter().any(|(_, ty)| ty.is_ty_var())
782 && let PredicateKind::Clause(ClauseKind::Trait(..)) =
783 goal.predicate.kind().skip_binder()
784 {
785 skip = true;
786 }
787
788 if let PredicateKind::Clause(ClauseKind::Trait(tr)) =
789 goal.predicate.kind().skip_binder()
790 && tr.self_ty().has_coroutines()
791 && self.cx().trait_is_auto(tr.trait_ref.def_id)
792 {
793 }
797
798 skip
799 }
800 };
801
802 if skip_erased_attempt {
803 if typing_mode.is_erased_not_coherence() {
804 match self.opaque_accesses.rerun_always(RerunReason::SkipErasedAttempt)? {}
805 } else {
806 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:806",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(806u32),
::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");
807 }
808 } else {
809 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:809",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(809u32),
::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:?}");
810
811 let (orig_values, canonical_goal) = canonicalize_goal(
812 self.delegate,
813 goal,
814 &[],
815 TypingMode::ErasedNotCoherence(MayBeErased),
816 );
817
818 let (canonical_result, accessed_opaques) =
819 self.evaluate_in_search_graph(canonical_goal, step_kind);
820
821 let should_rerun = should_rerun_after_erased_canonicalization(
822 accessed_opaques,
823 self.typing_mode(),
824 &opaque_types,
825 );
826 match should_rerun {
827 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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:827",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(827u32),
::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"),
828 RerunDecision::No => {
829 break 'retry_canonicalize (
830 canonical_result,
831 orig_values,
832 canonical_goal,
833 SucceededInErased::Yes { accessed_opaques },
834 );
835 }
836 RerunDecision::EagerlyPropagateToParent => {
837 self.opaque_accesses.update(accessed_opaques)?;
838 break 'retry_canonicalize (
839 canonical_result,
840 orig_values,
841 canonical_goal,
842 SucceededInErased::No,
845 );
846 }
847 }
848 }
849
850 let (orig_values, canonical_goal) =
851 canonicalize_goal(self.delegate, goal, &opaque_types, typing_mode);
852
853 let (canonical_result, accessed_opaques) =
854 self.evaluate_in_search_graph(canonical_goal, step_kind);
855 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!(
856 !accessed_opaques.might_rerun(),
857 "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:?}"
858 );
859
860 (canonical_result, orig_values, canonical_goal, SucceededInErased::No)
861 };
862
863 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:863",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(863u32),
::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);
864 let response = match result {
865 Ok(response) => {
866 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:866",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(866u32),
::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");
867 response
868 }
869 Err(NoSolution) => {
870 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:870",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(870u32),
::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");
871 return Err(NoSolution.into());
872 }
873 };
874
875 drop(tracing_span);
876
877 let has_changed =
878 if !has_only_region_constraints(response) { HasChanged::Yes } else { HasChanged::No };
879
880 let (normalization_nested_goals, certainty) = instantiate_and_apply_query_response(
881 self.delegate,
882 &orig_values,
883 response,
884 self.origin_span,
885 );
886
887 let stalled_on = match certainty {
898 Certainty::Yes => None,
899 Certainty::Maybe(maybe_info) => match has_changed {
900 HasChanged::Yes => None,
905 HasChanged::No => Some(self.build_stalled_on(
906 canonical_goal,
907 maybe_info,
908 orig_values,
909 succeeded_in_erased,
910 )),
911 },
912 };
913
914 Ok((
915 normalization_nested_goals,
916 GoalEvaluation { goal, certainty, has_changed, stalled_on },
917 ))
918 }
919
920 fn build_stalled_on(
921 &self,
922 canonical_goal: I::CanonicalInput,
923 maybe_info: MaybeInfo,
924 stalled_vars: ThinVec<I::GenericArg>,
925 previously_succeeded_in_erased: SucceededInErased<I>,
926 ) -> GoalStalledOn<I> {
927 let mut sub_roots = ThinVec::new();
929 let stalled_vars = stalled_vars
930 .into_iter()
931 .filter_map(|arg| match arg.kind() {
932 ty::GenericArgKind::Lifetime(_) => None,
934 ty::GenericArgKind::Type(ty) => match ty.kind() {
935 ty::Infer(ty::TyVar(vid)) => {
936 sub_roots.push(self.delegate.sub_unification_table_root_var(vid));
937 Some(TyOrConstInferVar::Ty(vid))
938 }
939 ty::Infer(ty::IntVar(vid)) => Some(TyOrConstInferVar::TyInt(vid)),
940 ty::Infer(ty::FloatVar(vid)) => Some(TyOrConstInferVar::TyFloat(vid)),
941 ty::Param(_) | ty::Placeholder(_) => None,
942 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ty)));
}unreachable!("unexpected orig_value: {ty:?}"),
943 },
944 ty::GenericArgKind::Const(ct) => match ct.kind() {
945 ty::ConstKind::Infer(ty::InferConst::Var(v)) => {
946 Some(TyOrConstInferVar::Const(v))
947 }
948 ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(_) => None,
949 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ct)));
}unreachable!("unexpected orig_value: {ct:?}"),
950 },
951 })
952 .collect();
953
954 GoalStalledOn {
955 stalled_vars,
956 sub_roots,
957 stalled_maybe_info: maybe_info,
958 opaques: GoalStalledOnOpaques::Yes {
959 num_opaques_in_storage: canonical_goal
960 .canonical
961 .value
962 .predefined_opaques_in_body
963 .len(),
964 previously_succeeded_in_erased,
965 },
966 }
967 }
968
969 pub(super) fn compute_goal(
970 &mut self,
971 goal: Goal<I, I::Predicate>,
972 ) -> QueryResultOrRerunNonErased<I> {
973 let Goal { param_env, predicate } = goal;
974 let kind = predicate.kind();
975 self.enter_forall_with_assumptions(kind, param_env, |ecx, kind| {
976 Ok(match kind {
977 ty::PredicateKind::Clause(ty::ClauseKind::Trait(predicate)) => {
978 ecx.compute_trait_goal(Goal { param_env, predicate }).map(|(r, _via)| r)?
979 }
980 ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(predicate)) => {
981 ecx.compute_host_effect_goal(Goal { param_env, predicate })?
982 }
983 ty::PredicateKind::Clause(ty::ClauseKind::Projection(predicate)) => {
984 ecx.compute_projection_goal(Goal { param_env, predicate })?
985 }
986 ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(predicate)) => {
987 ecx.compute_type_outlives_goal(Goal { param_env, predicate })?
988 }
989 ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(predicate)) => {
990 ecx.compute_region_outlives_goal(Goal { param_env, predicate })?
991 }
992 ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
993 ecx.compute_const_arg_has_type_goal(Goal { param_env, predicate: (ct, ty) })?
994 }
995 ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
996 ecx.compute_unstable_feature_goal(param_env, symbol)?
997 }
998 ty::PredicateKind::Subtype(predicate) => {
999 ecx.compute_subtype_goal(Goal { param_env, predicate })?
1000 }
1001 ty::PredicateKind::Coerce(predicate) => {
1002 ecx.compute_coerce_goal(Goal { param_env, predicate })?
1003 }
1004 ty::PredicateKind::DynCompatible(trait_def_id) => {
1005 ecx.compute_dyn_compatible_goal(trait_def_id)?
1006 }
1007 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(term)) => {
1008 ecx.compute_well_formed_goal(Goal { param_env, predicate: term })?
1009 }
1010 ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(ct)) => {
1011 ecx.compute_const_evaluatable_goal(Goal { param_env, predicate: ct })?
1012 }
1013 ty::PredicateKind::ConstEquate(_, _) => {
1014 {
::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")
1015 }
1016 ty::PredicateKind::NormalizesTo(predicate) => {
1017 ecx.compute_normalizes_to_goal(Goal { param_env, predicate })?
1018 }
1019 ty::PredicateKind::Ambiguous => {
1020 ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)?
1021 }
1022 })
1023 })
1024 }
1025
1026 {}
#[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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1028u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1043",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1043u32),
::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))]
1029 pub(super) fn try_evaluate_added_goals(
1030 &mut self,
1031 ) -> Result<Certainty, NoSolutionOrRerunNonErased> {
1032 for _ in 0..FIXPOINT_STEP_LIMIT {
1033 match self.evaluate_added_goals_step().map_err_to_rerun()? {
1034 Ok(None) => {}
1035 Ok(Some(cert)) => return Ok(cert),
1036 Err(NoSolution) => {
1037 self.tainted = Err(NoSolution);
1038 return Err(NoSolution.into());
1039 }
1040 }
1041 }
1042
1043 debug!("try_evaluate_added_goals: encountered overflow");
1044 Ok(Certainty::overflow(false))
1045 }
1046
1047 fn evaluate_added_goals_step(
1051 &mut self,
1052 ) -> Result<Option<Certainty>, NoSolutionOrRerunNonErased> {
1053 let mut unchanged_certainty = Some(Certainty::Yes);
1055 for (source, goal, stalled_on) in mem::take(&mut self.nested_goals) {
1059 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!(
1061 goal.predicate.kind().skip_binder(),
1062 PredicateKind::NormalizesTo(_)
1063 ));
1064
1065 let GoalEvaluation { goal, certainty, has_changed, stalled_on } =
1066 self.evaluate_goal(source, goal, stalled_on)?;
1067 if has_changed == HasChanged::Yes {
1068 unchanged_certainty = None;
1069 }
1070
1071 match certainty {
1072 Certainty::Yes => {}
1073 Certainty::Maybe { .. } => {
1074 self.nested_goals.push((source, goal, stalled_on));
1075 unchanged_certainty = unchanged_certainty.map(|c| c.and(certainty));
1076 }
1077 }
1078 }
1079
1080 Ok(unchanged_certainty)
1081 }
1082
1083 pub(crate) fn record_impl_args(&mut self, impl_args: I::GenericArgs) {
1085 self.inspect.record_impl_args(self.delegate, self.max_input_universe, impl_args)
1086 }
1087
1088 pub(super) fn cx(&self) -> I {
1089 self.delegate.cx()
1090 }
1091
1092 {}
#[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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1092u32),
::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(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))]
1093 pub(super) fn add_goal(
1094 &mut self,
1095 source: GoalSource,
1096 mut goal: Goal<I, I::Predicate>,
1097 ) -> Result<(), NoSolutionOrRerunNonErased> {
1098 goal.predicate =
1099 self.normalize(goal.param_env, ty::Unnormalized::new_wip(goal.predicate))?;
1100 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1101
1102 if let Some(GoalEvaluation { goal, certainty, has_changed: _, stalled_on }) =
1103 compute_goal_fast_path(self.delegate, goal, self.origin_span)
1104 {
1105 match certainty {
1106 Certainty::Yes => {}
1108 Certainty::Maybe(_) => {
1109 self.nested_goals.push((source, goal, stalled_on));
1110 }
1111 }
1112 } else {
1113 self.nested_goals.push((source, goal, None));
1114 }
1115 Ok(())
1116 }
1117
1118 {}
#[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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1118u32),
::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))]
1119 pub(super) fn add_goals(
1120 &mut self,
1121 source: GoalSource,
1122 goals: impl IntoIterator<Item = Goal<I, I::Predicate>>,
1123 ) -> Result<(), NoSolutionOrRerunNonErased> {
1124 for goal in goals {
1125 self.add_goal(source, goal)?;
1126 }
1127 Ok(())
1128 }
1129
1130 pub(super) fn next_region_var(&mut self) -> Region<I> {
1131 let region = self.delegate.next_region_infer();
1132 self.inspect.add_var_value(region);
1133 region
1134 }
1135
1136 pub(super) fn next_ty_infer(&mut self) -> I::Ty {
1137 let ty = self.delegate.next_ty_infer();
1138 self.inspect.add_var_value(ty);
1139 ty
1140 }
1141
1142 pub(super) fn next_const_infer(&mut self) -> Const<I> {
1143 let ct = self.delegate.next_const_infer();
1144 self.inspect.add_var_value(ct);
1145 ct
1146 }
1147
1148 pub(super) fn next_term_infer_of_alias_kind(
1151 &mut self,
1152 alias_term: ty::AliasTerm<I>,
1153 ) -> I::Term {
1154 match alias_term.kind {
1155 ty::AliasTermKind::ProjectionTy { .. }
1156 | ty::AliasTermKind::InherentTy { .. }
1157 | ty::AliasTermKind::OpaqueTy { .. }
1158 | ty::AliasTermKind::FreeTy { .. } => self.next_ty_infer().into(),
1159 ty::AliasTermKind::FreeConst { .. }
1160 | ty::AliasTermKind::InherentConstSelf { .. }
1161 | ty::AliasTermKind::InherentConstImpl { .. }
1162 | ty::AliasTermKind::AnonConst { .. }
1163 | ty::AliasTermKind::ProjectionConst { .. } => self.next_const_infer().into(),
1164 }
1165 }
1166
1167 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1171u32),
::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_const(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: Const<I>) -> 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_const(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<P: PredicateProxy<I>>(&mut self, p: P)
-> 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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1171",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1171u32),
::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)]
1172 pub(super) fn term_is_fully_unconstrained(&self, goal: Goal<I, ty::NormalizesTo<I>>) -> bool {
1173 let universe_of_term = match goal.predicate.term.kind() {
1174 ty::TermKind::Ty(ty) => {
1175 if let ty::Infer(ty::TyVar(vid)) = ty.kind() {
1176 self.delegate.universe_of_ty(vid).unwrap()
1177 } else {
1178 return false;
1179 }
1180 }
1181 ty::TermKind::Const(ct) => {
1182 if let ty::ConstKind::Infer(ty::InferConst::Var(vid)) = ct.kind() {
1183 self.delegate.universe_of_const(vid).unwrap()
1184 } else {
1185 return false;
1186 }
1187 }
1188 };
1189
1190 struct ContainsTermOrNotNameable<'a, D: SolverDelegate<Interner = I>, I: Interner> {
1191 term: I::Term,
1192 universe_of_term: ty::UniverseIndex,
1193 delegate: &'a D,
1194 cache: HashSet<I::Ty>,
1195 }
1196
1197 impl<D: SolverDelegate<Interner = I>, I: Interner> ContainsTermOrNotNameable<'_, D, I> {
1198 fn check_nameable(&self, universe: ty::UniverseIndex) -> ControlFlow<()> {
1199 if self.universe_of_term.can_name(universe) {
1200 ControlFlow::Continue(())
1201 } else {
1202 ControlFlow::Break(())
1203 }
1204 }
1205 }
1206
1207 impl<D: SolverDelegate<Interner = I>, I: Interner> TypeVisitor<I>
1208 for ContainsTermOrNotNameable<'_, D, I>
1209 {
1210 type Result = ControlFlow<()>;
1211 fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
1212 if self.cache.contains(&t) {
1213 return ControlFlow::Continue(());
1214 }
1215
1216 match t.kind() {
1217 ty::Infer(ty::TyVar(vid)) => {
1218 if let ty::TermKind::Ty(term) = self.term.kind()
1219 && let ty::Infer(ty::TyVar(term_vid)) = term.kind()
1220 && self.delegate.root_ty_var(vid) == self.delegate.root_ty_var(term_vid)
1221 {
1222 return ControlFlow::Break(());
1223 }
1224
1225 self.check_nameable(self.delegate.universe_of_ty(vid).unwrap())?;
1226 }
1227 ty::Placeholder(p) => self.check_nameable(p.universe())?,
1228 _ => {
1229 if t.has_non_region_infer() || t.has_placeholders() {
1230 t.super_visit_with(self)?
1231 }
1232 }
1233 }
1234
1235 assert!(self.cache.insert(t));
1236 ControlFlow::Continue(())
1237 }
1238
1239 fn visit_const(&mut self, c: Const<I>) -> Self::Result {
1240 match c.kind() {
1241 ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
1242 if let ty::TermKind::Const(term) = self.term.kind()
1243 && let ty::ConstKind::Infer(ty::InferConst::Var(term_vid)) = term.kind()
1244 && self.delegate.root_const_var(vid)
1245 == self.delegate.root_const_var(term_vid)
1246 {
1247 return ControlFlow::Break(());
1248 }
1249
1250 self.check_nameable(self.delegate.universe_of_const(vid).unwrap())
1251 }
1252 ty::ConstKind::Placeholder(p) => self.check_nameable(p.universe()),
1253 _ => {
1254 if c.has_non_region_infer() || c.has_placeholders() {
1255 c.super_visit_with(self)
1256 } else {
1257 ControlFlow::Continue(())
1258 }
1259 }
1260 }
1261 }
1262
1263 fn visit_predicate<P: PredicateProxy<I>>(&mut self, p: P) -> Self::Result {
1264 if p.has_non_region_infer() || p.has_placeholders() {
1265 p.super_visit_with(self)
1266 } else {
1267 ControlFlow::Continue(())
1268 }
1269 }
1270
1271 fn visit_clauses(&mut self, c: I::Clauses) -> Self::Result {
1272 if c.has_non_region_infer() || c.has_placeholders() {
1273 c.super_visit_with(self)
1274 } else {
1275 ControlFlow::Continue(())
1276 }
1277 }
1278 }
1279
1280 let mut visitor = ContainsTermOrNotNameable {
1281 delegate: self.delegate,
1282 universe_of_term,
1283 term: goal.predicate.term,
1284 cache: Default::default(),
1285 };
1286 goal.predicate.alias.visit_with(&mut visitor).is_continue()
1287 && goal.param_env.visit_with(&mut visitor).is_continue()
1288 }
1289
1290 pub(super) fn sub_unify_ty_vids_raw(&self, a: ty::TyVid, b: ty::TyVid) {
1291 self.delegate.sub_unify_ty_vids_raw(a, b)
1292 }
1293
1294 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1294u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1294",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1294u32),
::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)]
1295 pub(super) fn eq<T: Relate<I>>(
1296 &mut self,
1297 param_env: I::ParamEnv,
1298 lhs: T,
1299 rhs: T,
1300 ) -> Result<(), NoSolutionOrRerunNonErased> {
1301 self.relate(param_env, lhs, ty::Variance::Invariant, rhs)
1302 }
1303
1304 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1304u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1304",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1304u32),
::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)]
1305 pub(super) fn sub<T: Relate<I>>(
1306 &mut self,
1307 param_env: I::ParamEnv,
1308 sub: T,
1309 sup: T,
1310 ) -> Result<(), NoSolutionOrRerunNonErased> {
1311 self.relate(param_env, sub, ty::Variance::Covariant, sup)
1312 }
1313
1314 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1314u32),
::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::Clause(ty::ClauseKind::Projection(..)) =>
{
GoalSource::Normalization
}
ty::PredicateKind::Subtype { .. } => GoalSource::Misc,
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1314",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1314u32),
::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)]
1315 pub(super) fn relate<T: Relate<I>>(
1316 &mut self,
1317 param_env: I::ParamEnv,
1318 lhs: T,
1319 variance: ty::Variance,
1320 rhs: T,
1321 ) -> Result<(), NoSolutionOrRerunNonErased> {
1322 let goals = self.delegate.relate(param_env, lhs, variance, rhs, self.origin_span)?;
1323 for &goal in goals.iter() {
1324 let source = match goal.predicate.kind().skip_binder() {
1325 ty::PredicateKind::Clause(ty::ClauseKind::Projection(..)) => {
1326 GoalSource::Normalization
1327 }
1328 ty::PredicateKind::Subtype { .. } => GoalSource::Misc,
1331 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => GoalSource::Misc,
1333 p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
1334 };
1335 self.add_goal(source, goal)?;
1336 }
1337 Ok(())
1338 }
1339
1340 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1345u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1345",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1345u32),
::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)]
1346 pub(super) fn eq_and_get_goals<T: Relate<I>>(
1347 &self,
1348 param_env: I::ParamEnv,
1349 lhs: T,
1350 rhs: T,
1351 ) -> Result<Vec<Goal<I, I::Predicate>>, NoSolution> {
1352 Ok(self.delegate.relate(param_env, lhs, ty::Variance::Invariant, rhs, self.origin_span)?)
1353 }
1354
1355 pub(super) fn instantiate_binder_with_infer<T: TypeFoldable<I> + Copy>(
1356 &self,
1357 value: ty::Binder<I, T>,
1358 ) -> T {
1359 self.delegate.instantiate_binder_with_infer(value)
1360 }
1361
1362 pub(super) fn enter_forall_with_assumptions<T: TypeFoldable<I>, U>(
1370 &mut self,
1371 value: ty::Binder<I, T>,
1372 param_env: I::ParamEnv,
1373 f: impl FnOnce(&mut Self, T) -> U,
1374 ) -> U {
1375 self.delegate.enter_forall_without_assumptions(value, |value| {
1376 let u = self.delegate.universe();
1379 if self.cx().assumptions_on_binders()
1380 && let Some(assumptions) = self.region_assumptions_for_placeholders_in_universe(
1381 value.clone(),
1382 u,
1383 param_env,
1384 )
1385 {
1386 self.delegate.insert_placeholder_assumptions(u, assumptions);
1387 }
1388
1389 f(self, value)
1390 })
1391 }
1392
1393 pub(super) fn deeply_resolve_ignoring_regions<T>(&self, value: T) -> T
1394 where
1395 T: TypeFoldable<I>,
1396 {
1397 self.delegate.deeply_resolve_ignoring_regions(value)
1398 }
1399
1400 pub(super) fn shallow_resolve(&self, ty: I::Ty) -> I::Ty {
1401 self.delegate.shallow_resolve(ty)
1402 }
1403
1404 pub(super) fn eager_resolve_region(&self, r: Region<I>) -> Region<I> {
1405 if let ty::ReVar(vid) = r.kind() {
1406 self.delegate.shallow_resolve_region_var(vid)
1407 } else {
1408 r
1409 }
1410 }
1411
1412 pub(super) fn fresh_args_for_item(&mut self, def_id: I::DefId) -> I::GenericArgs {
1413 let args = self.delegate.fresh_args_for_item(def_id);
1414 for arg in args.iter() {
1415 self.inspect.add_var_value(arg);
1416 }
1417 args
1418 }
1419
1420 pub(super) fn register_solver_region_constraint(&self, c: RegionConstraint<I>) {
1421 self.delegate.register_solver_region_constraint(c, self.origin_span);
1422 }
1423
1424 pub(super) fn register_ty_outlives(&self, ty: I::Ty, lt: Region<I>) {
1425 self.delegate.register_ty_outlives(ty, lt, self.origin_span);
1426 }
1427
1428 pub(super) fn register_region_outlives(
1429 &self,
1430 a: Region<I>,
1431 b: Region<I>,
1432 vis: VisibleForLeakCheck,
1433 ) {
1434 self.delegate.sub_regions(b, a, vis, self.origin_span);
1436 }
1437
1438 pub(super) fn well_formed_goals(
1440 &self,
1441 param_env: I::ParamEnv,
1442 term: I::Term,
1443 ) -> Option<Vec<Goal<I, I::Predicate>>> {
1444 self.delegate.well_formed_goals(param_env, term)
1445 }
1446
1447 pub(super) fn trait_ref_is_knowable(
1448 &mut self,
1449 param_env: I::ParamEnv,
1450 trait_ref: ty::TraitRef<I>,
1451 ) -> Result<bool, NoSolutionOrRerunNonErased> {
1452 let delegate = self.delegate;
1453 let lazily_normalize_ty = |ty| self.structurally_normalize_ty(param_env, ty);
1454 coherence::trait_ref_is_knowable(&**delegate, trait_ref, lazily_normalize_ty)
1455 .map(|is_knowable| is_knowable.is_ok())
1456 }
1457
1458 pub(super) fn fetch_eligible_assoc_item(
1459 &self,
1460 goal_trait_ref: ty::TraitRef<I>,
1461 trait_assoc_def_id: I::TraitAssocTermId,
1462 impl_def_id: I::ImplId,
1463 ) -> FetchEligibleAssocItemResponse<I> {
1464 self.delegate.fetch_eligible_assoc_item(goal_trait_ref, trait_assoc_def_id, impl_def_id)
1465 }
1466
1467 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1467u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1467",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1467u32),
::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)]
1468 pub(super) fn register_hidden_type_in_storage(
1469 &mut self,
1470 opaque_type_key: ty::OpaqueTypeKey<I>,
1471 hidden_ty: I::Ty,
1472 ) -> Option<I::Ty> {
1473 self.delegate.register_hidden_type_in_storage(opaque_type_key, hidden_ty, self.origin_span)
1474 }
1475
1476 pub(super) fn add_item_bounds_for_hidden_type(
1477 &mut self,
1478 opaque_def_id: I::OpaqueTyId,
1479 opaque_args: I::GenericArgs,
1480 param_env: I::ParamEnv,
1481 hidden_ty: I::Ty,
1482 ) -> Result<(), NoSolutionOrRerunNonErased> {
1483 let mut goals = Vec::new();
1484 self.delegate.add_item_bounds_for_hidden_type(
1485 opaque_def_id,
1486 opaque_args,
1487 param_env,
1488 hidden_ty,
1489 &mut goals,
1490 );
1491 self.add_goals(GoalSource::AliasWellFormed, goals)?;
1492 Ok(())
1493 }
1494
1495 pub(super) fn evaluate_const(
1499 &mut self,
1500 param_env: I::ParamEnv,
1501 alias_const: ty::AliasConst<I>,
1502 ) -> Result<Option<Const<I>>, NoSolutionOrRerunNonErased> {
1503 if self.typing_mode().is_erased_not_coherence() {
1504 let resolved = self.deeply_resolve_ignoring_regions(alias_const);
1505 let is_gce = self.cx().features().generic_const_exprs();
1507 if resolved.has_opaque_types() || is_gce {
1508 match self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)? {}
1509 }
1510 }
1511
1512 self.delegate.evaluate_const(param_env, alias_const, |ty| self.normalize(param_env, ty))
1513 }
1514
1515 pub(super) fn evaluate_const_and_instantiate_projection_term(
1516 &mut self,
1517 param_env: I::ParamEnv,
1518 projection_term: ty::AliasTerm<I>,
1519 expected_term: I::Term,
1520 alias_const: ty::AliasConst<I>,
1521 ) -> QueryResultOrRerunNonErased<I> {
1522 match self.evaluate_const(param_env, alias_const)? {
1523 Some(evaluated) => {
1524 self.eq(param_env, expected_term, evaluated.into())?;
1525 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1526 }
1527 None if self.cx().features().gca_const_items() => {
1528 if self.deeply_resolve_ignoring_regions(alias_const).has_non_region_infer() {
1536 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1537 } else {
1538 self.eq(
1548 param_env,
1549 projection_term.to_term(self.cx(), ty::IsRigid::Yes),
1550 expected_term,
1551 )?;
1552 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1553 }
1554 }
1555 None => {
1556 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1558 }
1559 }
1560 }
1561
1562 pub(super) fn is_transmutable(
1563 &mut self,
1564 src: I::Ty,
1565 dst: I::Ty,
1566 assume: Const<I>,
1567 ) -> Result<Certainty, NoSolution> {
1568 self.delegate.is_transmutable(dst, src, assume)
1569 }
1570
1571 pub(super) fn replace_bound_vars<T: TypeFoldable<I>>(
1572 &self,
1573 t: T,
1574 universes: &mut Vec<Option<ty::UniverseIndex>>,
1575 ) -> T {
1576 BoundVarReplacer::replace_bound_vars(&**self.delegate, universes, t).0
1577 }
1578
1579 pub(super) fn may_use_unstable_feature(
1580 &mut self,
1581 param_env: I::ParamEnv,
1582 symbol: I::Symbol,
1583 ) -> Result<bool, RerunNonErased> {
1584 if self.typing_mode().is_erased_not_coherence() {
1585 match self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)? {}
1586 }
1587
1588 Ok(may_use_unstable_feature(&**self.delegate, param_env, symbol))
1589 }
1590
1591 pub(crate) fn opaques_with_sub_unified_hidden_type(
1592 &self,
1593 self_ty: I::Ty,
1594 ) -> Vec<ty::OpaqueAliasTy<I>> {
1595 if let ty::Infer(ty::TyVar(vid)) = self_ty.kind() {
1596 self.delegate.opaques_with_sub_unified_hidden_type(vid)
1597 } else {
1598 ::alloc::vec::Vec::new()vec![]
1599 }
1600 }
1601
1602 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1615u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1639",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1639u32),
::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) =
self.delegate.deeply_resolve_via_unification_table((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));
}
filter_irrelevant_region_constraints(self.delegate,
&var_values, &mut external_constraints);
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1615",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1615u32),
::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)]
1616 pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
1617 &mut self,
1618 shallow_certainty: Certainty,
1619 ) -> QueryResultOrRerunNonErased<I> {
1620 self.inspect.make_canonical_response(shallow_certainty);
1621
1622 let goals_certainty = self.try_evaluate_added_goals()?;
1623 assert_eq!(
1624 self.tainted,
1625 Ok(()),
1626 "EvalCtxt is tainted -- nested goals may have been dropped in a \
1627 previous call to `try_evaluate_added_goals!`"
1628 );
1629
1630 let goals_certainty = match self.delegate.cx().assumptions_on_binders() {
1631 true => {
1632 let certainty = self.eagerly_handle_placeholders()?;
1633 certainty.and(goals_certainty)
1634 }
1635 false => {
1636 self.delegate.leak_check(self.max_input_universe).map_err(|NoSolution| {
1639 trace!("failed the leak check");
1640 NoSolution
1641 })?;
1642
1643 goals_certainty
1644 }
1645 };
1646
1647 let (certainty, normalization_nested_goals) =
1648 match (self.current_goal_kind, shallow_certainty) {
1649 (CurrentGoalKind::ProjectionComputeAssocTermCandidate, Certainty::Yes) => {
1657 let goals = std::mem::take(&mut self.nested_goals);
1658 if goals.is_empty() {
1661 assert!(matches!(goals_certainty, Certainty::Yes));
1662 }
1663 (
1664 Certainty::Yes,
1665 NestedNormalizationGoals(
1666 goals.into_iter().map(|(s, g, _)| (s, g)).collect(),
1667 ),
1668 )
1669 }
1670 _ => {
1671 let certainty = shallow_certainty.and(goals_certainty);
1672 (certainty, NestedNormalizationGoals::empty())
1673 }
1674 };
1675
1676 if let Certainty::Maybe(
1677 maybe_info @ MaybeInfo {
1678 cause: MaybeCause::Overflow { keep_constraints: false, .. },
1679 opaque_types_jank: _,
1680 stalled_on_coroutines: _,
1681 },
1682 ) = certainty
1683 {
1684 return Ok(self.make_ambiguous_response_no_constraints(maybe_info));
1696 }
1697
1698 let external_constraints =
1699 self.compute_external_query_constraints(certainty, normalization_nested_goals);
1700 let (var_values, mut external_constraints) = self
1701 .delegate
1702 .deeply_resolve_via_unification_table((self.var_values, external_constraints));
1703
1704 let mut unique = HashSet::default();
1706 if let ExternalRegionConstraints::Old(r) = &mut external_constraints.region_constraints {
1707 r.retain(|(outlives, _)| !outlives.is_trivial() && unique.insert(*outlives));
1708 }
1709
1710 filter_irrelevant_region_constraints(self.delegate, &var_values, &mut external_constraints);
1711
1712 let canonical = canonicalize_response(
1713 self.delegate,
1714 self.max_input_universe,
1715 Response {
1716 var_values,
1717 certainty,
1718 external_constraints: self.cx().mk_external_constraints(external_constraints),
1719 },
1720 );
1721
1722 Ok(canonical)
1723 }
1724
1725 pub(in crate::solve) fn make_ambiguous_response_no_constraints(
1730 &self,
1731 maybe: MaybeInfo,
1732 ) -> CanonicalResponse<I> {
1733 response_no_constraints_raw(
1734 self.cx(),
1735 self.max_input_universe,
1736 self.var_kinds,
1737 Certainty::Maybe(maybe),
1738 )
1739 }
1740
1741 {}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1748u32),
::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();
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1748",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1748u32),
::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)]
1749 fn compute_external_query_constraints(
1750 &self,
1751 certainty: Certainty,
1752 normalization_nested_goals: NestedNormalizationGoals<I>,
1753 ) -> ExternalConstraintsData<I> {
1754 let region_constraints = if self.cx().assumptions_on_binders() {
1763 ExternalRegionConstraints::NextGen(if let Certainty::Yes = certainty {
1764 let constraint = self.delegate.get_solver_region_constraint();
1765 constraint
1766 } else {
1767 RegionConstraint::new_true()
1768 })
1769 } else {
1770 ExternalRegionConstraints::Old(if let Certainty::Yes = certainty {
1771 self.delegate.make_deduplicated_region_constraints()
1772 } else {
1773 vec![]
1774 })
1775 };
1776
1777 let opaque_types = self
1782 .delegate
1783 .clone_opaque_types_added_since(self.initial_opaque_types_storage_num_entries);
1784
1785 if self.typing_mode().is_erased_not_coherence() {
1786 assert!(opaque_types.is_empty());
1787 }
1788
1789 ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals }
1790 }
1791
1792 pub(super) fn normalize<T: TypeFoldable<I>>(
1793 &mut self,
1794 param_env: I::ParamEnv,
1795 value: ty::Unnormalized<I, T>,
1796 ) -> Result<T, NoSolutionOrRerunNonErased> {
1797 let value = self.delegate.deeply_resolve_ignoring_regions(value.skip_normalization());
1798
1799 if !self.cx().renormalize_rigid_aliases() && !value.has_non_rigid_aliases() {
1800 return Ok(value);
1801 }
1802
1803 let infcx = self.delegate.deref();
1805 let mut folder = NormalizationFolder::new(infcx, ::alloc::vec::Vec::new()vec![], |alias_term| {
1806 let infer_term = self.next_term_infer_of_alias_kind(alias_term);
1807 let pred = ty::ProjectionClause { projection_term: alias_term, term: infer_term };
1808 let goal = Goal::new(self.cx(), param_env, pred);
1809 let source = GoalSource::Normalization;
1810 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1811 let GoalEvaluation { goal, certainty, has_changed: _, stalled_on } =
1812 self.evaluate_goal(source, goal, None)?;
1813 let normalization_was_ambiguous = match certainty {
1814 Certainty::Yes => NormalizationWasAmbiguous::No,
1815 Certainty::Maybe(_) => {
1816 self.nested_goals.push((source, goal, stalled_on));
1817 NormalizationWasAmbiguous::Yes
1818 }
1819 };
1820
1821 Ok((self.deeply_resolve_ignoring_regions(infer_term), normalization_was_ambiguous))
1822 });
1823 value.try_fold_with(&mut folder)
1824 }
1825}
1826
1827fn filter_irrelevant_region_constraints<D, I>(
1828 delegate: &D,
1829 var_values: &CanonicalVarValues<I>,
1830 external_constraints: &mut ExternalConstraintsData<I>,
1831) where
1832 D: SolverDelegate<Interner = I>,
1833 I: Interner,
1834{
1835 #[derive(#[automatically_derived]
impl ::core::default::Default for NonTrivialVars {
#[inline]
fn default() -> Self {
Self { vars: ::core::default::Default::default() }
}
}Default)]
1836 struct NonTrivialVars {
1837 vars: HashSet<RegionVid>,
1838 }
1839 impl<I> TypeVisitor<I> for NonTrivialVars
1840 where
1841 I: Interner,
1842 {
1843 type Result = ();
1844 fn visit_ty(&mut self, t: I::Ty) {
1845 if !t.has_infer_regions() {
1848 return;
1849 }
1850 t.super_visit_with(self);
1851 }
1852 fn visit_const(&mut self, c: Const<I>) {
1853 if !c.has_infer_regions() {
1855 return;
1856 }
1857 c.super_visit_with(self);
1858 }
1859 fn visit_region(&mut self, r: Region<I>) {
1860 if let ty::ReVar(vid) = r.kind() {
1861 self.vars.insert(vid);
1862 }
1863 }
1864 }
1865
1866 let ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals } =
1867 external_constraints;
1868
1869 if let ExternalRegionConstraints::Old(r) = region_constraints
1874 && !r.is_empty()
1875 {
1876 let mut vis = NonTrivialVars::default();
1877 var_values.visit_with(&mut vis);
1878 opaque_types.visit_with(&mut vis);
1882 normalization_nested_goals.visit_with(&mut vis);
1883 for (constraint, _) in r.iter() {
1884 match constraint {
1885 ty::RegionConstraint::Outlives(ty::OutlivesClause(sup, _)) => {
1886 sup.visit_with(&mut vis)
1887 }
1888 ty::RegionConstraint::Eq(eq) => eq.visit_with(&mut vis),
1889 }
1890 }
1891
1892 r.retain(|(outlives, _)| {
1893 if let ty::RegionConstraint::Outlives(ty::OutlivesClause(sup, re)) = *outlives
1894 && let Some(sup_re) = sup.as_region()
1895 && let ty::RegionKind::ReVar(vid) = re.kind()
1896 && delegate.universe_of_region(vid).unwrap()
1899 .can_name(max_universe(&**delegate, sup_re))
1900 {
1901 vis.vars.contains(&vid)
1902 } else {
1903 true
1904 }
1905 });
1906 }
1907}
1908
1909#[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)]
1910enum RerunDecision {
1911 Yes,
1912 No,
1913 EagerlyPropagateToParent,
1914}
1915
1916{}
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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1916u32),
::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/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1916",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::INFO,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1916u32),
::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)]
1917fn should_rerun_after_erased_canonicalization<I: Interner>(
1918 AccessedOpaques { reason: _, rerun }: AccessedOpaques<I>,
1919 original_typing_mode: TypingMode<I>,
1920 parent_opaque_types: &[(OpaqueTypeKey<I>, I::Ty)],
1921) -> RerunDecision {
1922 let parent_opaque_def_ids = parent_opaque_types.iter().map(|(key, _)| key.def_id.into());
1923 let opaque_in_storage = |opaques: I::LocalDefIds, def_ids: SmallCopySet<_>| {
1924 if def_ids.as_ref().is_empty() {
1925 RerunDecision::No
1926 } else if opaques
1927 .iter()
1928 .chain(parent_opaque_def_ids)
1929 .any(|opaque| def_ids.as_ref().contains(&opaque))
1930 {
1931 RerunDecision::Yes
1932 } else {
1933 RerunDecision::No
1934 }
1935 };
1936 let any_opaque_has_infer_as_hidden = || {
1937 if parent_opaque_types.iter().any(|(_, ty)| ty.is_ty_var()) {
1938 RerunDecision::Yes
1939 } else {
1940 RerunDecision::No
1941 }
1942 };
1943
1944 match (rerun, original_typing_mode) {
1945 (RerunCondition::Never, _) => RerunDecision::No,
1947 (_, TypingMode::ErasedNotCoherence(MayBeErased)) => RerunDecision::EagerlyPropagateToParent,
1949 (_, TypingMode::Coherence) => unreachable!(),
1953 (RerunCondition::Always, _) => RerunDecision::Yes,
1955 (
1957 RerunCondition::OpaqueInStorage(..),
1958 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
1959 ) => RerunDecision::Yes,
1960 (
1961 RerunCondition::OpaqueInStorage(defids),
1962 TypingMode::PostBorrowck { defined_opaque_types: opaques }
1963 | TypingMode::Typeck { defining_opaque_types_and_generators: opaques }
1964 | TypingMode::PostTypeckUntilBorrowck { defining_opaque_types: opaques },
1965 ) => opaque_in_storage(opaques, defids),
1966 (RerunCondition::AnyOpaqueHasInferAsHidden, TypingMode::Typeck { .. }) => {
1968 any_opaque_has_infer_as_hidden()
1969 }
1970 (
1971 RerunCondition::AnyOpaqueHasInferAsHidden,
1972 TypingMode::PostBorrowck { .. }
1973 | TypingMode::PostAnalysis
1974 | TypingMode::Codegen
1975 | TypingMode::Reflection
1976 | TypingMode::PostTypeckUntilBorrowck { .. },
1977 ) => RerunDecision::No,
1978 (
1980 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_),
1981 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
1982 ) => RerunDecision::Yes,
1983 (
1984 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
1985 TypingMode::Typeck { defining_opaque_types_and_generators: opaques },
1986 ) => {
1987 if let RerunDecision::Yes = any_opaque_has_infer_as_hidden() {
1988 RerunDecision::Yes
1989 } else if let RerunDecision::Yes = opaque_in_storage(opaques, defids) {
1990 RerunDecision::Yes
1991 } else {
1992 RerunDecision::No
1993 }
1994 }
1995 (
1996 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
1997 TypingMode::PostBorrowck { defined_opaque_types: opaques }
1998 | TypingMode::PostTypeckUntilBorrowck { defining_opaque_types: opaques },
1999 ) => opaque_in_storage(opaques, defids),
2000 }
2001}
2002
2003pub fn evaluate_root_goal_for_proof_tree_raw_provider<
2005 D: SolverDelegate<Interner = I>,
2006 I: Interner,
2007>(
2008 cx: I,
2009 canonical_goal: I::CanonicalInput,
2010 root_depth: usize,
2011) -> (QueryResult<I>, I::Probe, RequiredDepth) {
2012 let mut inspect = inspect::ProofTreeBuilder::new();
2013 let ((canonical_result, accessed_opaques), required_depth) =
2014 SearchGraph::<D>::evaluate_root_goal_for_proof_tree(
2015 cx,
2016 root_depth,
2017 canonical_goal,
2018 &mut inspect,
2019 );
2020 let final_revision = inspect.unwrap();
2021
2022 if !!accessed_opaques.might_rerun() {
::core::panicking::panic("assertion failed: !accessed_opaques.might_rerun()")
};assert!(!accessed_opaques.might_rerun());
2023 (canonical_result, cx.mk_probe(final_revision), required_depth)
2024}
2025
2026pub(super) fn evaluate_root_goal_for_proof_tree<D: SolverDelegate<Interner = I>, I: Interner>(
2031 delegate: &D,
2032 goal: Goal<I, I::Predicate>,
2033 origin_span: I::Span,
2034 root_depth: usize,
2035) -> (Result<NestedNormalizationGoals<I>, NoSolution>, inspect::GoalEvaluation<I>) {
2036 let opaque_types = delegate.clone_opaque_types_lookup_table();
2037 let (goal, opaque_types) = delegate.deeply_resolve_via_unification_table((goal, opaque_types));
2038 let typing_mode = delegate.typing_mode_raw().assert_not_erased();
2039
2040 let (orig_values, canonical_goal) =
2041 canonicalize_goal(delegate, goal, &opaque_types, typing_mode.into());
2042
2043 let (canonical_result, final_revision, required_depth) =
2044 delegate.cx().evaluate_root_goal_for_proof_tree_raw(canonical_goal, root_depth);
2045
2046 let proof_tree = inspect::GoalEvaluation {
2047 uncanonicalized_goal: goal,
2048 orig_values,
2049 final_revision,
2050 result: canonical_result,
2051 required_depth,
2052 };
2053
2054 let response = match canonical_result {
2055 Err(e) => return (Err(e), proof_tree),
2056 Ok(response) => response,
2057 };
2058
2059 let (normalization_nested_goals, _certainty) = instantiate_and_apply_query_response(
2060 delegate,
2061 &proof_tree.orig_values,
2062 response,
2063 origin_span,
2064 );
2065
2066 (Ok(normalization_nested_goals), proof_tree)
2067}