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