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, Const, InferCtxtLike, Interner, MayBeErased,
21 OpaqueTypeKey, PredicateKind, PredicateProxy, Region, RegionVid, TypeFoldable,
22 TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode, max_universe,
23};
24use thin_vec::ThinVec;
25use tracing::{Level, debug, instrument, trace, warn};
26
27use super::has_only_region_constraints;
28use crate::canonical::{
29 canonicalize_goal, canonicalize_response, instantiate_and_apply_query_response,
30 response_no_constraints_raw,
31};
32use crate::coherence;
33use crate::delegate::SolverDelegate;
34use crate::normalize::{NormalizationFolder, NormalizationWasAmbiguous};
35use crate::placeholder::BoundVarReplacer;
36use crate::solve::eval_ctxt::fast_path::{
37 RerunStalled, compute_goal_fast_path, inlined_rerunning_stalled_goal_may_make_progress,
38 rerunning_stalled_goal_may_make_progress,
39};
40use crate::solve::fast_path::compute_goal_fast_path_cold;
41use crate::solve::search_graph::SearchGraph;
42use crate::solve::ty::may_use_unstable_feature;
43use crate::solve::{
44 CanonicalResponse, Certainty, ExternalConstraintsData, FIXPOINT_STEP_LIMIT, Goal,
45 GoalEvaluation, GoalSource, GoalStalledOn, GoalStalledOnOpaques, HasChanged, MaybeCause,
46 NestedNormalizationGoals, NoSolution, QueryInput, QueryResult, Response, SucceededInErased,
47 VisibleForLeakCheck, inspect,
48};
49
50pub mod fast_path;
51mod probe;
52mod solver_region_constraints;
53
54#[derive(#[automatically_derived]
impl ::core::fmt::Debug for CurrentGoalKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
CurrentGoalKind::Misc => "Misc",
CurrentGoalKind::CoinductiveTrait => "CoinductiveTrait",
CurrentGoalKind::ProjectionComputeAssocTermCandidate =>
"ProjectionComputeAssocTermCandidate",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for CurrentGoalKind { }Copy, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for CurrentGoalKind { }
#[automatically_derived]
impl ::core::clone::Clone for CurrentGoalKind {
#[inline]
fn clone(&self) -> Self { *self }
}Clone)]
59enum CurrentGoalKind {
60 Misc,
61 CoinductiveTrait,
66 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: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GenerateProofTree { }Eq, #[automatically_derived]
impl ::core::fmt::Debug for GenerateProofTree {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
GenerateProofTree::Yes => "Yes",
GenerateProofTree::No => "No",
})
}
}Debug, #[automatically_derived]
impl ::core::hash::Hash for GenerateProofTree {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
state)
}
}Hash, #[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for GenerateProofTree { }
#[automatically_derived]
impl ::core::clone::Clone for GenerateProofTree {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for GenerateProofTree { }Copy)]
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/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::Unknown,
467 GoalSource::AliasBoundConstCondition | GoalSource::AliasWellFormed => PathKind::Unknown,
471 }
472 }
473
474 pub(super) fn enter_root<R>(
478 delegate: &D,
479 root_depth: usize,
480 origin_span: I::Span,
481 f: impl FnOnce(&mut EvalCtxt<'_, D>) -> R,
482 ) -> R {
483 let mut search_graph = SearchGraph::new(root_depth);
484
485 let mut ecx = EvalCtxt {
486 delegate,
487 search_graph: &mut search_graph,
488 nested_goals: Default::default(),
489 inspect: inspect::EvaluationStepBuilder::new_noop(),
490
491 max_input_universe: ty::UniverseIndex::ROOT,
494 initial_opaque_types_storage_num_entries: Default::default(),
495 var_kinds: Default::default(),
496 var_values: CanonicalVarValues::dummy(),
497 current_goal_kind: CurrentGoalKind::Misc,
498 origin_span,
499 tainted: Ok(()),
500 opaque_accesses: AccessedOpaques::default(),
501 };
502 let result = f(&mut ecx);
503 if !ecx.nested_goals.is_empty() {
{
::core::panicking::panic_fmt(format_args!("root `EvalCtxt` should not have any goals added to it"));
}
};assert!(
504 ecx.nested_goals.is_empty(),
505 "root `EvalCtxt` should not have any goals added to it"
506 );
507 if !!ecx.opaque_accesses.might_rerun() {
::core::panicking::panic("assertion failed: !ecx.opaque_accesses.might_rerun()")
};assert!(!ecx.opaque_accesses.might_rerun());
508 if !search_graph.is_empty() {
::core::panicking::panic("assertion failed: search_graph.is_empty()")
};assert!(search_graph.is_empty());
509 result
510 }
511
512 pub(super) fn enter_canonical<T>(
520 cx: I,
521 search_graph: &'a mut SearchGraph<D>,
522 canonical_input: I::CanonicalInput,
523 proof_tree_builder: &mut inspect::ProofTreeBuilder<D>,
524 f: impl FnOnce(
525 &mut EvalCtxt<'_, D>,
526 Goal<I, I::Predicate>,
527 ) -> Result<T, NoSolutionOrRerunNonErased>,
528 ) -> (Result<T, NoSolution>, AccessedOpaques<I>) {
529 let (ref delegate, input, var_values) = D::build_with_canonical(cx, &canonical_input);
530 for (key, ty) in input.predefined_opaques_in_body.iter() {
531 let prev = delegate.register_hidden_type_in_storage(key, ty, I::Span::dummy());
532 if let Some(prev) = prev {
544 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:544",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(544u32),
::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`");
545 }
546 }
547
548 let initial_opaque_types_storage_num_entries = delegate.opaque_types_storage_num_entries();
549 if truecfg!(debug_assertions) && delegate.typing_mode_raw().is_erased_not_coherence() {
550 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());
551 }
552
553 let mut ecx = EvalCtxt {
554 delegate,
555 var_kinds: canonical_input.canonical.var_kinds,
556 var_values,
557 current_goal_kind: CurrentGoalKind::from_query_input(cx, input),
558 max_input_universe: canonical_input.canonical.max_universe,
559 initial_opaque_types_storage_num_entries,
560 search_graph,
561 nested_goals: Default::default(),
562 origin_span: I::Span::dummy(),
563 tainted: Ok(()),
564 inspect: proof_tree_builder.new_evaluation_step(var_values),
565 opaque_accesses: AccessedOpaques::default(),
566 };
567
568 let result = f(&mut ecx, input.goal);
569 ecx.inspect.probe_final_state(ecx.delegate, ecx.max_input_universe);
570 proof_tree_builder.finish_evaluation_step(ecx.inspect);
571
572 if canonical_input.typing_mode.0.is_erased_not_coherence() {
573 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());
574 }
575
576 delegate.reset_opaque_types();
582
583 let opaque_accesses = ecx.opaque_accesses;
584 (
585 match result {
586 Ok(i) => Ok(i),
587 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
588 Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
589 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());
591 Err(NoSolution)
592 }
593 },
594 opaque_accesses,
595 )
596 }
597
598 pub(super) fn ignore_candidate_head_usages(&mut self, usages: CandidateHeadUsages) {
599 self.search_graph.ignore_candidate_head_usages(usages);
600 }
601
602 fn evaluate_goal(
605 &mut self,
606 source: GoalSource,
607 goal: Goal<I, I::Predicate>,
608 stalled_on: Option<GoalStalledOn<I>>,
609 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
610 if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
611 rerunning_stalled_goal_may_make_progress(self.delegate, stalled_on.as_ref())
612 {
613 return Ok(GoalEvaluation {
614 goal,
615 certainty: Certainty::Maybe(stalled_maybe_info),
616 has_changed: HasChanged::No,
617 stalled_on,
618 });
619 }
620
621 if stalled_on.is_some()
625 && let Some(res) = compute_goal_fast_path_cold(self.delegate, goal, self.origin_span)
626 {
627 return Ok(res);
628 }
629
630 self.evaluate_goal_no_fast_paths(source, goal)
631 }
632
633 #[cold]
635 #[inline(never)]
636 fn evaluate_goal_no_fast_paths(
637 &mut self,
638 source: GoalSource,
639 goal: Goal<I, I::Predicate>,
640 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
641 let (normalization_nested_goals, goal_evaluation) = self.evaluate_goal_raw(source, goal)?;
642 if !normalization_nested_goals.is_empty() {
::core::panicking::panic("assertion failed: normalization_nested_goals.is_empty()")
};assert!(normalization_nested_goals.is_empty());
643 Ok(goal_evaluation)
644 }
645
646 fn evaluate_in_search_graph(
647 &mut self,
648 canonical_goal: I::CanonicalInput,
649 step_kind: PathKind,
650 ) -> (Result<CanonicalResponse<I>, NoSolution>, AccessedOpaques<I>) {
651 let increase_depth_for_nested =
652 match canonical_goal.canonical.value.goal.predicate.kind().skip_binder() {
653 ty::PredicateKind::NormalizesTo(_) => LowerAvailableDepth::No,
659 ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
668 if self.cx().trait_is_auto(pred.trait_ref.def_id) {
669 match pred.self_ty().kind() {
670 ty::CoroutineWitness(..) => LowerAvailableDepth::No,
671 ty::Alias(
672 ty::IsRigid::Yes,
673 ty::AliasTy { kind: ty::Opaque { def_id, .. }, .. },
674 ) => {
675 if self
683 .cx()
684 .item_self_bounds(def_id.into())
685 .skip_binder()
686 .into_iter()
687 .any(|bound| {
688 bound
689 .as_trait_clause()
690 .is_some_and(|b| b.def_id() == pred.def_id())
691 })
692 {
693 LowerAvailableDepth::Yes
694 } else {
695 LowerAvailableDepth::No
696 }
697 }
698 ty::Bool
699 | ty::Char
700 | ty::Int(..)
701 | ty::Uint(..)
702 | ty::Float(..)
703 | ty::Str
704 | ty::Pat(..)
705 | ty::FnPtr(..)
706 | ty::Array(..)
707 | ty::Slice(..)
708 | ty::RawPtr(..)
709 | ty::Never
710 | ty::Tuple(..)
711 | ty::UnsafeBinder(_)
712 | ty::Param(..)
713 | ty::Placeholder(..)
714 | ty::Bound(..)
715 | ty::Infer(..)
716 | ty::Alias(_, _)
717 | ty::Ref(_, _, _)
718 | ty::Adt(_, _)
719 | ty::Foreign(_)
720 | ty::Dynamic(..)
721 | ty::Error(_)
722 | ty::FnDef(..)
723 | ty::Closure(..)
724 | ty::CoroutineClosure(..)
725 | ty::Coroutine(..) => LowerAvailableDepth::Yes,
726 }
727 } else {
728 LowerAvailableDepth::Yes
729 }
730 }
731 ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(_))
732 | ty::PredicateKind::Clause(ty::ClauseKind::Projection(_))
733 | ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(_))
734 | ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(_))
735 | ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(_, _))
736 | ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(_))
737 | ty::PredicateKind::Subtype(_)
738 | ty::PredicateKind::Coerce(_)
739 | ty::PredicateKind::DynCompatible(_)
740 | ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_))
741 | ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(_))
742 | ty::PredicateKind::ConstEquate(_, _)
743 | ty::PredicateKind::Ambiguous => LowerAvailableDepth::Yes,
744 };
745 self.search_graph.evaluate_goal(
746 self.cx(),
747 canonical_goal,
748 step_kind,
749 increase_depth_for_nested,
750 &mut inspect::ProofTreeBuilder::new_noop(),
751 )
752 }
753
754 pub(super) fn evaluate_goal_raw(
762 &mut self,
763 source: GoalSource,
764 goal: Goal<I, I::Predicate>,
765 ) -> Result<(NestedNormalizationGoals<I>, GoalEvaluation<I>), NoSolutionOrRerunNonErased> {
766 let opaque_types = self.delegate.clone_opaque_types_lookup_table();
770
771 let (goal, opaque_types) =
772 self.delegate.deeply_resolve_via_unification_table((goal, opaque_types));
773 let typing_mode = self.typing_mode();
774 let step_kind = self.step_kind_for_source(source);
775
776 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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(776u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["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!(
777 Level::DEBUG,
778 "evaluate_goal_raw in typing mode",
779 "{:?} opaques={:?}",
780 typing_mode,
781 opaque_types
782 )
783 .entered();
784
785 let (result, orig_values, canonical_goal, succeeded_in_erased) = 'retry_canonicalize: {
786 let skip_erased_attempt = match typing_mode {
787 TypingMode::Reflection | TypingMode::Coherence => true,
788 TypingMode::Typeck { .. }
789 | TypingMode::PostTypeckUntilBorrowck { .. }
790 | TypingMode::PostBorrowck { .. }
791 | TypingMode::Codegen
792 | TypingMode::PostAnalysis
793 | TypingMode::ErasedNotCoherence(_) => {
794 let mut skip = false;
795 if opaque_types.iter().any(|(_, ty)| ty.is_ty_var())
796 && let PredicateKind::Clause(ClauseKind::Trait(..)) =
797 goal.predicate.kind().skip_binder()
798 {
799 skip = true;
800 }
801
802 if let PredicateKind::Clause(ClauseKind::Trait(tr)) =
803 goal.predicate.kind().skip_binder()
804 && tr.self_ty().has_coroutines()
805 && self.cx().trait_is_auto(tr.trait_ref.def_id)
806 {
807 }
811
812 skip
813 }
814 };
815
816 if skip_erased_attempt {
817 if typing_mode.is_erased_not_coherence() {
818 match self.opaque_accesses.rerun_always(RerunReason::SkipErasedAttempt)? {}
819 } else {
820 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:820",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(820u32),
::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");
821 }
822 } else {
823 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:823",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(823u32),
::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:?}");
824
825 let (orig_values, canonical_goal) = canonicalize_goal(
826 self.delegate,
827 goal,
828 &[],
829 TypingMode::ErasedNotCoherence(MayBeErased),
830 );
831
832 let (canonical_result, accessed_opaques) =
833 self.evaluate_in_search_graph(canonical_goal, step_kind);
834
835 let should_rerun = should_rerun_after_erased_canonicalization(
836 accessed_opaques,
837 self.typing_mode(),
838 &opaque_types,
839 );
840 match should_rerun {
841 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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:841",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(841u32),
::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"),
842 RerunDecision::No => {
843 break 'retry_canonicalize (
844 canonical_result,
845 orig_values,
846 canonical_goal,
847 SucceededInErased::Yes { accessed_opaques },
848 );
849 }
850 RerunDecision::EagerlyPropagateToParent => {
851 self.opaque_accesses.update(accessed_opaques)?;
852 break 'retry_canonicalize (
853 canonical_result,
854 orig_values,
855 canonical_goal,
856 SucceededInErased::No,
859 );
860 }
861 }
862 }
863
864 let (orig_values, canonical_goal) =
865 canonicalize_goal(self.delegate, goal, &opaque_types, typing_mode);
866
867 let (canonical_result, accessed_opaques) =
868 self.evaluate_in_search_graph(canonical_goal, step_kind);
869 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!(
870 !accessed_opaques.might_rerun(),
871 "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:?}"
872 );
873
874 (canonical_result, orig_values, canonical_goal, SucceededInErased::No)
875 };
876
877 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:877",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(877u32),
::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);
878 let response = match result {
879 Ok(response) => {
880 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:880",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(880u32),
::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");
881 response
882 }
883 Err(NoSolution) => {
884 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:884",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(884u32),
::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");
885 return Err(NoSolution.into());
886 }
887 };
888
889 drop(tracing_span);
890
891 let has_changed =
892 if !has_only_region_constraints(response) { HasChanged::Yes } else { HasChanged::No };
893
894 let (normalization_nested_goals, certainty) = instantiate_and_apply_query_response(
895 self.delegate,
896 &orig_values,
897 response,
898 self.origin_span,
899 );
900
901 let stalled_on = match certainty {
912 Certainty::Yes => None,
913 Certainty::Maybe(maybe_info) => match has_changed {
914 HasChanged::Yes => None,
919 HasChanged::No => Some(self.build_stalled_on(
920 canonical_goal,
921 maybe_info,
922 orig_values,
923 succeeded_in_erased,
924 )),
925 },
926 };
927
928 Ok((
929 normalization_nested_goals,
930 GoalEvaluation { goal, certainty, has_changed, stalled_on },
931 ))
932 }
933
934 fn build_stalled_on(
935 &self,
936 canonical_goal: I::CanonicalInput,
937 maybe_info: MaybeInfo,
938 stalled_vars: ThinVec<I::GenericArg>,
939 previously_succeeded_in_erased: SucceededInErased<I>,
940 ) -> GoalStalledOn<I> {
941 let mut sub_roots = ThinVec::new();
943 let stalled_vars = stalled_vars
944 .into_iter()
945 .filter_map(|arg| match arg.kind() {
946 ty::GenericArgKind::Lifetime(_) => None,
948 ty::GenericArgKind::Type(ty) => match ty.kind() {
949 ty::Infer(ty::TyVar(vid)) => {
950 sub_roots.push(self.delegate.sub_unification_table_root_var(vid));
951 Some(TyOrConstInferVar::Ty(vid))
952 }
953 ty::Infer(ty::IntVar(vid)) => Some(TyOrConstInferVar::TyInt(vid)),
954 ty::Infer(ty::FloatVar(vid)) => Some(TyOrConstInferVar::TyFloat(vid)),
955 ty::Param(_) | ty::Placeholder(_) => None,
956 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ty)));
}unreachable!("unexpected orig_value: {ty:?}"),
957 },
958 ty::GenericArgKind::Const(ct) => match ct.kind() {
959 ty::ConstKind::Infer(ty::InferConst::Var(v)) => {
960 Some(TyOrConstInferVar::Const(v))
961 }
962 ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(_) => None,
963 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ct)));
}unreachable!("unexpected orig_value: {ct:?}"),
964 },
965 })
966 .collect();
967
968 GoalStalledOn {
969 stalled_vars,
970 sub_roots,
971 stalled_maybe_info: maybe_info,
972 opaques: GoalStalledOnOpaques::Yes {
973 num_opaques_in_storage: canonical_goal
974 .canonical
975 .value
976 .predefined_opaques_in_body
977 .len(),
978 previously_succeeded_in_erased,
979 },
980 }
981 }
982
983 pub(super) fn compute_goal(
984 &mut self,
985 goal: Goal<I, I::Predicate>,
986 ) -> QueryResultOrRerunNonErased<I> {
987 let Goal { param_env, predicate } = goal;
988 let kind = predicate.kind();
989 self.enter_forall_with_assumptions(kind, param_env, |ecx, kind| {
990 Ok(match kind {
991 ty::PredicateKind::Clause(ty::ClauseKind::Trait(predicate)) => {
992 ecx.compute_trait_goal(Goal { param_env, predicate }).map(|(r, _via)| r)?
993 }
994 ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(predicate)) => {
995 ecx.compute_host_effect_goal(Goal { param_env, predicate })?
996 }
997 ty::PredicateKind::Clause(ty::ClauseKind::Projection(predicate)) => {
998 ecx.compute_projection_goal(Goal { param_env, predicate })?
999 }
1000 ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(predicate)) => {
1001 ecx.compute_type_outlives_goal(Goal { param_env, predicate })?
1002 }
1003 ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(predicate)) => {
1004 ecx.compute_region_outlives_goal(Goal { param_env, predicate })?
1005 }
1006 ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
1007 ecx.compute_const_arg_has_type_goal(Goal { param_env, predicate: (ct, ty) })?
1008 }
1009 ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
1010 ecx.compute_unstable_feature_goal(param_env, symbol)?
1011 }
1012 ty::PredicateKind::Subtype(predicate) => {
1013 ecx.compute_subtype_goal(Goal { param_env, predicate })?
1014 }
1015 ty::PredicateKind::Coerce(predicate) => {
1016 ecx.compute_coerce_goal(Goal { param_env, predicate })?
1017 }
1018 ty::PredicateKind::DynCompatible(trait_def_id) => {
1019 ecx.compute_dyn_compatible_goal(trait_def_id)?
1020 }
1021 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(term)) => {
1022 ecx.compute_well_formed_goal(Goal { param_env, predicate: term })?
1023 }
1024 ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(ct)) => {
1025 ecx.compute_const_evaluatable_goal(Goal { param_env, predicate: ct })?
1026 }
1027 ty::PredicateKind::ConstEquate(_, _) => {
1028 {
::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")
1029 }
1030 ty::PredicateKind::NormalizesTo(predicate) => {
1031 ecx.compute_normalizes_to_goal(Goal { param_env, predicate })?
1032 }
1033 ty::PredicateKind::Ambiguous => {
1034 ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)?
1035 }
1036 })
1037 })
1038 }
1039
1040 {}
#[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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1042u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1057",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1057u32),
::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))]
1043 pub(super) fn try_evaluate_added_goals(
1044 &mut self,
1045 ) -> Result<Certainty, NoSolutionOrRerunNonErased> {
1046 for _ in 0..FIXPOINT_STEP_LIMIT {
1047 match self.evaluate_added_goals_step().map_err_to_rerun()? {
1048 Ok(None) => {}
1049 Ok(Some(cert)) => return Ok(cert),
1050 Err(NoSolution) => {
1051 self.tainted = Err(NoSolution);
1052 return Err(NoSolution.into());
1053 }
1054 }
1055 }
1056
1057 debug!("try_evaluate_added_goals: encountered overflow");
1058 Ok(Certainty::overflow(false))
1059 }
1060
1061 fn evaluate_added_goals_step(
1065 &mut self,
1066 ) -> Result<Option<Certainty>, NoSolutionOrRerunNonErased> {
1067 let mut unchanged_certainty = Some(Certainty::Yes);
1069 for (source, goal, stalled_on) in mem::take(&mut self.nested_goals) {
1073 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!(
1075 goal.predicate.kind().skip_binder(),
1076 PredicateKind::NormalizesTo(_)
1077 ));
1078
1079 let GoalEvaluation { goal, certainty, has_changed, stalled_on } =
1080 self.evaluate_goal(source, goal, stalled_on)?;
1081 if has_changed == HasChanged::Yes {
1082 unchanged_certainty = None;
1083 }
1084
1085 match certainty {
1086 Certainty::Yes => {}
1087 Certainty::Maybe { .. } => {
1088 self.nested_goals.push((source, goal, stalled_on));
1089 unchanged_certainty = unchanged_certainty.map(|c| c.and(certainty));
1090 }
1091 }
1092 }
1093
1094 Ok(unchanged_certainty)
1095 }
1096
1097 pub(crate) fn record_impl_args(&mut self, impl_args: I::GenericArgs) {
1099 self.inspect.record_impl_args(self.delegate, self.max_input_universe, impl_args)
1100 }
1101
1102 pub(super) fn cx(&self) -> I {
1103 self.delegate.cx()
1104 }
1105
1106 {}
#[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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1106u32),
::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))]
1107 pub(super) fn add_goal(
1108 &mut self,
1109 source: GoalSource,
1110 mut goal: Goal<I, I::Predicate>,
1111 ) -> Result<(), NoSolutionOrRerunNonErased> {
1112 goal.predicate = self.normalize(
1113 GoalSource::NormalizeGoal(self.step_kind_for_source(source)),
1114 goal.param_env,
1115 ty::Unnormalized::new_wip(goal.predicate),
1116 )?;
1117 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1118
1119 if let Some(GoalEvaluation { goal, certainty, has_changed: _, stalled_on }) =
1120 compute_goal_fast_path(self.delegate, goal, self.origin_span)
1121 {
1122 match certainty {
1123 Certainty::Yes => {}
1125 Certainty::Maybe(_) => {
1126 self.nested_goals.push((source, goal, stalled_on));
1127 }
1128 }
1129 } else {
1130 self.nested_goals.push((source, goal, None));
1131 }
1132 Ok(())
1133 }
1134
1135 {}
#[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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1135u32),
::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))]
1136 pub(super) fn add_goals(
1137 &mut self,
1138 source: GoalSource,
1139 goals: impl IntoIterator<Item = Goal<I, I::Predicate>>,
1140 ) -> Result<(), NoSolutionOrRerunNonErased> {
1141 for goal in goals {
1142 self.add_goal(source, goal)?;
1143 }
1144 Ok(())
1145 }
1146
1147 pub(super) fn next_region_var(&mut self) -> Region<I> {
1148 let region = self.delegate.next_region_infer();
1149 self.inspect.add_var_value(region);
1150 region
1151 }
1152
1153 pub(super) fn next_ty_infer(&mut self) -> I::Ty {
1154 let ty = self.delegate.next_ty_infer();
1155 self.inspect.add_var_value(ty);
1156 ty
1157 }
1158
1159 pub(super) fn next_const_infer(&mut self) -> Const<I> {
1160 let ct = self.delegate.next_const_infer();
1161 self.inspect.add_var_value(ct);
1162 ct
1163 }
1164
1165 pub(super) fn next_term_infer_of_alias_kind(
1168 &mut self,
1169 alias_term: ty::AliasTerm<I>,
1170 ) -> I::Term {
1171 match alias_term.kind {
1172 ty::AliasTermKind::ProjectionTy { .. }
1173 | ty::AliasTermKind::InherentTy { .. }
1174 | ty::AliasTermKind::OpaqueTy { .. }
1175 | ty::AliasTermKind::FreeTy { .. } => self.next_ty_infer().into(),
1176 ty::AliasTermKind::FreeConst { .. }
1177 | ty::AliasTermKind::InherentConstSelf { .. }
1178 | ty::AliasTermKind::InherentConstImpl { .. }
1179 | ty::AliasTermKind::AnonConst { .. }
1180 | ty::AliasTermKind::ProjectionConst { .. } => self.next_const_infer().into(),
1181 }
1182 }
1183
1184 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1188u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: bool = loop {};
return __tracing_attr_fake_return;
}
{
let universe_of_term =
match goal.predicate.term.kind() {
ty::TermKind::Ty(ty) => {
if let ty::Infer(ty::TyVar(vid)) = ty.kind() {
self.delegate.universe_of_ty(vid).unwrap()
} else { return false; }
}
ty::TermKind::Const(ct) => {
if let ty::ConstKind::Infer(ty::InferConst::Var(vid)) =
ct.kind() {
self.delegate.universe_of_const(vid).unwrap()
} else { return false; }
}
};
struct ContainsTermOrNotNameable<'a,
D: SolverDelegate<Interner = I>, I: Interner> {
term: I::Term,
universe_of_term: ty::UniverseIndex,
delegate: &'a D,
cache: HashSet<I::Ty>,
}
impl<D: SolverDelegate<Interner = I>, I: Interner>
ContainsTermOrNotNameable<'_, D, I> {
fn check_nameable(&self, universe: ty::UniverseIndex)
-> ControlFlow<()> {
if self.universe_of_term.can_name(universe) {
ControlFlow::Continue(())
} else { ControlFlow::Break(()) }
}
}
impl<D: SolverDelegate<Interner = I>, I: Interner>
TypeVisitor<I> for ContainsTermOrNotNameable<'_, D, I> {
type Result = ControlFlow<()>;
fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
if self.cache.contains(&t) {
return ControlFlow::Continue(());
}
match t.kind() {
ty::Infer(ty::TyVar(vid)) => {
if let ty::TermKind::Ty(term) = self.term.kind() &&
let ty::Infer(ty::TyVar(term_vid)) = term.kind() &&
self.delegate.root_ty_var(vid) ==
self.delegate.root_ty_var(term_vid) {
return ControlFlow::Break(());
}
self.check_nameable(self.delegate.universe_of_ty(vid).unwrap())?;
}
ty::Placeholder(p) => self.check_nameable(p.universe())?,
_ => {
if t.has_non_region_infer() || t.has_placeholders() {
t.super_visit_with(self)?
}
}
}
if !self.cache.insert(t) {
::core::panicking::panic("assertion failed: self.cache.insert(t)")
};
ControlFlow::Continue(())
}
fn visit_const(&mut self, c: Const<I>) -> Self::Result {
match c.kind() {
ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
if let ty::TermKind::Const(term) = self.term.kind() &&
let ty::ConstKind::Infer(ty::InferConst::Var(term_vid)) =
term.kind() &&
self.delegate.root_const_var(vid) ==
self.delegate.root_const_var(term_vid) {
return ControlFlow::Break(());
}
self.check_nameable(self.delegate.universe_of_const(vid).unwrap())
}
ty::ConstKind::Placeholder(p) =>
self.check_nameable(p.universe()),
_ => {
if c.has_non_region_infer() || c.has_placeholders() {
c.super_visit_with(self)
} else { ControlFlow::Continue(()) }
}
}
}
fn visit_predicate<P: PredicateProxy<I>>(&mut self, p: P)
-> Self::Result {
if p.has_non_region_infer() || p.has_placeholders() {
p.super_visit_with(self)
} else { ControlFlow::Continue(()) }
}
fn visit_clauses(&mut self, c: I::Clauses) -> Self::Result {
if c.has_non_region_infer() || c.has_placeholders() {
c.super_visit_with(self)
} else { ControlFlow::Continue(()) }
}
}
let mut visitor =
ContainsTermOrNotNameable {
delegate: self.delegate,
universe_of_term,
term: goal.predicate.term,
cache: Default::default(),
};
goal.predicate.alias.visit_with(&mut visitor).is_continue()
&& goal.param_env.visit_with(&mut visitor).is_continue()
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1188",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1188u32),
::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)]
1189 pub(super) fn term_is_fully_unconstrained(&self, goal: Goal<I, ty::NormalizesTo<I>>) -> bool {
1190 let universe_of_term = match goal.predicate.term.kind() {
1191 ty::TermKind::Ty(ty) => {
1192 if let ty::Infer(ty::TyVar(vid)) = ty.kind() {
1193 self.delegate.universe_of_ty(vid).unwrap()
1194 } else {
1195 return false;
1196 }
1197 }
1198 ty::TermKind::Const(ct) => {
1199 if let ty::ConstKind::Infer(ty::InferConst::Var(vid)) = ct.kind() {
1200 self.delegate.universe_of_const(vid).unwrap()
1201 } else {
1202 return false;
1203 }
1204 }
1205 };
1206
1207 struct ContainsTermOrNotNameable<'a, D: SolverDelegate<Interner = I>, I: Interner> {
1208 term: I::Term,
1209 universe_of_term: ty::UniverseIndex,
1210 delegate: &'a D,
1211 cache: HashSet<I::Ty>,
1212 }
1213
1214 impl<D: SolverDelegate<Interner = I>, I: Interner> ContainsTermOrNotNameable<'_, D, I> {
1215 fn check_nameable(&self, universe: ty::UniverseIndex) -> ControlFlow<()> {
1216 if self.universe_of_term.can_name(universe) {
1217 ControlFlow::Continue(())
1218 } else {
1219 ControlFlow::Break(())
1220 }
1221 }
1222 }
1223
1224 impl<D: SolverDelegate<Interner = I>, I: Interner> TypeVisitor<I>
1225 for ContainsTermOrNotNameable<'_, D, I>
1226 {
1227 type Result = ControlFlow<()>;
1228 fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
1229 if self.cache.contains(&t) {
1230 return ControlFlow::Continue(());
1231 }
1232
1233 match t.kind() {
1234 ty::Infer(ty::TyVar(vid)) => {
1235 if let ty::TermKind::Ty(term) = self.term.kind()
1236 && let ty::Infer(ty::TyVar(term_vid)) = term.kind()
1237 && self.delegate.root_ty_var(vid) == self.delegate.root_ty_var(term_vid)
1238 {
1239 return ControlFlow::Break(());
1240 }
1241
1242 self.check_nameable(self.delegate.universe_of_ty(vid).unwrap())?;
1243 }
1244 ty::Placeholder(p) => self.check_nameable(p.universe())?,
1245 _ => {
1246 if t.has_non_region_infer() || t.has_placeholders() {
1247 t.super_visit_with(self)?
1248 }
1249 }
1250 }
1251
1252 assert!(self.cache.insert(t));
1253 ControlFlow::Continue(())
1254 }
1255
1256 fn visit_const(&mut self, c: Const<I>) -> Self::Result {
1257 match c.kind() {
1258 ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
1259 if let ty::TermKind::Const(term) = self.term.kind()
1260 && let ty::ConstKind::Infer(ty::InferConst::Var(term_vid)) = term.kind()
1261 && self.delegate.root_const_var(vid)
1262 == self.delegate.root_const_var(term_vid)
1263 {
1264 return ControlFlow::Break(());
1265 }
1266
1267 self.check_nameable(self.delegate.universe_of_const(vid).unwrap())
1268 }
1269 ty::ConstKind::Placeholder(p) => self.check_nameable(p.universe()),
1270 _ => {
1271 if c.has_non_region_infer() || c.has_placeholders() {
1272 c.super_visit_with(self)
1273 } else {
1274 ControlFlow::Continue(())
1275 }
1276 }
1277 }
1278 }
1279
1280 fn visit_predicate<P: PredicateProxy<I>>(&mut self, p: P) -> Self::Result {
1281 if p.has_non_region_infer() || p.has_placeholders() {
1282 p.super_visit_with(self)
1283 } else {
1284 ControlFlow::Continue(())
1285 }
1286 }
1287
1288 fn visit_clauses(&mut self, c: I::Clauses) -> Self::Result {
1289 if c.has_non_region_infer() || c.has_placeholders() {
1290 c.super_visit_with(self)
1291 } else {
1292 ControlFlow::Continue(())
1293 }
1294 }
1295 }
1296
1297 let mut visitor = ContainsTermOrNotNameable {
1298 delegate: self.delegate,
1299 universe_of_term,
1300 term: goal.predicate.term,
1301 cache: Default::default(),
1302 };
1303 goal.predicate.alias.visit_with(&mut visitor).is_continue()
1304 && goal.param_env.visit_with(&mut visitor).is_continue()
1305 }
1306
1307 pub(super) fn sub_unify_ty_vids_raw(&self, a: ty::TyVid, b: ty::TyVid) {
1308 self.delegate.sub_unify_ty_vids_raw(a, b)
1309 }
1310
1311 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1311u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1311",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1311u32),
::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)]
1312 pub(super) fn eq<T: Relate<I>>(
1313 &mut self,
1314 param_env: I::ParamEnv,
1315 lhs: T,
1316 rhs: T,
1317 ) -> Result<(), NoSolutionOrRerunNonErased> {
1318 self.relate(param_env, lhs, ty::Variance::Invariant, rhs)
1319 }
1320
1321 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1321u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1321",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1321u32),
::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)]
1322 pub(super) fn sub<T: Relate<I>>(
1323 &mut self,
1324 param_env: I::ParamEnv,
1325 sub: T,
1326 sup: T,
1327 ) -> Result<(), NoSolutionOrRerunNonErased> {
1328 self.relate(param_env, sub, ty::Variance::Covariant, sup)
1329 }
1330
1331 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1331u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1331",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1331u32),
::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)]
1332 pub(super) fn relate<T: Relate<I>>(
1333 &mut self,
1334 param_env: I::ParamEnv,
1335 lhs: T,
1336 variance: ty::Variance,
1337 rhs: T,
1338 ) -> Result<(), NoSolutionOrRerunNonErased> {
1339 let goals = self.delegate.relate(param_env, lhs, variance, rhs, self.origin_span)?;
1340 for &goal in goals.iter() {
1341 let source = match goal.predicate.kind().skip_binder() {
1342 ty::PredicateKind::Subtype { .. }
1343 | ty::PredicateKind::Clause(ty::ClauseKind::Projection(..)) => {
1344 GoalSource::TypeRelating
1345 }
1346 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => GoalSource::Misc,
1348 p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
1349 };
1350 self.add_goal(source, goal)?;
1351 }
1352 Ok(())
1353 }
1354
1355 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1360u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1360",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1360u32),
::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)]
1361 pub(super) fn eq_and_get_goals<T: Relate<I>>(
1362 &self,
1363 param_env: I::ParamEnv,
1364 lhs: T,
1365 rhs: T,
1366 ) -> Result<Vec<Goal<I, I::Predicate>>, NoSolution> {
1367 Ok(self.delegate.relate(param_env, lhs, ty::Variance::Invariant, rhs, self.origin_span)?)
1368 }
1369
1370 pub(super) fn instantiate_binder_with_infer<T: TypeFoldable<I> + Copy>(
1371 &self,
1372 value: ty::Binder<I, T>,
1373 ) -> T {
1374 self.delegate.instantiate_binder_with_infer(value)
1375 }
1376
1377 pub(super) fn enter_forall_with_assumptions<T: TypeFoldable<I>, U>(
1385 &mut self,
1386 value: ty::Binder<I, T>,
1387 param_env: I::ParamEnv,
1388 f: impl FnOnce(&mut Self, T) -> U,
1389 ) -> U {
1390 self.delegate.enter_forall_without_assumptions(value, |value| {
1391 let u = self.delegate.universe();
1392 let assumptions = if self.cx().assumptions_on_binders() {
1393 self.region_assumptions_for_placeholders_in_universe(value.clone(), u, param_env)
1394 } else {
1395 None
1396 };
1397 self.delegate.insert_placeholder_assumptions(u, assumptions);
1398 f(self, value)
1399 })
1400 }
1401
1402 pub(super) fn deeply_resolve_ignoring_regions<T>(&self, value: T) -> T
1403 where
1404 T: TypeFoldable<I>,
1405 {
1406 self.delegate.deeply_resolve_ignoring_regions(value)
1407 }
1408
1409 pub(super) fn shallow_resolve(&self, ty: I::Ty) -> I::Ty {
1410 self.delegate.shallow_resolve(ty)
1411 }
1412
1413 pub(super) fn eager_resolve_region(&self, r: Region<I>) -> Region<I> {
1414 if let ty::ReVar(vid) = r.kind() {
1415 self.delegate.shallow_resolve_region_var(vid)
1416 } else {
1417 r
1418 }
1419 }
1420
1421 pub(super) fn fresh_args_for_item(&mut self, def_id: I::DefId) -> I::GenericArgs {
1422 let args = self.delegate.fresh_args_for_item(def_id);
1423 for arg in args.iter() {
1424 self.inspect.add_var_value(arg);
1425 }
1426 args
1427 }
1428
1429 pub(super) fn register_solver_region_constraint(&self, c: RegionConstraint<I>) {
1430 self.delegate.register_solver_region_constraint(c, self.origin_span);
1431 }
1432
1433 pub(super) fn register_ty_outlives(&self, ty: I::Ty, lt: Region<I>) {
1434 self.delegate.register_ty_outlives(ty, lt, self.origin_span);
1435 }
1436
1437 pub(super) fn register_region_outlives(
1438 &self,
1439 a: Region<I>,
1440 b: Region<I>,
1441 vis: VisibleForLeakCheck,
1442 ) {
1443 self.delegate.sub_regions(b, a, vis, self.origin_span);
1445 }
1446
1447 pub(super) fn well_formed_goals(
1449 &self,
1450 param_env: I::ParamEnv,
1451 term: I::Term,
1452 ) -> Option<Vec<Goal<I, I::Predicate>>> {
1453 self.delegate.well_formed_goals(param_env, term)
1454 }
1455
1456 pub(super) fn trait_ref_is_knowable(
1457 &mut self,
1458 param_env: I::ParamEnv,
1459 trait_ref: ty::TraitRef<I>,
1460 ) -> Result<bool, NoSolutionOrRerunNonErased> {
1461 let delegate = self.delegate;
1462 let lazily_normalize_ty = |ty| self.structurally_normalize_ty(param_env, ty);
1463 coherence::trait_ref_is_knowable(&**delegate, trait_ref, lazily_normalize_ty)
1464 .map(|is_knowable| is_knowable.is_ok())
1465 }
1466
1467 pub(super) fn fetch_eligible_assoc_item(
1468 &self,
1469 goal_trait_ref: ty::TraitRef<I>,
1470 trait_assoc_def_id: I::TraitAssocTermId,
1471 impl_def_id: I::ImplId,
1472 ) -> FetchEligibleAssocItemResponse<I> {
1473 self.delegate.fetch_eligible_assoc_item(goal_trait_ref, trait_assoc_def_id, impl_def_id)
1474 }
1475
1476 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1476u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1476",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1476u32),
::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)]
1477 pub(super) fn register_hidden_type_in_storage(
1478 &mut self,
1479 opaque_type_key: ty::OpaqueTypeKey<I>,
1480 hidden_ty: I::Ty,
1481 ) -> Option<I::Ty> {
1482 self.delegate.register_hidden_type_in_storage(opaque_type_key, hidden_ty, self.origin_span)
1483 }
1484
1485 pub(super) fn add_item_bounds_for_hidden_type(
1486 &mut self,
1487 opaque_def_id: I::OpaqueTyId,
1488 opaque_args: I::GenericArgs,
1489 param_env: I::ParamEnv,
1490 hidden_ty: I::Ty,
1491 ) -> Result<(), NoSolutionOrRerunNonErased> {
1492 let mut goals = Vec::new();
1493 self.delegate.add_item_bounds_for_hidden_type(
1494 opaque_def_id,
1495 opaque_args,
1496 param_env,
1497 hidden_ty,
1498 &mut goals,
1499 );
1500 self.add_goals(GoalSource::AliasWellFormed, goals)?;
1501 Ok(())
1502 }
1503
1504 pub(super) fn evaluate_const(
1508 &mut self,
1509 param_env: I::ParamEnv,
1510 alias_const: ty::AliasConst<I>,
1511 ) -> Result<Option<Const<I>>, NoSolutionOrRerunNonErased> {
1512 if self.typing_mode().is_erased_not_coherence() {
1513 match self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)? {}
1514 }
1515
1516 self.delegate.evaluate_const(param_env, alias_const, |ty| {
1517 self.normalize(GoalSource::Misc, param_env, ty)
1518 })
1519 }
1520
1521 pub(super) fn evaluate_const_and_instantiate_projection_term(
1522 &mut self,
1523 param_env: I::ParamEnv,
1524 projection_term: ty::AliasTerm<I>,
1525 expected_term: I::Term,
1526 alias_const: ty::AliasConst<I>,
1527 ) -> QueryResultOrRerunNonErased<I> {
1528 match self.evaluate_const(param_env, alias_const)? {
1529 Some(evaluated) => {
1530 self.eq(param_env, expected_term, evaluated.into())?;
1531 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1532 }
1533 None if self.cx().features().gca_const_items() => {
1534 if self.deeply_resolve_ignoring_regions(alias_const).has_non_region_infer() {
1542 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1543 } else {
1544 self.eq(
1554 param_env,
1555 projection_term.to_term(self.cx(), ty::IsRigid::Yes),
1556 expected_term,
1557 )?;
1558 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1559 }
1560 }
1561 None => {
1562 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1564 }
1565 }
1566 }
1567
1568 pub(super) fn is_transmutable(
1569 &mut self,
1570 src: I::Ty,
1571 dst: I::Ty,
1572 assume: Const<I>,
1573 ) -> Result<Certainty, NoSolution> {
1574 self.delegate.is_transmutable(dst, src, assume)
1575 }
1576
1577 pub(super) fn replace_bound_vars<T: TypeFoldable<I>>(
1578 &self,
1579 t: T,
1580 universes: &mut Vec<Option<ty::UniverseIndex>>,
1581 ) -> T {
1582 BoundVarReplacer::replace_bound_vars(&**self.delegate, universes, t).0
1583 }
1584
1585 pub(super) fn may_use_unstable_feature(
1586 &mut self,
1587 param_env: I::ParamEnv,
1588 symbol: I::Symbol,
1589 ) -> Result<bool, RerunNonErased> {
1590 if self.typing_mode().is_erased_not_coherence() {
1591 match self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)? {}
1592 }
1593
1594 Ok(may_use_unstable_feature(&**self.delegate, param_env, symbol))
1595 }
1596
1597 pub(crate) fn opaques_with_sub_unified_hidden_type(
1598 &self,
1599 self_ty: I::Ty,
1600 ) -> Vec<ty::OpaqueAliasTy<I>> {
1601 if let ty::Infer(ty::TyVar(vid)) = self_ty.kind() {
1602 self.delegate.opaques_with_sub_unified_hidden_type(vid)
1603 } else {
1604 ::alloc::vec::Vec::new()vec![]
1605 }
1606 }
1607
1608 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1621u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1645",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1645u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1621",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1621u32),
::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)]
1622 pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
1623 &mut self,
1624 shallow_certainty: Certainty,
1625 ) -> QueryResultOrRerunNonErased<I> {
1626 self.inspect.make_canonical_response(shallow_certainty);
1627
1628 let goals_certainty = self.try_evaluate_added_goals()?;
1629 assert_eq!(
1630 self.tainted,
1631 Ok(()),
1632 "EvalCtxt is tainted -- nested goals may have been dropped in a \
1633 previous call to `try_evaluate_added_goals!`"
1634 );
1635
1636 let goals_certainty = match self.delegate.cx().assumptions_on_binders() {
1637 true => {
1638 let certainty = self.eagerly_handle_placeholders()?;
1639 certainty.and(goals_certainty)
1640 }
1641 false => {
1642 self.delegate.leak_check(self.max_input_universe).map_err(|NoSolution| {
1645 trace!("failed the leak check");
1646 NoSolution
1647 })?;
1648
1649 goals_certainty
1650 }
1651 };
1652
1653 let (certainty, normalization_nested_goals) =
1654 match (self.current_goal_kind, shallow_certainty) {
1655 (CurrentGoalKind::ProjectionComputeAssocTermCandidate, Certainty::Yes) => {
1663 let goals = std::mem::take(&mut self.nested_goals);
1664 if goals.is_empty() {
1667 assert!(matches!(goals_certainty, Certainty::Yes));
1668 }
1669 (
1670 Certainty::Yes,
1671 NestedNormalizationGoals(
1672 goals.into_iter().map(|(s, g, _)| (s, g)).collect(),
1673 ),
1674 )
1675 }
1676 _ => {
1677 let certainty = shallow_certainty.and(goals_certainty);
1678 (certainty, NestedNormalizationGoals::empty())
1679 }
1680 };
1681
1682 if let Certainty::Maybe(
1683 maybe_info @ MaybeInfo {
1684 cause: MaybeCause::Overflow { keep_constraints: false, .. },
1685 opaque_types_jank: _,
1686 stalled_on_coroutines: _,
1687 },
1688 ) = certainty
1689 {
1690 return Ok(self.make_ambiguous_response_no_constraints(maybe_info));
1702 }
1703
1704 let external_constraints =
1705 self.compute_external_query_constraints(certainty, normalization_nested_goals);
1706 let (var_values, mut external_constraints) = self
1707 .delegate
1708 .deeply_resolve_via_unification_table((self.var_values, external_constraints));
1709
1710 let mut unique = HashSet::default();
1712 if let ExternalRegionConstraints::Old(r) = &mut external_constraints.region_constraints {
1713 r.retain(|(outlives, _)| !outlives.is_trivial() && unique.insert(*outlives));
1714 }
1715
1716 filter_irrelevant_region_constraints(self.delegate, &var_values, &mut external_constraints);
1717
1718 let canonical = canonicalize_response(
1719 self.delegate,
1720 self.max_input_universe,
1721 Response {
1722 var_values,
1723 certainty,
1724 external_constraints: self.cx().mk_external_constraints(external_constraints),
1725 },
1726 );
1727
1728 Ok(canonical)
1729 }
1730
1731 pub(in crate::solve) fn make_ambiguous_response_no_constraints(
1736 &self,
1737 maybe: MaybeInfo,
1738 ) -> CanonicalResponse<I> {
1739 response_no_constraints_raw(
1740 self.cx(),
1741 self.max_input_universe,
1742 self.var_kinds,
1743 Certainty::Maybe(maybe),
1744 )
1745 }
1746
1747 {}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1754u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1754",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1754u32),
::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)]
1755 fn compute_external_query_constraints(
1756 &self,
1757 certainty: Certainty,
1758 normalization_nested_goals: NestedNormalizationGoals<I>,
1759 ) -> ExternalConstraintsData<I> {
1760 let region_constraints = if self.cx().assumptions_on_binders() {
1769 ExternalRegionConstraints::NextGen(if let Certainty::Yes = certainty {
1770 let constraint = self.delegate.get_solver_region_constraint();
1771 debug_assert_eq!(
1772 constraint,
1773 region_constraint::propagate_ambiguity(constraint.clone())
1774 );
1775 constraint
1776 } else {
1777 RegionConstraint::new_true()
1778 })
1779 } else {
1780 ExternalRegionConstraints::Old(if let Certainty::Yes = certainty {
1781 self.delegate.make_deduplicated_region_constraints()
1782 } else {
1783 vec![]
1784 })
1785 };
1786
1787 let opaque_types = self
1792 .delegate
1793 .clone_opaque_types_added_since(self.initial_opaque_types_storage_num_entries);
1794
1795 if self.typing_mode().is_erased_not_coherence() {
1796 assert!(opaque_types.is_empty());
1797 }
1798
1799 ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals }
1800 }
1801
1802 pub(super) fn normalize<T: TypeFoldable<I>>(
1803 &mut self,
1804 source: GoalSource,
1805 param_env: I::ParamEnv,
1806 value: ty::Unnormalized<I, T>,
1807 ) -> Result<T, NoSolutionOrRerunNonErased> {
1808 let value = self.delegate.deeply_resolve_ignoring_regions(value.skip_normalization());
1809
1810 if !self.cx().renormalize_rigid_aliases() && !value.has_non_rigid_aliases() {
1811 return Ok(value);
1812 }
1813
1814 let infcx = self.delegate.deref();
1816 let mut folder = NormalizationFolder::new(infcx, ::alloc::vec::Vec::new()vec![], |alias_term| {
1817 let infer_term = self.next_term_infer_of_alias_kind(alias_term);
1818 let pred = ty::ProjectionClause { projection_term: alias_term, term: infer_term };
1819 let goal = Goal::new(self.cx(), param_env, pred);
1820 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1821 let GoalEvaluation { goal, certainty, has_changed: _, stalled_on } =
1822 self.evaluate_goal(source, goal, None)?;
1823 let normalization_was_ambiguous = match certainty {
1824 Certainty::Yes => NormalizationWasAmbiguous::No,
1825 Certainty::Maybe(_) => {
1826 self.nested_goals.push((source, goal, stalled_on));
1827 NormalizationWasAmbiguous::Yes
1828 }
1829 };
1830
1831 Ok((self.deeply_resolve_ignoring_regions(infer_term), normalization_was_ambiguous))
1832 });
1833 value.try_fold_with(&mut folder)
1834 }
1835}
1836
1837fn filter_irrelevant_region_constraints<D, I>(
1838 delegate: &D,
1839 var_values: &CanonicalVarValues<I>,
1840 external_constraints: &mut ExternalConstraintsData<I>,
1841) where
1842 D: SolverDelegate<Interner = I>,
1843 I: Interner,
1844{
1845 #[derive(#[automatically_derived]
impl ::core::default::Default for NonTrivialVars {
#[inline]
fn default() -> Self {
NonTrivialVars { vars: ::core::default::Default::default() }
}
}Default)]
1846 struct NonTrivialVars {
1847 vars: HashSet<RegionVid>,
1848 }
1849 impl<I> TypeVisitor<I> for NonTrivialVars
1850 where
1851 I: Interner,
1852 {
1853 type Result = ();
1854 fn visit_ty(&mut self, t: I::Ty) {
1855 if !t.has_infer_regions() {
1858 return;
1859 }
1860 t.super_visit_with(self);
1861 }
1862 fn visit_const(&mut self, c: Const<I>) {
1863 if !c.has_infer_regions() {
1865 return;
1866 }
1867 c.super_visit_with(self);
1868 }
1869 fn visit_region(&mut self, r: Region<I>) {
1870 if let ty::ReVar(vid) = r.kind() {
1871 self.vars.insert(vid);
1872 }
1873 }
1874 }
1875
1876 let ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals } =
1877 external_constraints;
1878
1879 if let ExternalRegionConstraints::Old(r) = region_constraints
1884 && !r.is_empty()
1885 {
1886 let mut vis = NonTrivialVars::default();
1887 var_values.visit_with(&mut vis);
1888 opaque_types.visit_with(&mut vis);
1892 normalization_nested_goals.visit_with(&mut vis);
1893 for (constraint, _) in r.iter() {
1894 match constraint {
1895 ty::RegionConstraint::Outlives(ty::OutlivesClause(sup, _)) => {
1896 sup.visit_with(&mut vis)
1897 }
1898 ty::RegionConstraint::Eq(eq) => eq.visit_with(&mut vis),
1899 }
1900 }
1901
1902 r.retain(|(outlives, _)| {
1903 if let ty::RegionConstraint::Outlives(ty::OutlivesClause(sup, re)) = *outlives
1904 && let Some(sup_re) = sup.as_region()
1905 && let ty::RegionKind::ReVar(vid) = re.kind()
1906 && delegate.universe_of_region(vid).unwrap()
1909 .can_name(max_universe(&**delegate, sup_re))
1910 {
1911 vis.vars.contains(&vid)
1912 } else {
1913 true
1914 }
1915 });
1916 }
1917}
1918
1919#[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)]
1920enum RerunDecision {
1921 Yes,
1922 No,
1923 EagerlyPropagateToParent,
1924}
1925
1926{}
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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1926u32),
::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/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1926",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::INFO,
::tracing_core::__macro_support::Option::Some("/rustc-dev/fd8e211ae301c84a86d13cf52a6d3ce08c589e2e/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1926u32),
::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)]
1927fn should_rerun_after_erased_canonicalization<I: Interner>(
1928 AccessedOpaques { reason: _, rerun }: AccessedOpaques<I>,
1929 original_typing_mode: TypingMode<I>,
1930 parent_opaque_types: &[(OpaqueTypeKey<I>, I::Ty)],
1931) -> RerunDecision {
1932 let parent_opaque_def_ids = parent_opaque_types.iter().map(|(key, _)| key.def_id.into());
1933 let opaque_in_storage = |opaques: I::LocalDefIds, def_ids: SmallCopySet<_>| {
1934 if def_ids.as_ref().is_empty() {
1935 RerunDecision::No
1936 } else if opaques
1937 .iter()
1938 .chain(parent_opaque_def_ids)
1939 .any(|opaque| def_ids.as_ref().contains(&opaque))
1940 {
1941 RerunDecision::Yes
1942 } else {
1943 RerunDecision::No
1944 }
1945 };
1946 let any_opaque_has_infer_as_hidden = || {
1947 if parent_opaque_types.iter().any(|(_, ty)| ty.is_ty_var()) {
1948 RerunDecision::Yes
1949 } else {
1950 RerunDecision::No
1951 }
1952 };
1953
1954 match (rerun, original_typing_mode) {
1955 (RerunCondition::Never, _) => RerunDecision::No,
1957 (_, TypingMode::ErasedNotCoherence(MayBeErased)) => RerunDecision::EagerlyPropagateToParent,
1959 (_, TypingMode::Coherence) => unreachable!(),
1963 (RerunCondition::Always, _) => RerunDecision::Yes,
1965 (
1967 RerunCondition::OpaqueInStorage(..),
1968 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
1969 ) => RerunDecision::Yes,
1970 (
1971 RerunCondition::OpaqueInStorage(defids),
1972 TypingMode::PostBorrowck { defined_opaque_types: opaques }
1973 | TypingMode::Typeck { defining_opaque_types_and_generators: opaques }
1974 | TypingMode::PostTypeckUntilBorrowck { defining_opaque_types: opaques },
1975 ) => opaque_in_storage(opaques, defids),
1976 (RerunCondition::AnyOpaqueHasInferAsHidden, TypingMode::Typeck { .. }) => {
1978 any_opaque_has_infer_as_hidden()
1979 }
1980 (
1981 RerunCondition::AnyOpaqueHasInferAsHidden,
1982 TypingMode::PostBorrowck { .. }
1983 | TypingMode::PostAnalysis
1984 | TypingMode::Codegen
1985 | TypingMode::Reflection
1986 | TypingMode::PostTypeckUntilBorrowck { .. },
1987 ) => RerunDecision::No,
1988 (
1990 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_),
1991 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
1992 ) => RerunDecision::Yes,
1993 (
1994 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
1995 TypingMode::Typeck { defining_opaque_types_and_generators: opaques },
1996 ) => {
1997 if let RerunDecision::Yes = any_opaque_has_infer_as_hidden() {
1998 RerunDecision::Yes
1999 } else if let RerunDecision::Yes = opaque_in_storage(opaques, defids) {
2000 RerunDecision::Yes
2001 } else {
2002 RerunDecision::No
2003 }
2004 }
2005 (
2006 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
2007 TypingMode::PostBorrowck { defined_opaque_types: opaques }
2008 | TypingMode::PostTypeckUntilBorrowck { defining_opaque_types: opaques },
2009 ) => opaque_in_storage(opaques, defids),
2010 }
2011}
2012
2013pub fn evaluate_root_goal_for_proof_tree_raw_provider<
2015 D: SolverDelegate<Interner = I>,
2016 I: Interner,
2017>(
2018 cx: I,
2019 canonical_goal: I::CanonicalInput,
2020 root_depth: usize,
2021) -> (QueryResult<I>, I::Probe, RequiredDepth) {
2022 let mut inspect = inspect::ProofTreeBuilder::new();
2023 let ((canonical_result, accessed_opaques), required_depth) =
2024 SearchGraph::<D>::evaluate_root_goal_for_proof_tree(
2025 cx,
2026 root_depth,
2027 canonical_goal,
2028 &mut inspect,
2029 );
2030 let final_revision = inspect.unwrap();
2031
2032 if !!accessed_opaques.might_rerun() {
::core::panicking::panic("assertion failed: !accessed_opaques.might_rerun()")
};assert!(!accessed_opaques.might_rerun());
2033 (canonical_result, cx.mk_probe(final_revision), required_depth)
2034}
2035
2036pub(super) fn evaluate_root_goal_for_proof_tree<D: SolverDelegate<Interner = I>, I: Interner>(
2041 delegate: &D,
2042 goal: Goal<I, I::Predicate>,
2043 origin_span: I::Span,
2044 root_depth: usize,
2045) -> (Result<NestedNormalizationGoals<I>, NoSolution>, inspect::GoalEvaluation<I>) {
2046 let opaque_types = delegate.clone_opaque_types_lookup_table();
2047 let (goal, opaque_types) = delegate.deeply_resolve_via_unification_table((goal, opaque_types));
2048 let typing_mode = delegate.typing_mode_raw().assert_not_erased();
2049
2050 let (orig_values, canonical_goal) =
2051 canonicalize_goal(delegate, goal, &opaque_types, typing_mode.into());
2052
2053 let (canonical_result, final_revision, required_depth) =
2054 delegate.cx().evaluate_root_goal_for_proof_tree_raw(canonical_goal, root_depth);
2055
2056 let proof_tree = inspect::GoalEvaluation {
2057 uncanonicalized_goal: goal,
2058 orig_values,
2059 final_revision,
2060 result: canonical_result,
2061 required_depth,
2062 };
2063
2064 let response = match canonical_result {
2065 Err(e) => return (Err(e), proof_tree),
2066 Ok(response) => response,
2067 };
2068
2069 let (normalization_nested_goals, _certainty) = instantiate_and_apply_query_response(
2070 delegate,
2071 &proof_tree.orig_values,
2072 response,
2073 origin_span,
2074 );
2075
2076 (Ok(normalization_nested_goals), proof_tree)
2077}