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