1use std::mem;
2use std::ops::ControlFlow;
3
4#[cfg(feature = "nightly")]
5use rustc_macros::StableHash;
6use rustc_type_ir::data_structures::HashSet;
7use rustc_type_ir::inherent::*;
8use rustc_type_ir::region_constraint::RegionConstraint;
9use rustc_type_ir::relate::Relate;
10use rustc_type_ir::relate::solver_relating::RelateExt;
11use rustc_type_ir::search_graph::{
12 CandidateHeadUsages, LowerAvailableDepth, PathKind, RequiredDepth,
13};
14use rustc_type_ir::solve::{
15 AccessedOpaques, ExternalRegionConstraints, FetchEligibleAssocItemResponse, MaybeInfo,
16 NoSolutionOrRerunNonErased, OpaqueTypesJank, QueryResultOrRerunNonErased, RerunCondition,
17 RerunNonErased, RerunReason, RerunResultExt, SmallCopySet, TyOrConstInferVar,
18};
19use rustc_type_ir::transmute::Answer;
20use rustc_type_ir::{
21 self as ty, CanonicalQueryInput, ClauseKind, Const, InferCtxtLike, Interner, MayBeErased,
22 OpaqueTypeKey, PredicateKind, PredicateProxy, Region, RegionVid, TypeFoldable,
23 TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, TypingMode,
24 TypingModeEqWrapper, max_universe,
25};
26use thin_vec::ThinVec;
27use tracing::{Level, debug, instrument, trace, warn};
28
29use super::has_only_region_constraints;
30use crate::canonical::{
31 canonicalize_goal, canonicalize_response, instantiate_and_apply_query_response,
32 response_no_constraints_raw,
33};
34use crate::coherence;
35use crate::delegate::SolverDelegate;
36use crate::normalize::{NormalizationFolder, NormalizationWasAmbiguous};
37use crate::placeholder::BoundVarReplacer;
38use crate::solve::eval_ctxt::fast_path::{
39 RerunStalled, compute_goal_fast_path, inlined_rerunning_stalled_goal_may_make_progress,
40 rerunning_stalled_goal_may_make_progress,
41};
42use crate::solve::fast_path::compute_goal_fast_path_cold;
43use crate::solve::search_graph::SearchGraph;
44use crate::solve::ty::may_use_unstable_feature;
45use crate::solve::{
46 CanonicalResponse, Certainty, ExternalConstraintsData, FIXPOINT_STEP_LIMIT, Goal,
47 GoalEvaluation, GoalSource, GoalStalledOn, GoalStalledOnOpaques, HasChanged, IsIdentity,
48 MaybeCause, NestedNormalizationGoals, NoSolution, QueryInput, QueryResult, Response,
49 SucceededInErased, VisibleForLeakCheck, inspect,
50};
51
52pub mod fast_path;
53mod probe;
54mod solver_region_constraints;
55
56#[derive(#[automatically_derived]impl ::core::fmt::Debug for CurrentGoalKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
CurrentGoalKind::Misc => "Misc",
CurrentGoalKind::CoinductiveTrait => "CoinductiveTrait",
CurrentGoalKind::Projection => "Projection",
CurrentGoalKind::ProjectionComputeAssocTermCandidate =>
"ProjectionComputeAssocTermCandidate",
})
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for CurrentGoalKind { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for CurrentGoalKind {
}
#[automatically_derived]impl ::core::clone::Clone for CurrentGoalKind {
#[inline]
fn clone(&self) -> Self { *self }
}Clone)]
61enum CurrentGoalKind {
62 Misc,
63 CoinductiveTrait,
68 Projection,
70 ProjectionComputeAssocTermCandidate,
84}
85
86impl CurrentGoalKind {
87 fn from_query_input<I: Interner>(cx: I, input: QueryInput<I, I::Predicate>) -> CurrentGoalKind {
88 match input.goal.predicate.kind().skip_binder() {
89 ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
90 if cx.trait_is_coinductive(pred.trait_ref.def_id) {
91 CurrentGoalKind::CoinductiveTrait
92 } else {
93 CurrentGoalKind::Misc
94 }
95 }
96 ty::PredicateKind::Clause(ty::ClauseKind::Projection(_)) => CurrentGoalKind::Projection,
97 ty::PredicateKind::NormalizesTo(_) => {
98 CurrentGoalKind::ProjectionComputeAssocTermCandidate
99 }
100 _ => CurrentGoalKind::Misc,
101 }
102 }
103}
104
105pub struct EvalCtxt<'a, D, I = <D as SolverDelegate>::Interner>
106where
107 D: SolverDelegate<Interner = I>,
108 I: Interner,
109{
110 delegate: &'a D,
126
127 var_kinds: I::CanonicalVarKinds,
130
131 current_goal_kind: CurrentGoalKind,
134 pub(super) var_values: I::GenericArgs,
135
136 pub(super) max_input_universe: ty::UniverseIndex,
146 pub(super) initial_opaque_types_storage_num_entries:
149 <D::Infcx as InferCtxtLike>::OpaqueTypeStorageEntries,
150
151 pub(super) search_graph: &'a mut SearchGraph<D>,
152
153 nested_goals: Vec<(GoalSource, Goal<I, I::Predicate>, Option<GoalStalledOn<I>>)>,
154
155 pub(super) origin_span: I::Span,
156
157 tainted: Result<(), NoSolution>,
164
165 pub(super) opaque_accesses: AccessedOpaques<I>,
167
168 pub(super) inspect: inspect::EvaluationStepBuilder<D>,
169}
170
171#[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)]
172#[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) {
match *self {
GenerateProofTree::Yes => 0u8.stable_hash(__hcx, __hasher),
GenerateProofTree::No => 1u8.stable_hash(__hcx, __hasher),
}
match *self {
GenerateProofTree::Yes => {}
GenerateProofTree::No => {}
}
}
}
};StableHash))]
173pub enum GenerateProofTree {
174 Yes,
175 No,
176}
177
178pub trait SolverDelegateEvalExt: SolverDelegate {
179 fn evaluate_root_goal(
184 &self,
185 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
186 span: <Self::Interner as Interner>::Span,
187 stalled_on: Option<GoalStalledOn<Self::Interner>>,
188 ) -> Result<GoalEvaluation<Self::Interner>, NoSolution>;
189
190 fn goal_remains_stalled(&self, stalled_on: &GoalStalledOn<Self::Interner>) -> bool;
193
194 fn root_goal_may_hold_opaque_types_jank(
199 &self,
200 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
201 ) -> bool;
202
203 fn root_goal_may_hold_with_depth(
211 &self,
212 root_depth: usize,
213 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
214 ) -> bool;
215
216 fn evaluate_root_goal_for_proof_tree(
219 &self,
220 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
221 span: <Self::Interner as Interner>::Span,
222 ) -> (
223 Result<NestedNormalizationGoals<Self::Interner>, NoSolution>,
224 inspect::GoalEvaluation<Self::Interner>,
225 );
226}
227
228impl<D, I> SolverDelegateEvalExt for D
229where
230 D: SolverDelegate<Interner = I>,
231 I: Interner,
232{
233 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(233u32),
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:233",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(233u32),
::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)]
234 fn evaluate_root_goal(
235 &self,
236 goal: Goal<I, I::Predicate>,
237 span: I::Span,
238 stalled_on: Option<GoalStalledOn<I>>,
239 ) -> Result<GoalEvaluation<I>, NoSolution> {
240 if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
242 rerunning_stalled_goal_may_make_progress(self, stalled_on.as_ref())
243 {
244 return Ok(GoalEvaluation {
245 goal,
246 certainty: Certainty::Maybe(stalled_maybe_info),
247 has_changed: HasChanged::No,
248 stalled_on,
249 });
250 }
251
252 if stalled_on.is_some()
256 && let Some(res) = compute_goal_fast_path_cold(self, goal, span)
257 {
258 return Ok(res);
259 }
260
261 let mut result = EvalCtxt::enter_root(self, self.cx().recursion_limit(), span, |ecx| {
262 ecx.evaluate_goal_no_fast_paths(GoalSource::Misc, goal)
263 });
264 maybe_evaluate_root_goal_with_higher_recursion_limit(self, goal, span, &mut result);
265
266 match result {
267 Ok(i) => Ok(i),
268 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
269 Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
270 unreachable!("this never happens at the root, we're never in erased mode here");
271 }
272 }
273 }
274
275 #[inline(always)]
277 fn goal_remains_stalled(&self, stalled_on: &GoalStalledOn<Self::Interner>) -> bool {
278 match inlined_rerunning_stalled_goal_may_make_progress(self, Some(stalled_on)) {
279 RerunStalled::WontMakeProgress(_) => true,
280 RerunStalled::MayMakeProgress => false,
281 }
282 }
283
284 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(284u32),
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:284",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(284u32),
::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)]
285 fn root_goal_may_hold_opaque_types_jank(
286 &self,
287 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
288 ) -> bool {
289 self.probe(|| {
290 self.evaluate_root_goal(goal, I::Span::dummy(), None).is_ok_and(|r| match r.certainty {
291 Certainty::Yes => true,
292 Certainty::Maybe(MaybeInfo {
293 cause: _,
294 opaque_types_jank,
295 stalled_on_coroutines: _,
296 }) => match opaque_types_jank {
297 OpaqueTypesJank::AllGood => true,
298 OpaqueTypesJank::ErrorIfRigidSelfTy => false,
299 },
300 })
301 })
302 }
303
304 fn root_goal_may_hold_with_depth(
305 &self,
306 root_depth: usize,
307 goal: Goal<Self::Interner, <Self::Interner as Interner>::Predicate>,
308 ) -> bool {
309 self.probe(|| {
310 EvalCtxt::enter_root(self, root_depth, I::Span::dummy(), |ecx| {
311 ecx.evaluate_goal(GoalSource::Misc, goal, None)
312 })
313 })
314 .is_ok()
315 }
316
317 {}
#[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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(317u32),
::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))]
318 fn evaluate_root_goal_for_proof_tree(
319 &self,
320 goal: Goal<I, I::Predicate>,
321 span: I::Span,
322 ) -> (Result<NestedNormalizationGoals<I>, NoSolution>, inspect::GoalEvaluation<I>) {
323 let mut result =
324 evaluate_root_goal_for_proof_tree(self, goal, span, self.cx().recursion_limit());
325 maybe_evaluate_root_goal_for_proof_tree_with_higher_recursion_limit(
326 self,
327 goal,
328 span,
329 &mut result,
330 );
331 result
332 }
333}
334
335fn maybe_evaluate_root_goal_with_higher_recursion_limit<D, I>(
341 delegate: &D,
342 goal: Goal<I, I::Predicate>,
343 span: I::Span,
344 initial_result: &mut Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased>,
345) where
346 D: SolverDelegate<Interner = I>,
347 I: Interner,
348{
349 if !delegate.enable_next_solver_overflow_fcw() {
350 return;
351 }
352
353 let predicate = match initial_result {
354 Err(_) => return,
355 Ok(goal_evaluation) if !goal_evaluation.certainty.is_overflow() => return,
356 Ok(goal_evaluation) => goal_evaluation.goal.predicate,
357 };
358
359 let rerun_result = delegate.commit_if_ok(|| {
360 let rerun_result =
361 EvalCtxt::enter_root(delegate, delegate.cx().recursion_limit() * 2, span, |ecx| {
362 ecx.evaluate_goal_no_fast_paths(GoalSource::Misc, goal)
363 });
364
365 if rerun_result.as_ref().is_ok_and(|evaluation| evaluation.certainty.is_overflow()) {
366 Err(())
367 } else {
368 Ok(rerun_result)
369 }
370 });
371 if let Ok(rerun_result) = rerun_result {
372 delegate.emit_next_solver_overflow_fcw(goal.with(delegate.cx(), predicate), span);
373 *initial_result = rerun_result;
374 }
375}
376
377fn maybe_evaluate_root_goal_for_proof_tree_with_higher_recursion_limit<D, I>(
383 delegate: &D,
384 goal: Goal<I, I::Predicate>,
385 span: I::Span,
386 initial_result: &mut (
387 Result<NestedNormalizationGoals<I>, NoSolution>,
388 inspect::GoalEvaluation<I>,
389 ),
390) where
391 D: SolverDelegate<Interner = I>,
392 I: Interner,
393{
394 if !delegate.enable_next_solver_overflow_fcw() {
395 return;
396 }
397
398 let goal_evaluation = &initial_result.1;
399 match goal_evaluation.result {
400 Err(_) => return,
401 Ok(response) if !response.value.certainty.is_overflow() => return,
402 Ok(_) => {}
403 }
404
405 let rerun_result = delegate.commit_if_ok(|| {
406 let (new_result, new_goal_evaluation) = evaluate_root_goal_for_proof_tree(
407 delegate,
408 goal,
409 span,
410 delegate.cx().recursion_limit() * 2,
411 );
412
413 if new_goal_evaluation.result.is_ok_and(|response| response.value.certainty.is_overflow()) {
414 Err(())
415 } else {
416 Ok((new_result, new_goal_evaluation))
417 }
418 });
419 if let Ok(rerun_result) = rerun_result {
420 let predicate: I::Predicate = goal_evaluation.uncanonicalized_goal.predicate;
421 delegate.emit_next_solver_overflow_fcw(goal.with(delegate.cx(), predicate), span);
422 *initial_result = rerun_result;
423 }
424}
425
426impl<'a, D, I> EvalCtxt<'a, D>
427where
428 D: SolverDelegate<Interner = I>,
429 I: Interner,
430{
431 pub(super) fn typing_mode(&self) -> TypingMode<I> {
432 self.delegate.typing_mode_raw()
433 }
434
435 pub(super) fn step_kind_to_nested(&self, _source: GoalSource) -> PathKind {
446 match self.current_goal_kind {
447 CurrentGoalKind::CoinductiveTrait => PathKind::Coinductive,
450 CurrentGoalKind::ProjectionComputeAssocTermCandidate | CurrentGoalKind::Projection => {
453 PathKind::Unknown
454 }
455 CurrentGoalKind::Misc => PathKind::ForcedAmbiguity,
459 }
460 }
461
462 pub(super) fn enter_root<R>(
466 delegate: &D,
467 root_depth: usize,
468 origin_span: I::Span,
469 f: impl FnOnce(&mut EvalCtxt<'_, D>) -> R,
470 ) -> R {
471 let mut search_graph = SearchGraph::new(root_depth);
472
473 let mut ecx = EvalCtxt {
474 delegate,
475 search_graph: &mut search_graph,
476 nested_goals: Default::default(),
477 inspect: inspect::EvaluationStepBuilder::new_noop(),
478
479 max_input_universe: ty::UniverseIndex::ROOT,
482 initial_opaque_types_storage_num_entries: Default::default(),
483 var_kinds: Default::default(),
484 var_values: Default::default(),
485 current_goal_kind: CurrentGoalKind::Misc,
486 origin_span,
487 tainted: Ok(()),
488 opaque_accesses: AccessedOpaques::default(),
489 };
490 let result = f(&mut ecx);
491 if !ecx.nested_goals.is_empty() {
{
::core::panicking::panic_fmt(format_args!("root `EvalCtxt` should not have any goals added to it"));
}
};assert!(
492 ecx.nested_goals.is_empty(),
493 "root `EvalCtxt` should not have any goals added to it"
494 );
495 if !!ecx.opaque_accesses.might_rerun() {
::core::panicking::panic("assertion failed: !ecx.opaque_accesses.might_rerun()")
};assert!(!ecx.opaque_accesses.might_rerun());
496 if !search_graph.is_empty() {
::core::panicking::panic("assertion failed: search_graph.is_empty()")
};assert!(search_graph.is_empty());
497 result
498 }
499
500 pub(super) fn enter_canonical<T>(
508 cx: I,
509 search_graph: &'a mut SearchGraph<D>,
510 canonical_input: I::CanonicalInput,
511 proof_tree_builder: &mut inspect::ProofTreeBuilder<D>,
512 f: impl FnOnce(
513 &mut EvalCtxt<'_, D>,
514 Goal<I, I::Predicate>,
515 ) -> Result<T, NoSolutionOrRerunNonErased>,
516 ) -> (Result<T, NoSolution>, AccessedOpaques<I>) {
517 let (ref delegate, input, var_values) = D::build_with_canonical(cx, &canonical_input);
518 let var_values = var_values.var_values;
519 for (key, ty) in input.predefined_opaques_in_body.iter() {
520 let prev = delegate.register_hidden_type_in_storage(key, ty, I::Span::dummy());
521 if let Some(prev) = prev {
533 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:533",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(533u32),
::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`");
534 }
535 }
536
537 let initial_opaque_types_storage_num_entries = delegate.opaque_types_storage_num_entries();
538 if truecfg!(debug_assertions) && delegate.typing_mode_raw().is_erased_not_coherence() {
539 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());
540 }
541
542 let mut ecx = EvalCtxt {
543 delegate,
544 var_kinds: canonical_input.canonical.var_kinds,
545 var_values,
546 current_goal_kind: CurrentGoalKind::from_query_input(cx, input),
547 max_input_universe: canonical_input.canonical.max_universe,
548 initial_opaque_types_storage_num_entries,
549 search_graph,
550 nested_goals: Default::default(),
551 origin_span: I::Span::dummy(),
552 tainted: Ok(()),
553 inspect: proof_tree_builder.new_evaluation_step(var_values),
554 opaque_accesses: AccessedOpaques::default(),
555 };
556
557 let result = f(&mut ecx, input.goal);
558 ecx.inspect.probe_final_state(ecx.delegate, ecx.max_input_universe);
559 proof_tree_builder.finish_evaluation_step(ecx.inspect);
560
561 if canonical_input.typing_mode.0.is_erased_not_coherence() {
562 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());
563 }
564
565 delegate.reset_opaque_types();
571
572 let opaque_accesses = ecx.opaque_accesses;
573 (
574 match result {
575 Ok(i) => Ok(i),
576 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Err(NoSolution),
577 Err(NoSolutionOrRerunNonErased::RerunNonErased(_)) => {
578 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());
580 Err(NoSolution)
581 }
582 },
583 opaque_accesses,
584 )
585 }
586
587 pub(super) fn responses_equal_modulo_region_constraints(
590 &self,
591 a: &CanonicalResponse<I>,
592 b: &CanonicalResponse<I>,
593 ) -> bool {
594 if a == b {
595 return true;
596 }
597
598 if true {
if !a.value.external_constraints.region_constraints.is_empty() {
::core::panicking::panic("assertion failed: a.value.external_constraints.region_constraints.is_empty()")
};
};debug_assert!(a.value.external_constraints.region_constraints.is_empty());
601
602 let cx: I = self.cx();
610 let input: CanonicalQueryInput<I, Response<I>> = CanonicalQueryInput {
611 canonical: b.clone(),
612 typing_mode: TypingModeEqWrapper(self.typing_mode()),
613 };
614 let (ref delegate, instantiated_response, _) = D::build_with_canonical(cx, &input);
615 let Response { certainty, var_values, var_values_is_identity, external_constraints } =
616 instantiated_response;
617 let ExternalConstraintsData {
618 region_constraints: _,
619 opaque_types,
620 normalization_nested_goals,
621 } = &*external_constraints;
622 let b_no_regions = canonicalize_response(
623 delegate,
624 ty::UniverseIndex::ROOT,
625 Response {
626 certainty,
627 var_values,
628 var_values_is_identity,
629 external_constraints: self.cx().mk_external_constraints(ExternalConstraintsData {
630 region_constraints: match cx.assumptions_on_binders() {
631 true => ExternalRegionConstraints::NextGen(RegionConstraint::new_true()),
632 false => ExternalRegionConstraints::Old(::alloc::vec::Vec::new()vec![]),
633 },
634 opaque_types: opaque_types.clone(),
635 normalization_nested_goals: normalization_nested_goals.clone(),
636 }),
637 },
638 );
639
640 a == &b_no_regions
641 }
642
643 pub(super) fn ignore_candidate_head_usages(&mut self, usages: CandidateHeadUsages) {
644 self.search_graph.ignore_candidate_head_usages(usages);
645 }
646
647 fn evaluate_goal(
650 &mut self,
651 source: GoalSource,
652 goal: Goal<I, I::Predicate>,
653 stalled_on: Option<GoalStalledOn<I>>,
654 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
655 if let RerunStalled::WontMakeProgress(stalled_maybe_info) =
656 rerunning_stalled_goal_may_make_progress(self.delegate, stalled_on.as_ref())
657 {
658 return Ok(GoalEvaluation {
659 goal,
660 certainty: Certainty::Maybe(stalled_maybe_info),
661 has_changed: HasChanged::No,
662 stalled_on,
663 });
664 }
665
666 if stalled_on.is_some()
670 && let Some(res) = compute_goal_fast_path_cold(self.delegate, goal, self.origin_span)
671 {
672 return Ok(res);
673 }
674
675 self.evaluate_goal_no_fast_paths(source, goal)
676 }
677
678 #[cold]
680 #[inline(never)]
681 fn evaluate_goal_no_fast_paths(
682 &mut self,
683 source: GoalSource,
684 goal: Goal<I, I::Predicate>,
685 ) -> Result<GoalEvaluation<I>, NoSolutionOrRerunNonErased> {
686 let (normalization_nested_goals, goal_evaluation) = self.evaluate_goal_raw(source, goal)?;
687 if !normalization_nested_goals.is_empty() {
::core::panicking::panic("assertion failed: normalization_nested_goals.is_empty()")
};assert!(normalization_nested_goals.is_empty());
688 Ok(goal_evaluation)
689 }
690
691 fn evaluate_in_search_graph(
692 &mut self,
693 canonical_goal: I::CanonicalInput,
694 step_kind: PathKind,
695 ) -> (Result<CanonicalResponse<I>, NoSolution>, AccessedOpaques<I>) {
696 let increase_depth_for_nested =
697 match canonical_goal.canonical.value.goal.predicate.kind().skip_binder() {
698 ty::PredicateKind::NormalizesTo(_) => LowerAvailableDepth::No,
704 ty::PredicateKind::Clause(ty::ClauseKind::Trait(pred)) => {
713 if self.cx().trait_is_auto(pred.trait_ref.def_id) {
714 match pred.self_ty().kind() {
715 ty::CoroutineWitness(..) => LowerAvailableDepth::No,
716 ty::Alias(
717 ty::IsRigid::Yes,
718 ty::AliasTy { kind: ty::Opaque { def_id, .. }, .. },
719 ) => {
720 if self
728 .cx()
729 .item_self_bounds(def_id.into())
730 .skip_binder()
731 .into_iter()
732 .any(|bound| {
733 bound
734 .as_trait_clause()
735 .is_some_and(|b| b.def_id() == pred.def_id())
736 })
737 {
738 LowerAvailableDepth::Yes
739 } else {
740 LowerAvailableDepth::No
741 }
742 }
743 ty::Bool
744 | ty::Char
745 | ty::Int(..)
746 | ty::Uint(..)
747 | ty::Float(..)
748 | ty::Str
749 | ty::Pat(..)
750 | ty::FnPtr(..)
751 | ty::Array(..)
752 | ty::Slice(..)
753 | ty::RawPtr(..)
754 | ty::Never
755 | ty::Tuple(..)
756 | ty::UnsafeBinder(_)
757 | ty::Param(..)
758 | ty::Placeholder(..)
759 | ty::Bound(..)
760 | ty::Infer(..)
761 | ty::Alias(_, _)
762 | ty::Ref(_, _, _)
763 | ty::Adt(_, _)
764 | ty::Foreign(_)
765 | ty::Dynamic(..)
766 | ty::Error(_)
767 | ty::FnDef(..)
768 | ty::Closure(..)
769 | ty::CoroutineClosure(..)
770 | ty::Coroutine(..) => LowerAvailableDepth::Yes,
771 }
772 } else {
773 LowerAvailableDepth::Yes
774 }
775 }
776 ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(_))
777 | ty::PredicateKind::Clause(ty::ClauseKind::Projection(_))
778 | ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(_))
779 | ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(_))
780 | ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(_, _))
781 | ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(_))
782 | ty::PredicateKind::Subtype(_)
783 | ty::PredicateKind::Coerce(_)
784 | ty::PredicateKind::DynCompatible(_)
785 | ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_))
786 | ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(_))
787 | ty::PredicateKind::ConstEquate(_, _)
788 | ty::PredicateKind::Ambiguous => LowerAvailableDepth::Yes,
789 };
790 self.search_graph.evaluate_goal(
791 self.cx(),
792 canonical_goal,
793 step_kind,
794 increase_depth_for_nested,
795 &mut inspect::ProofTreeBuilder::new_noop(),
796 )
797 }
798
799 pub(super) fn evaluate_goal_raw(
807 &mut self,
808 source: GoalSource,
809 goal: Goal<I, I::Predicate>,
810 ) -> Result<(NestedNormalizationGoals<I>, GoalEvaluation<I>), NoSolutionOrRerunNonErased> {
811 let opaque_types = self.delegate.clone_opaque_types_lookup_table();
815
816 let (goal, opaque_types) =
817 self.delegate.deeply_resolve_via_unification_table((goal, opaque_types));
818 let typing_mode = self.typing_mode();
819 let step_kind = self.step_kind_to_nested(source);
820
821 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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(821u32),
::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!(
822 Level::DEBUG,
823 "evaluate_goal_raw in typing mode",
824 "{:?} opaques={:?}",
825 typing_mode,
826 opaque_types
827 )
828 .entered();
829
830 let (result, orig_values, canonical_goal, succeeded_in_erased) = 'retry_canonicalize: {
831 let skip_erased_attempt = match typing_mode {
832 TypingMode::Reflection | TypingMode::Coherence => true,
833 TypingMode::Typeck { .. }
834 | TypingMode::PostTypeckThroughBorrowck { .. }
835 | TypingMode::PostBorrowck { .. }
836 | TypingMode::Codegen
837 | TypingMode::PostAnalysis
838 | TypingMode::ErasedNotCoherence(_) => {
839 let mut skip = false;
840 if opaque_types.iter().any(|(_, ty)| ty.is_ty_var())
841 && let PredicateKind::Clause(ClauseKind::Trait(..)) =
842 goal.predicate.kind().skip_binder()
843 {
844 skip = true;
845 }
846
847 if let PredicateKind::Clause(ClauseKind::Trait(tr)) =
848 goal.predicate.kind().skip_binder()
849 && tr.self_ty().has_coroutines()
850 && self.cx().trait_is_auto(tr.trait_ref.def_id)
851 {
852 }
856
857 skip
858 }
859 };
860
861 if skip_erased_attempt {
862 if typing_mode.is_erased_not_coherence() {
863 match self.opaque_accesses.rerun_always(RerunReason::SkipErasedAttempt)? {}
864 } else {
865 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:865",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(865u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["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");
866 }
867 } else {
868 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:868",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(868u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&["message"],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("trying without opaques: {0:?}",
goal) as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!("trying without opaques: {goal:?}");
869
870 let (orig_values, canonical_goal) = canonicalize_goal(
871 self.delegate,
872 goal,
873 &[],
874 TypingMode::ErasedNotCoherence(MayBeErased),
875 );
876
877 let (canonical_result, accessed_opaques) =
878 self.evaluate_in_search_graph(canonical_goal, step_kind);
879
880 let should_rerun = should_rerun_after_erased_canonicalization(
881 accessed_opaques,
882 self.typing_mode(),
883 &opaque_types,
884 );
885 match should_rerun {
886 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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:886",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(886u32),
::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"),
887 RerunDecision::No => {
888 break 'retry_canonicalize (
889 canonical_result,
890 orig_values,
891 canonical_goal,
892 SucceededInErased::Yes { accessed_opaques },
893 );
894 }
895 RerunDecision::EagerlyPropagateToParent => {
896 self.opaque_accesses.update(accessed_opaques)?;
897 break 'retry_canonicalize (
898 canonical_result,
899 orig_values,
900 canonical_goal,
901 SucceededInErased::No,
904 );
905 }
906 }
907 }
908
909 let (orig_values, canonical_goal) =
910 canonicalize_goal(self.delegate, goal, &opaque_types, typing_mode);
911
912 let (canonical_result, accessed_opaques) =
913 self.evaluate_in_search_graph(canonical_goal, step_kind);
914 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!(
915 !accessed_opaques.might_rerun(),
916 "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:?}"
917 );
918
919 (canonical_result, orig_values, canonical_goal, SucceededInErased::No)
920 };
921
922 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:922",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(922u32),
::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);
923 let response = match result {
924 Ok(response) => {
925 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:925",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(925u32),
::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");
926 response
927 }
928 Err(NoSolution) => {
929 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:929",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(929u32),
::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");
930 return Err(NoSolution.into());
931 }
932 };
933
934 drop(tracing_span);
935
936 let has_changed =
937 if !has_only_region_constraints(response) { HasChanged::Yes } else { HasChanged::No };
938
939 let (normalization_nested_goals, certainty) = instantiate_and_apply_query_response(
940 self.delegate,
941 &orig_values,
942 response,
943 canonical_goal.canonical.var_kinds,
944 self.origin_span,
945 );
946
947 let stalled_on = match certainty {
958 Certainty::Yes => None,
959 Certainty::Maybe(maybe_info) => match has_changed {
960 HasChanged::Yes => None,
965 HasChanged::No => Some(self.build_stalled_on(
966 canonical_goal,
967 maybe_info,
968 orig_values,
969 succeeded_in_erased,
970 )),
971 },
972 };
973
974 Ok((
975 normalization_nested_goals,
976 GoalEvaluation { goal, certainty, has_changed, stalled_on },
977 ))
978 }
979
980 fn build_stalled_on(
981 &self,
982 canonical_goal: I::CanonicalInput,
983 maybe_info: MaybeInfo,
984 stalled_vars: Vec<I::GenericArg>,
985 previously_succeeded_in_erased: SucceededInErased<I>,
986 ) -> GoalStalledOn<I> {
987 let mut sub_roots = ThinVec::new();
989 let stalled_vars = stalled_vars
990 .into_iter()
991 .filter_map(|arg| match arg.kind() {
992 ty::GenericArgKind::Lifetime(_) => None,
994 ty::GenericArgKind::Type(ty) => match ty.kind() {
995 ty::Infer(ty::TyVar(vid)) => {
996 sub_roots.push(self.delegate.sub_unification_table_root_var(vid));
997 Some(TyOrConstInferVar::Ty(vid))
998 }
999 ty::Infer(ty::IntVar(vid)) => Some(TyOrConstInferVar::TyInt(vid)),
1000 ty::Infer(ty::FloatVar(vid)) => Some(TyOrConstInferVar::TyFloat(vid)),
1001 ty::Param(_) | ty::Placeholder(_) => None,
1002 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ty)));
}unreachable!("unexpected orig_value: {ty:?}"),
1003 },
1004 ty::GenericArgKind::Const(ct) => match ct.kind() {
1005 ty::ConstKind::Infer(ty::InferConst::Var(v)) => {
1006 Some(TyOrConstInferVar::Const(v))
1007 }
1008 ty::ConstKind::Param(_) | ty::ConstKind::Placeholder(_) => None,
1009 _ => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected orig_value: {0:?}", ct)));
}unreachable!("unexpected orig_value: {ct:?}"),
1010 },
1011 })
1012 .collect();
1013
1014 GoalStalledOn {
1015 stalled_vars,
1016 sub_roots,
1017 stalled_maybe_info: maybe_info,
1018 opaques: GoalStalledOnOpaques::Yes {
1019 num_opaques_in_storage: canonical_goal
1020 .canonical
1021 .value
1022 .predefined_opaques_in_body
1023 .len(),
1024 previously_succeeded_in_erased,
1025 },
1026 }
1027 }
1028
1029 pub(super) fn compute_goal(
1030 &mut self,
1031 goal: Goal<I, I::Predicate>,
1032 ) -> QueryResultOrRerunNonErased<I> {
1033 let Goal { param_env, predicate } = goal;
1034 let kind = predicate.kind();
1035 self.enter_forall_with_assumptions(kind, param_env, |ecx, kind| {
1036 Ok(match kind {
1037 ty::PredicateKind::Clause(ty::ClauseKind::Trait(predicate)) => {
1038 ecx.compute_trait_goal(Goal { param_env, predicate }).map(|(r, _via)| r)?
1039 }
1040 ty::PredicateKind::Clause(ty::ClauseKind::HostEffect(predicate)) => {
1041 ecx.compute_host_effect_goal(Goal { param_env, predicate })?
1042 }
1043 ty::PredicateKind::Clause(ty::ClauseKind::Projection(predicate)) => {
1044 ecx.compute_projection_goal(Goal { param_env, predicate })?
1045 }
1046 ty::PredicateKind::Clause(ty::ClauseKind::TypeOutlives(predicate)) => {
1047 ecx.compute_type_outlives_goal(Goal { param_env, predicate })?
1048 }
1049 ty::PredicateKind::Clause(ty::ClauseKind::RegionOutlives(predicate)) => {
1050 ecx.compute_region_outlives_goal(Goal { param_env, predicate })?
1051 }
1052 ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
1053 ecx.compute_const_arg_has_type_goal(Goal { param_env, predicate: (ct, ty) })?
1054 }
1055 ty::PredicateKind::Clause(ty::ClauseKind::UnstableFeature(symbol)) => {
1056 ecx.compute_unstable_feature_goal(param_env, symbol)?
1057 }
1058 ty::PredicateKind::Subtype(predicate) => {
1059 ecx.compute_subtype_goal(Goal { param_env, predicate })?
1060 }
1061 ty::PredicateKind::Coerce(predicate) => {
1062 ecx.compute_coerce_goal(Goal { param_env, predicate })?
1063 }
1064 ty::PredicateKind::DynCompatible(trait_def_id) => {
1065 ecx.compute_dyn_compatible_goal(trait_def_id)?
1066 }
1067 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(term)) => {
1068 ecx.compute_well_formed_goal(Goal { param_env, predicate: term })?
1069 }
1070 ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(ct)) => {
1071 ecx.compute_const_evaluatable_goal(Goal { param_env, predicate: ct })?
1072 }
1073 ty::PredicateKind::ConstEquate(_, _) => {
1074 {
::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")
1075 }
1076 ty::PredicateKind::NormalizesTo(predicate) => {
1077 ecx.compute_normalizes_to_goal(Goal { param_env, predicate })?
1078 }
1079 ty::PredicateKind::Ambiguous => {
1080 ecx.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)?
1081 }
1082 })
1083 })
1084 }
1085
1086 {}
#[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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1088u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[],
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1103",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1103u32),
::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))]
1089 pub(super) fn try_evaluate_added_goals(
1090 &mut self,
1091 ) -> Result<Certainty, NoSolutionOrRerunNonErased> {
1092 for _ in 0..FIXPOINT_STEP_LIMIT {
1093 match self.evaluate_added_goals_step().map_err_to_rerun()? {
1094 Ok(None) => {}
1095 Ok(Some(cert)) => return Ok(cert),
1096 Err(NoSolution) => {
1097 self.tainted = Err(NoSolution);
1098 return Err(NoSolution.into());
1099 }
1100 }
1101 }
1102
1103 debug!("try_evaluate_added_goals: encountered overflow");
1104 Ok(Certainty::overflow(false))
1105 }
1106
1107 fn evaluate_added_goals_step(
1111 &mut self,
1112 ) -> Result<Option<Certainty>, NoSolutionOrRerunNonErased> {
1113 let mut unchanged_certainty = Some(Certainty::Yes);
1115 for (source, goal, stalled_on) in mem::take(&mut self.nested_goals) {
1119 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!(
1121 goal.predicate.kind().skip_binder(),
1122 PredicateKind::NormalizesTo(_)
1123 ));
1124
1125 let GoalEvaluation { goal, certainty, has_changed, stalled_on } =
1126 self.evaluate_goal(source, goal, stalled_on)?;
1127 if has_changed == HasChanged::Yes {
1128 unchanged_certainty = None;
1129 }
1130
1131 match certainty {
1132 Certainty::Yes => {}
1133 Certainty::Maybe { .. } => {
1134 self.nested_goals.push((source, goal, stalled_on));
1135 unchanged_certainty = unchanged_certainty.map(|c| c.and(certainty));
1136 }
1137 }
1138 }
1139
1140 Ok(unchanged_certainty)
1141 }
1142
1143 pub(crate) fn record_impl_args(&mut self, impl_args: I::GenericArgs) {
1145 self.inspect.record_impl_args(self.delegate, self.max_input_universe, impl_args)
1146 }
1147
1148 pub(super) fn cx(&self) -> I {
1149 self.delegate.cx()
1150 }
1151
1152 {}
#[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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1152u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("source")
}> =
::tracing::__macro_support::FieldName::new("source");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("goal")
}> =
::tracing::__macro_support::FieldName::new("goal");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::DEBUG <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::DEBUG <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&source)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&goal)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<(), NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{
goal.predicate =
self.normalize(goal.param_env,
ty::Unnormalized::new_wip(goal.predicate))?;
self.inspect.add_goal(self.delegate, self.max_input_universe,
source, goal);
if let Some(GoalEvaluation {
goal, certainty, has_changed: _, stalled_on }) =
compute_goal_fast_path(self.delegate, goal,
self.origin_span) {
match certainty {
Certainty::Yes => {}
Certainty::Maybe(_) => {
self.nested_goals.push((source, goal, stalled_on));
}
}
} else { self.nested_goals.push((source, goal, None)); }
Ok(())
}
}
}#[instrument(level = "debug", skip(self))]
1153 pub(super) fn add_goal(
1154 &mut self,
1155 source: GoalSource,
1156 mut goal: Goal<I, I::Predicate>,
1157 ) -> Result<(), NoSolutionOrRerunNonErased> {
1158 goal.predicate =
1159 self.normalize(goal.param_env, ty::Unnormalized::new_wip(goal.predicate))?;
1160 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1161
1162 if let Some(GoalEvaluation { goal, certainty, has_changed: _, stalled_on }) =
1163 compute_goal_fast_path(self.delegate, goal, self.origin_span)
1164 {
1165 match certainty {
1166 Certainty::Yes => {}
1168 Certainty::Maybe(_) => {
1169 self.nested_goals.push((source, goal, stalled_on));
1170 }
1171 }
1172 } else {
1173 self.nested_goals.push((source, goal, None));
1174 }
1175 Ok(())
1176 }
1177
1178 {}
#[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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1178u32),
::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))]
1179 pub(super) fn add_goals(
1180 &mut self,
1181 source: GoalSource,
1182 goals: impl IntoIterator<Item = Goal<I, I::Predicate>>,
1183 ) -> Result<(), NoSolutionOrRerunNonErased> {
1184 for goal in goals {
1185 self.add_goal(source, goal)?;
1186 }
1187 Ok(())
1188 }
1189
1190 pub(super) fn next_region_var(&mut self) -> Region<I> {
1191 let region = self.delegate.next_region_infer();
1192 self.inspect.add_var_value(region);
1193 region
1194 }
1195
1196 pub(super) fn next_ty_infer(&mut self) -> I::Ty {
1197 let ty = self.delegate.next_ty_infer();
1198 self.inspect.add_var_value(ty);
1199 ty
1200 }
1201
1202 pub(super) fn next_const_infer(&mut self) -> Const<I> {
1203 let ct = self.delegate.next_const_infer();
1204 self.inspect.add_var_value(ct);
1205 ct
1206 }
1207
1208 pub(super) fn next_term_infer_of_alias_kind(
1211 &mut self,
1212 alias_term: ty::AliasTerm<I>,
1213 ) -> I::Term {
1214 match alias_term.kind {
1215 ty::AliasTermKind::ProjectionTy { .. }
1216 | ty::AliasTermKind::InherentTy { .. }
1217 | ty::AliasTermKind::OpaqueTy { .. }
1218 | ty::AliasTermKind::FreeTy { .. } => self.next_ty_infer().into(),
1219 ty::AliasTermKind::FreeConst { .. }
1220 | ty::AliasTermKind::InherentConstSelf { .. }
1221 | ty::AliasTermKind::InherentConstImpl { .. }
1222 | ty::AliasTermKind::AnonConst { .. }
1223 | ty::AliasTermKind::ProjectionConst { .. } => self.next_const_infer().into(),
1224 }
1225 }
1226
1227 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1231u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1231",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1231u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("return")
}> =
::tracing::__macro_support::FieldName::new("return");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::EVENT)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled =
::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
&&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{
let interest = __CALLSITE.interest();
!interest.is_never() &&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet|
{
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set);
;
})({
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
__CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&x)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
x;#[instrument(level = "trace", skip(self), ret)]
1232 pub(super) fn term_is_fully_unconstrained(&self, goal: Goal<I, ty::NormalizesTo<I>>) -> bool {
1233 let universe_of_term = match goal.predicate.term.kind() {
1234 ty::TermKind::Ty(ty) => {
1235 if let ty::Infer(ty::TyVar(vid)) = ty.kind() {
1236 self.delegate.universe_of_ty(vid).unwrap()
1237 } else {
1238 return false;
1239 }
1240 }
1241 ty::TermKind::Const(ct) => {
1242 if let ty::ConstKind::Infer(ty::InferConst::Var(vid)) = ct.kind() {
1243 self.delegate.universe_of_const(vid).unwrap()
1244 } else {
1245 return false;
1246 }
1247 }
1248 };
1249
1250 struct ContainsTermOrNotNameable<'a, D: SolverDelegate<Interner = I>, I: Interner> {
1251 term: I::Term,
1252 universe_of_term: ty::UniverseIndex,
1253 delegate: &'a D,
1254 cache: HashSet<I::Ty>,
1255 }
1256
1257 impl<D: SolverDelegate<Interner = I>, I: Interner> ContainsTermOrNotNameable<'_, D, I> {
1258 fn check_nameable(&self, universe: ty::UniverseIndex) -> ControlFlow<()> {
1259 if self.universe_of_term.can_name(universe) {
1260 ControlFlow::Continue(())
1261 } else {
1262 ControlFlow::Break(())
1263 }
1264 }
1265 }
1266
1267 impl<D: SolverDelegate<Interner = I>, I: Interner> TypeVisitor<I>
1268 for ContainsTermOrNotNameable<'_, D, I>
1269 {
1270 type Result = ControlFlow<()>;
1271 fn visit_ty(&mut self, t: I::Ty) -> Self::Result {
1272 if self.cache.contains(&t) {
1273 return ControlFlow::Continue(());
1274 }
1275
1276 match t.kind() {
1277 ty::Infer(ty::TyVar(vid)) => {
1278 if let ty::TermKind::Ty(term) = self.term.kind()
1279 && let ty::Infer(ty::TyVar(term_vid)) = term.kind()
1280 && self.delegate.root_ty_var(vid) == self.delegate.root_ty_var(term_vid)
1281 {
1282 return ControlFlow::Break(());
1283 }
1284
1285 self.check_nameable(self.delegate.universe_of_ty(vid).unwrap())?;
1286 }
1287 ty::Placeholder(p) => self.check_nameable(p.universe())?,
1288 _ => {
1289 if t.has_non_region_infer() || t.has_placeholders() {
1290 t.super_visit_with(self)?
1291 }
1292 }
1293 }
1294
1295 assert!(self.cache.insert(t));
1296 ControlFlow::Continue(())
1297 }
1298
1299 fn visit_const(&mut self, c: Const<I>) -> Self::Result {
1300 match c.kind() {
1301 ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
1302 if let ty::TermKind::Const(term) = self.term.kind()
1303 && let ty::ConstKind::Infer(ty::InferConst::Var(term_vid)) = term.kind()
1304 && self.delegate.root_const_var(vid)
1305 == self.delegate.root_const_var(term_vid)
1306 {
1307 return ControlFlow::Break(());
1308 }
1309
1310 self.check_nameable(self.delegate.universe_of_const(vid).unwrap())
1311 }
1312 ty::ConstKind::Placeholder(p) => self.check_nameable(p.universe()),
1313 _ => {
1314 if c.has_non_region_infer() || c.has_placeholders() {
1315 c.super_visit_with(self)
1316 } else {
1317 ControlFlow::Continue(())
1318 }
1319 }
1320 }
1321 }
1322
1323 fn visit_predicate<P: PredicateProxy<I>>(&mut self, p: P) -> Self::Result {
1324 if p.has_non_region_infer() || p.has_placeholders() {
1325 p.super_visit_with(self)
1326 } else {
1327 ControlFlow::Continue(())
1328 }
1329 }
1330
1331 fn visit_clauses(&mut self, c: I::Clauses) -> Self::Result {
1332 if c.has_non_region_infer() || c.has_placeholders() {
1333 c.super_visit_with(self)
1334 } else {
1335 ControlFlow::Continue(())
1336 }
1337 }
1338 }
1339
1340 let mut visitor = ContainsTermOrNotNameable {
1341 delegate: self.delegate,
1342 universe_of_term,
1343 term: goal.predicate.term,
1344 cache: Default::default(),
1345 };
1346 goal.predicate.alias.visit_with(&mut visitor).is_continue()
1347 && goal.param_env.visit_with(&mut visitor).is_continue()
1348 }
1349
1350 pub(super) fn sub_unify_ty_vids_raw(&self, a: ty::TyVid, b: ty::TyVid) {
1351 self.delegate.sub_unify_ty_vids_raw(a, b)
1352 }
1353
1354 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1354u32),
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1354",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1354u32),
::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)]
1355 pub(super) fn eq<T: Relate<I>>(
1356 &mut self,
1357 param_env: I::ParamEnv,
1358 lhs: T,
1359 rhs: T,
1360 ) -> Result<(), NoSolutionOrRerunNonErased> {
1361 self.relate(param_env, lhs, ty::Variance::Invariant, rhs)
1362 }
1363
1364 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1364u32),
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1364",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1364u32),
::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)]
1365 pub(super) fn sub<T: Relate<I>>(
1366 &mut self,
1367 param_env: I::ParamEnv,
1368 sub: T,
1369 sup: T,
1370 ) -> Result<(), NoSolutionOrRerunNonErased> {
1371 self.relate(param_env, sub, ty::Variance::Covariant, sup)
1372 }
1373
1374 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1374u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("lhs")
}> =
::tracing::__macro_support::FieldName::new("lhs");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("variance")
}> =
::tracing::__macro_support::FieldName::new("variance");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("rhs")
}> =
::tracing::__macro_support::FieldName::new("rhs");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&lhs)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&variance)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&rhs)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return:
Result<(), NoSolutionOrRerunNonErased> = loop {};
return __tracing_attr_fake_return;
}
{
let goals =
self.delegate.relate(param_env, lhs, variance, rhs,
self.origin_span)?;
for &goal in goals.iter() {
let source =
match goal.predicate.kind().skip_binder() {
ty::PredicateKind::Clause(ty::ClauseKind::Projection(..)) =>
{
GoalSource::Normalization
}
ty::PredicateKind::Subtype { .. } => GoalSource::Misc,
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) =>
GoalSource::Misc,
p => {
::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
format_args!("unexpected nested goal in `relate`: {0:?}",
p)));
}
};
self.add_goal(source, goal)?;
}
Ok(())
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1374",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1374u32),
::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)]
1375 pub(super) fn relate<T: Relate<I>>(
1376 &mut self,
1377 param_env: I::ParamEnv,
1378 lhs: T,
1379 variance: ty::Variance,
1380 rhs: T,
1381 ) -> Result<(), NoSolutionOrRerunNonErased> {
1382 let goals = self.delegate.relate(param_env, lhs, variance, rhs, self.origin_span)?;
1383 for &goal in goals.iter() {
1384 let source = match goal.predicate.kind().skip_binder() {
1385 ty::PredicateKind::Clause(ty::ClauseKind::Projection(..)) => {
1386 GoalSource::Normalization
1387 }
1388 ty::PredicateKind::Subtype { .. } => GoalSource::Misc,
1391 ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_)) => GoalSource::Misc,
1393 p => unreachable!("unexpected nested goal in `relate`: {p:?}"),
1394 };
1395 self.add_goal(source, goal)?;
1396 }
1397 Ok(())
1398 }
1399
1400 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1405u32),
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1405",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1405u32),
::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)]
1406 pub(super) fn eq_and_get_goals<T: Relate<I>>(
1407 &self,
1408 param_env: I::ParamEnv,
1409 lhs: T,
1410 rhs: T,
1411 ) -> Result<Vec<Goal<I, I::Predicate>>, NoSolution> {
1412 Ok(self.delegate.relate(param_env, lhs, ty::Variance::Invariant, rhs, self.origin_span)?)
1413 }
1414
1415 pub(super) fn instantiate_binder_with_infer<T: TypeFoldable<I> + Copy>(
1416 &self,
1417 value: ty::Binder<I, T>,
1418 ) -> T {
1419 self.delegate.instantiate_binder_with_infer(value)
1420 }
1421
1422 pub(super) fn enter_forall_with_assumptions<T: TypeFoldable<I>, U>(
1430 &mut self,
1431 value: ty::Binder<I, T>,
1432 param_env: I::ParamEnv,
1433 f: impl FnOnce(&mut Self, T) -> U,
1434 ) -> U {
1435 self.delegate.enter_forall_without_assumptions(value, |value| {
1436 let u = self.delegate.universe();
1439 if self.cx().assumptions_on_binders()
1440 && let Some(assumptions) = self.region_assumptions_for_placeholders_in_universe(
1441 value.clone(),
1442 u,
1443 param_env,
1444 )
1445 {
1446 self.delegate.insert_placeholder_assumptions(u, assumptions);
1447 }
1448
1449 f(self, value)
1450 })
1451 }
1452
1453 pub(super) fn deeply_resolve_ignoring_regions<T>(&self, value: T) -> T
1454 where
1455 T: TypeFoldable<I>,
1456 {
1457 self.delegate.deeply_resolve_ignoring_regions(value)
1458 }
1459
1460 pub(super) fn shallow_resolve(&self, ty: I::Ty) -> I::Ty {
1461 self.delegate.shallow_resolve(ty)
1462 }
1463
1464 pub(super) fn eager_resolve_region(&self, r: Region<I>) -> Region<I> {
1465 if let ty::ReVar(vid) = r.kind() {
1466 self.delegate.shallow_resolve_region_var(vid)
1467 } else {
1468 r
1469 }
1470 }
1471
1472 pub(super) fn fresh_args_for_item(&mut self, def_id: I::DefId) -> I::GenericArgs {
1473 let args = self.delegate.fresh_args_for_item(def_id);
1474 for arg in args.iter() {
1475 self.inspect.add_var_value(arg);
1476 }
1477 args
1478 }
1479
1480 pub(super) fn register_solver_region_constraint(&self, c: RegionConstraint<I>) {
1481 self.delegate.register_solver_region_constraint(c, self.origin_span);
1482 }
1483
1484 pub(super) fn register_ty_outlives(&self, ty: I::Ty, lt: Region<I>) {
1485 self.delegate.register_ty_outlives(ty, lt, self.origin_span);
1486 }
1487
1488 pub(super) fn register_region_outlives(
1489 &self,
1490 a: Region<I>,
1491 b: Region<I>,
1492 vis: VisibleForLeakCheck,
1493 ) {
1494 self.delegate.sub_regions(b, a, vis, self.origin_span);
1496 }
1497
1498 pub(super) fn well_formed_goals(
1500 &self,
1501 param_env: I::ParamEnv,
1502 term: I::Term,
1503 ) -> Option<Vec<Goal<I, I::Predicate>>> {
1504 self.delegate.well_formed_goals(param_env, term)
1505 }
1506
1507 pub(super) fn trait_ref_is_knowable(
1508 &mut self,
1509 param_env: I::ParamEnv,
1510 trait_ref: ty::TraitRef<I>,
1511 ) -> Result<bool, NoSolutionOrRerunNonErased> {
1512 let delegate = self.delegate;
1513 let lazily_normalize_ty = |ty| self.structurally_normalize_ty(param_env, ty);
1514 coherence::trait_ref_is_knowable(&**delegate, trait_ref, lazily_normalize_ty)
1515 .map(|is_knowable| is_knowable.is_ok())
1516 }
1517
1518 pub(super) fn fetch_eligible_assoc_item(
1519 &self,
1520 goal_trait_ref: ty::TraitRef<I>,
1521 trait_assoc_def_id: I::TraitAssocTermId,
1522 impl_def_id: I::ImplId,
1523 ) -> FetchEligibleAssocItemResponse<I> {
1524 self.delegate.fetch_eligible_assoc_item(goal_trait_ref, trait_assoc_def_id, impl_def_id)
1525 }
1526
1527 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1527u32),
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1527",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1527u32),
::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)]
1528 pub(super) fn register_hidden_type_in_storage(
1529 &mut self,
1530 opaque_type_key: ty::OpaqueTypeKey<I>,
1531 hidden_ty: I::Ty,
1532 ) -> Option<I::Ty> {
1533 self.delegate.register_hidden_type_in_storage(opaque_type_key, hidden_ty, self.origin_span)
1534 }
1535
1536 pub(super) fn add_item_bounds_for_hidden_type(
1537 &mut self,
1538 opaque_def_id: I::OpaqueTyId,
1539 opaque_args: I::GenericArgs,
1540 param_env: I::ParamEnv,
1541 hidden_ty: I::Ty,
1542 ) -> Result<(), NoSolutionOrRerunNonErased> {
1543 let mut goals = Vec::new();
1544 self.delegate.add_item_bounds_for_hidden_type(
1545 opaque_def_id,
1546 opaque_args,
1547 param_env,
1548 hidden_ty,
1549 &mut goals,
1550 );
1551 self.add_goals(GoalSource::AliasWellFormed, goals)?;
1552 Ok(())
1553 }
1554
1555 pub(super) fn evaluate_const(
1557 &mut self,
1558 param_env: I::ParamEnv,
1559 projection_term: ty::AliasTerm<I>,
1560 expected_term: I::Term,
1561 alias_const: ty::AliasConst<I>,
1562 ) -> QueryResultOrRerunNonErased<I> {
1563 let alias_const = self.deeply_resolve_ignoring_regions(alias_const);
1564 let cx = self.cx();
1565
1566 let is_gce = cx.features().generic_const_exprs();
1568
1569 if self.typing_mode().is_erased_not_coherence()
1570 && (alias_const.has_opaque_types() || is_gce)
1571 {
1572 match self.opaque_accesses.rerun_always(RerunReason::EvaluateConst)? {}
1573 }
1574
1575 let evaluated_const = if is_gce {
1576 self.delegate
1577 .evaluate_const(param_env, alias_const, |ty| self.normalize(param_env, ty))?
1578 } else {
1579 let evaluation_input = match alias_const.kind {
1591 ty::AliasConstKind::Anon { def_id }
1594 if #[allow(non_exhaustive_omitted_patterns)] match cx.anon_const_kind(def_id.into())
{
ty::AnonConstKind::RepeatExprCount => true,
_ => false,
}matches!(
1595 cx.anon_const_kind(def_id.into()),
1596 ty::AnonConstKind::RepeatExprCount
1597 ) =>
1598 {
1599 if alias_const.has_non_region_infer() {
1600 cx.delay_bug("AnonConst with infer args but no error reported");
1609 }
1610
1611 let args = GenericArgs::identity_for_item(cx, def_id.into());
1616 let typing_env = TypingEnv::post_analysis(cx, def_id.into());
1617
1618 Ok((typing_env, args))
1619 }
1620 _ => {
1621 if alias_const.args.has_non_region_param()
1634 || alias_const.args.has_non_region_placeholders()
1635 || alias_const.args.has_non_region_infer()
1636 {
1637 Err(ty::ConstEvalErr::TooGeneric)
1638 } else {
1639 let typing_env = TypingEnv::fully_monomorphized();
1642 let args = alias_const.args;
1643
1644 Ok((typing_env, args))
1645 }
1646 }
1647 };
1648
1649 let span = alias_const.kind.def_span(cx);
1652
1653 let evaluated = evaluation_input.and_then(|(typing_env, args)| {
1654 let alias_const = ty::AliasConst::new(cx, alias_const.kind, args);
1655 let erased_alias_const = cx.erase_and_anonymize_regions(alias_const);
1656 cx.const_eval_resolve_for_typeck(typing_env, erased_alias_const, span)
1657 });
1658
1659 match evaluated {
1660 Ok(val) => {
1661 let ty = self.normalize(param_env, alias_const.type_of(cx))?;
1662 Some(Const::new(cx, ty::ConstKind::Value(ValueConst::new(ty, val))))
1663 }
1664
1665 Err(ty::ConstEvalErr::Reported(e)) => Some(Const::new_error(cx, e)),
1666 Err(ty::ConstEvalErr::TooGeneric) => None,
1667 Err(ty::ConstEvalErr::NonValtreeable(_)) => {
1668 cx.delay_bug("Type system constant with non valtree'able type evaluated but no error emitted");
1669 None
1670 }
1671 }
1672 };
1673
1674 match evaluated_const {
1675 Some(evaluated) => {
1676 self.eq(param_env, expected_term, evaluated.into())?;
1677 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1678 }
1679 None if cx.features().gca_const_items() => {
1680 if alias_const.has_non_region_infer() {
1681 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1682 } else {
1683 self.eq(
1693 param_env,
1694 projection_term.to_term(cx, ty::IsRigid::Yes),
1695 expected_term,
1696 )?;
1697 self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
1698 }
1699 }
1700 None => {
1701 self.evaluate_added_goals_and_make_canonical_response(Certainty::AMBIGUOUS)
1703 }
1704 }
1705 }
1706
1707 pub(super) fn is_transmutable(
1708 &mut self,
1709 src: I::Ty,
1710 dst: I::Ty,
1711 assume: Const<I>,
1712 ) -> Result<Answer<Region<I>, I::Ty>, NoSolution> {
1713 self.delegate.is_transmutable(dst, src, assume)
1714 }
1715
1716 pub(super) fn replace_bound_vars<T: TypeFoldable<I>>(
1717 &self,
1718 t: T,
1719 universes: &mut Vec<Option<ty::UniverseIndex>>,
1720 ) -> T {
1721 BoundVarReplacer::replace_bound_vars(&**self.delegate, universes, t).0
1722 }
1723
1724 pub(super) fn may_use_unstable_feature(
1725 &mut self,
1726 param_env: I::ParamEnv,
1727 symbol: I::Symbol,
1728 ) -> Result<bool, RerunNonErased> {
1729 if self.typing_mode().is_erased_not_coherence() {
1730 match self.opaque_accesses.rerun_always(RerunReason::MayUseUnstableFeature)? {}
1731 }
1732
1733 Ok(may_use_unstable_feature(&**self.delegate, param_env, symbol))
1734 }
1735
1736 pub(crate) fn opaques_with_sub_unified_hidden_type(
1737 &self,
1738 self_ty: I::Ty,
1739 ) -> Vec<ty::OpaqueAliasTy<I>> {
1740 if let ty::Infer(ty::TyVar(vid)) = self_ty.kind() {
1741 self.delegate.opaques_with_sub_unified_hidden_type(vid)
1742 } else {
1743 ::alloc::vec::Vec::new()vec![]
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("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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1760u32),
::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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1784",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1784u32),
::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 mut canonical =
canonicalize_response(self.delegate,
self.max_input_universe,
Response {
certainty,
var_values,
var_values_is_identity: IsIdentity::No,
external_constraints: self.cx().mk_external_constraints(external_constraints),
});
canonical.value.update_var_values_is_identity();
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1760",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1760u32),
::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)]
1761 pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
1762 &mut self,
1763 shallow_certainty: Certainty,
1764 ) -> QueryResultOrRerunNonErased<I> {
1765 self.inspect.make_canonical_response(shallow_certainty);
1766
1767 let goals_certainty = self.try_evaluate_added_goals()?;
1768 assert_eq!(
1769 self.tainted,
1770 Ok(()),
1771 "EvalCtxt is tainted -- nested goals may have been dropped in a \
1772 previous call to `try_evaluate_added_goals!`"
1773 );
1774
1775 let goals_certainty = match self.delegate.cx().assumptions_on_binders() {
1776 true => {
1777 let certainty = self.eagerly_handle_placeholders()?;
1778 certainty.and(goals_certainty)
1779 }
1780 false => {
1781 self.delegate.leak_check(self.max_input_universe).map_err(|NoSolution| {
1784 trace!("failed the leak check");
1785 NoSolution
1786 })?;
1787
1788 goals_certainty
1789 }
1790 };
1791
1792 let (certainty, normalization_nested_goals) =
1793 match (self.current_goal_kind, shallow_certainty) {
1794 (CurrentGoalKind::ProjectionComputeAssocTermCandidate, Certainty::Yes) => {
1802 let goals = std::mem::take(&mut self.nested_goals);
1803 if goals.is_empty() {
1806 assert!(matches!(goals_certainty, Certainty::Yes));
1807 }
1808 (
1809 Certainty::Yes,
1810 NestedNormalizationGoals(
1811 goals.into_iter().map(|(s, g, _)| (s, g)).collect(),
1812 ),
1813 )
1814 }
1815 _ => {
1816 let certainty = shallow_certainty.and(goals_certainty);
1817 (certainty, NestedNormalizationGoals::empty())
1818 }
1819 };
1820
1821 if let Certainty::Maybe(
1822 maybe_info @ MaybeInfo {
1823 cause: MaybeCause::Overflow { keep_constraints: false, .. },
1824 opaque_types_jank: _,
1825 stalled_on_coroutines: _,
1826 },
1827 ) = certainty
1828 {
1829 return Ok(self.make_ambiguous_response_no_constraints(maybe_info));
1841 }
1842
1843 let external_constraints =
1844 self.compute_external_query_constraints(certainty, normalization_nested_goals);
1845 let (var_values, mut external_constraints) = self
1846 .delegate
1847 .deeply_resolve_via_unification_table((self.var_values, external_constraints));
1848
1849 let mut unique = HashSet::default();
1851 if let ExternalRegionConstraints::Old(r) = &mut external_constraints.region_constraints {
1852 r.retain(|(outlives, _)| !outlives.is_trivial() && unique.insert(*outlives));
1853 }
1854
1855 filter_irrelevant_region_constraints(self.delegate, var_values, &mut external_constraints);
1856
1857 let mut canonical = canonicalize_response(
1858 self.delegate,
1859 self.max_input_universe,
1860 Response {
1861 certainty,
1862 var_values,
1863 var_values_is_identity: IsIdentity::No, external_constraints: self.cx().mk_external_constraints(external_constraints),
1865 },
1866 );
1867 canonical.value.update_var_values_is_identity();
1868
1869 Ok(canonical)
1870 }
1871
1872 pub(in crate::solve) fn make_ambiguous_response_no_constraints(
1877 &self,
1878 maybe: MaybeInfo,
1879 ) -> CanonicalResponse<I> {
1880 response_no_constraints_raw(
1881 self.cx(),
1882 self.max_input_universe,
1883 self.var_kinds,
1884 Certainty::Maybe(maybe),
1885 )
1886 }
1887
1888 {}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1895u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("certainty")
}> =
::tracing::__macro_support::FieldName::new("certainty");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("normalization_nested_goals")
}> =
::tracing::__macro_support::FieldName::new("normalization_nested_goals");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::TRACE <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::TRACE <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&certainty)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&normalization_nested_goals)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: ExternalConstraintsData<I> =
loop {};
return __tracing_attr_fake_return;
}
{
let region_constraints =
if self.cx().assumptions_on_binders() {
ExternalRegionConstraints::NextGen(if let Certainty::Yes =
certainty {
let constraint =
self.delegate.get_solver_region_constraint();
constraint
} else { RegionConstraint::new_true() })
} else {
ExternalRegionConstraints::Old(if let Certainty::Yes =
certainty {
self.delegate.make_deduplicated_region_constraints()
} else { ::alloc::vec::Vec::new() })
};
let opaque_types =
self.delegate.clone_opaque_types_added_since(self.initial_opaque_types_storage_num_entries);
if self.typing_mode().is_erased_not_coherence() {
if !opaque_types.is_empty() {
::core::panicking::panic("assertion failed: opaque_types.is_empty()")
};
}
ExternalConstraintsData {
region_constraints,
opaque_types,
normalization_nested_goals,
}
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:1895",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(1895u32),
::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)]
1896 fn compute_external_query_constraints(
1897 &self,
1898 certainty: Certainty,
1899 normalization_nested_goals: NestedNormalizationGoals<I>,
1900 ) -> ExternalConstraintsData<I> {
1901 let region_constraints = if self.cx().assumptions_on_binders() {
1910 ExternalRegionConstraints::NextGen(if let Certainty::Yes = certainty {
1911 let constraint = self.delegate.get_solver_region_constraint();
1912 constraint
1913 } else {
1914 RegionConstraint::new_true()
1915 })
1916 } else {
1917 ExternalRegionConstraints::Old(if let Certainty::Yes = certainty {
1918 self.delegate.make_deduplicated_region_constraints()
1919 } else {
1920 vec![]
1921 })
1922 };
1923
1924 let opaque_types = self
1929 .delegate
1930 .clone_opaque_types_added_since(self.initial_opaque_types_storage_num_entries);
1931
1932 if self.typing_mode().is_erased_not_coherence() {
1933 assert!(opaque_types.is_empty());
1934 }
1935
1936 ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals }
1937 }
1938
1939 pub(super) fn normalize<T: TypeFoldable<I>>(
1940 &mut self,
1941 param_env: I::ParamEnv,
1942 value: ty::Unnormalized<I, T>,
1943 ) -> Result<T, NoSolutionOrRerunNonErased> {
1944 let value = self.delegate.deeply_resolve_ignoring_regions(value.skip_normalization());
1945
1946 if !self.cx().renormalize_rigid_aliases() && !value.has_non_rigid_aliases() {
1947 return Ok(value);
1948 }
1949
1950 let infcx = self.delegate.deref();
1952 let mut folder = NormalizationFolder::new(infcx, ::alloc::vec::Vec::new()vec![], |alias_term| {
1953 let infer_term = self.next_term_infer_of_alias_kind(alias_term);
1954 let pred = ty::ProjectionClause { projection_term: alias_term, term: infer_term };
1955 let goal = Goal::new(self.cx(), param_env, pred);
1956 let source = GoalSource::Normalization;
1957 self.inspect.add_goal(self.delegate, self.max_input_universe, source, goal);
1958 let GoalEvaluation { goal, certainty, has_changed: _, stalled_on } =
1959 self.evaluate_goal(source, goal, None)?;
1960 let normalization_was_ambiguous = match certainty {
1961 Certainty::Yes => NormalizationWasAmbiguous::No,
1962 Certainty::Maybe(_) => {
1963 self.nested_goals.push((source, goal, stalled_on));
1964 NormalizationWasAmbiguous::Yes
1965 }
1966 };
1967
1968 Ok((self.deeply_resolve_ignoring_regions(infer_term), normalization_was_ambiguous))
1969 });
1970 value.try_fold_with(&mut folder)
1971 }
1972}
1973
1974fn filter_irrelevant_region_constraints<D, I>(
1975 delegate: &D,
1976 var_values: I::GenericArgs,
1977 external_constraints: &mut ExternalConstraintsData<I>,
1978) where
1979 D: SolverDelegate<Interner = I>,
1980 I: Interner,
1981{
1982 #[derive(#[automatically_derived]impl ::core::default::Default for NonTrivialVars {
#[inline]
fn default() -> Self {
NonTrivialVars { vars: ::core::default::Default::default() }
}
}Default)]
1983 struct NonTrivialVars {
1984 vars: HashSet<RegionVid>,
1985 }
1986 impl<I> TypeVisitor<I> for NonTrivialVars
1987 where
1988 I: Interner,
1989 {
1990 type Result = ();
1991 fn visit_ty(&mut self, t: I::Ty) {
1992 if !t.has_infer_regions() {
1995 return;
1996 }
1997 t.super_visit_with(self);
1998 }
1999 fn visit_const(&mut self, c: Const<I>) {
2000 if !c.has_infer_regions() {
2002 return;
2003 }
2004 c.super_visit_with(self);
2005 }
2006 fn visit_region(&mut self, r: Region<I>) {
2007 if let ty::ReVar(vid) = r.kind() {
2008 self.vars.insert(vid);
2009 }
2010 }
2011 }
2012
2013 let ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals } =
2014 external_constraints;
2015
2016 if let ExternalRegionConstraints::Old(r) = region_constraints
2021 && !r.is_empty()
2022 {
2023 let mut vis = NonTrivialVars::default();
2024 var_values.visit_with(&mut vis);
2025 opaque_types.visit_with(&mut vis);
2029 normalization_nested_goals.visit_with(&mut vis);
2030 for (constraint, _) in r.iter() {
2031 match constraint {
2032 ty::RegionConstraint::Outlives(ty::OutlivesClause(sup, _)) => {
2033 sup.visit_with(&mut vis)
2034 }
2035 ty::RegionConstraint::Eq(eq) => eq.visit_with(&mut vis),
2036 }
2037 }
2038
2039 r.retain(|(outlives, _)| {
2040 if let ty::RegionConstraint::Outlives(ty::OutlivesClause(sup, re)) = *outlives
2041 && let Some(sup_re) = sup.as_region()
2042 && let ty::RegionKind::ReVar(vid) = re.kind()
2043 && delegate.universe_of_region(vid).unwrap()
2046 .can_name(max_universe(&**delegate, sup_re))
2047 {
2048 vis.vars.contains(&vid)
2049 } else {
2050 true
2051 }
2052 });
2053 }
2054}
2055
2056#[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)]
2057enum RerunDecision {
2058 Yes,
2059 No,
2060 EagerlyPropagateToParent,
2061}
2062
2063{}
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/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(2063u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::eval_ctxt"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("rerun")
}> =
::tracing::__macro_support::FieldName::new("rerun");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("original_typing_mode")
}> =
::tracing::__macro_support::FieldName::new("original_typing_mode");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("parent_opaque_types")
}> =
::tracing::__macro_support::FieldName::new("parent_opaque_types");
NAME.as_str()
}], ::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::INFO <=
::tracing::level_filters::STATIC_MAX_LEVEL &&
::tracing::Level::INFO <=
::tracing::level_filters::LevelFilter::current() &&
{ interest = __CALLSITE.interest(); !interest.is_never() }
&&
::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
interest) {
let meta = __CALLSITE.metadata();
::tracing::Span::new(meta,
&{
#[allow(unused_imports)]
use ::tracing::field::{debug, display, Value};
meta.fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&rerun)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&original_typing_mode)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&parent_opaque_types)
as &dyn ::tracing::field::Value))])
})
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[allow(clippy :: redundant_closure_call)]
let x =
(move ||
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy
:: needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: RerunDecision = loop {};
return __tracing_attr_fake_return;
}
{
let parent_opaque_def_ids =
parent_opaque_types.iter().map(|(key, _)|
key.def_id.into());
let opaque_in_storage =
|opaques: I::LocalDefIds, def_ids: SmallCopySet<_>|
{
if def_ids.as_ref().is_empty() {
RerunDecision::No
} else if opaques.iter().chain(parent_opaque_def_ids).any(|opaque|
def_ids.as_ref().contains(&opaque)) {
RerunDecision::Yes
} else { RerunDecision::No }
};
let any_opaque_has_infer_as_hidden =
||
{
if parent_opaque_types.iter().any(|(_, ty)| ty.is_ty_var())
{
RerunDecision::Yes
} else { RerunDecision::No }
};
match (rerun, original_typing_mode) {
(RerunCondition::Never, _) => RerunDecision::No,
(_, TypingMode::ErasedNotCoherence(MayBeErased)) =>
RerunDecision::EagerlyPropagateToParent,
(_, TypingMode::Coherence) =>
::core::panicking::unreachable_default_msg(),
(RerunCondition::Always, _) => RerunDecision::Yes,
(RerunCondition::OpaqueInStorage(..),
TypingMode::PostAnalysis | TypingMode::Codegen |
TypingMode::Reflection) => RerunDecision::Yes,
(RerunCondition::OpaqueInStorage(defids),
TypingMode::PostBorrowck { defined_opaque_types: opaques } |
TypingMode::Typeck {
defining_opaque_types_and_generators: opaques } |
TypingMode::PostTypeckThroughBorrowck {
defining_opaque_types: opaques }) =>
opaque_in_storage(opaques, defids),
(RerunCondition::AnyOpaqueHasInferAsHidden,
TypingMode::Typeck { .. }) => {
any_opaque_has_infer_as_hidden()
}
(RerunCondition::AnyOpaqueHasInferAsHidden,
TypingMode::PostBorrowck { .. } | TypingMode::PostAnalysis |
TypingMode::Codegen | TypingMode::Reflection |
TypingMode::PostTypeckThroughBorrowck { .. }) =>
RerunDecision::No,
(RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_),
TypingMode::PostAnalysis | TypingMode::Codegen |
TypingMode::Reflection) => RerunDecision::Yes,
(RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
TypingMode::Typeck {
defining_opaque_types_and_generators: opaques }) => {
if let RerunDecision::Yes = any_opaque_has_infer_as_hidden()
{
RerunDecision::Yes
} else if let RerunDecision::Yes =
opaque_in_storage(opaques, defids) {
RerunDecision::Yes
} else { RerunDecision::No }
}
(RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
TypingMode::PostBorrowck { defined_opaque_types: opaques } |
TypingMode::PostTypeckThroughBorrowck {
defining_opaque_types: opaques }) =>
opaque_in_storage(opaques, defids),
}
}
})();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs:2063",
"rustc_next_trait_solver::solve::eval_ctxt",
::tracing::Level::INFO,
::tracing_core::__macro_support::Option::Some("/rustc-dev/bbcdfd90a3f81ca2a5f6d69b943a6ff0d8582102/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs"),
::tracing_core::__macro_support::Option::Some(2063u32),
::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)]
2064fn should_rerun_after_erased_canonicalization<I: Interner>(
2065 AccessedOpaques { reason: _, rerun }: AccessedOpaques<I>,
2066 original_typing_mode: TypingMode<I>,
2067 parent_opaque_types: &[(OpaqueTypeKey<I>, I::Ty)],
2068) -> RerunDecision {
2069 let parent_opaque_def_ids = parent_opaque_types.iter().map(|(key, _)| key.def_id.into());
2070 let opaque_in_storage = |opaques: I::LocalDefIds, def_ids: SmallCopySet<_>| {
2071 if def_ids.as_ref().is_empty() {
2072 RerunDecision::No
2073 } else if opaques
2074 .iter()
2075 .chain(parent_opaque_def_ids)
2076 .any(|opaque| def_ids.as_ref().contains(&opaque))
2077 {
2078 RerunDecision::Yes
2079 } else {
2080 RerunDecision::No
2081 }
2082 };
2083 let any_opaque_has_infer_as_hidden = || {
2084 if parent_opaque_types.iter().any(|(_, ty)| ty.is_ty_var()) {
2085 RerunDecision::Yes
2086 } else {
2087 RerunDecision::No
2088 }
2089 };
2090
2091 match (rerun, original_typing_mode) {
2092 (RerunCondition::Never, _) => RerunDecision::No,
2094 (_, TypingMode::ErasedNotCoherence(MayBeErased)) => RerunDecision::EagerlyPropagateToParent,
2096 (_, TypingMode::Coherence) => unreachable!(),
2100 (RerunCondition::Always, _) => RerunDecision::Yes,
2102 (
2104 RerunCondition::OpaqueInStorage(..),
2105 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
2106 ) => RerunDecision::Yes,
2107 (
2108 RerunCondition::OpaqueInStorage(defids),
2109 TypingMode::PostBorrowck { defined_opaque_types: opaques }
2110 | TypingMode::Typeck { defining_opaque_types_and_generators: opaques }
2111 | TypingMode::PostTypeckThroughBorrowck { defining_opaque_types: opaques },
2112 ) => opaque_in_storage(opaques, defids),
2113 (RerunCondition::AnyOpaqueHasInferAsHidden, TypingMode::Typeck { .. }) => {
2115 any_opaque_has_infer_as_hidden()
2116 }
2117 (
2118 RerunCondition::AnyOpaqueHasInferAsHidden,
2119 TypingMode::PostBorrowck { .. }
2120 | TypingMode::PostAnalysis
2121 | TypingMode::Codegen
2122 | TypingMode::Reflection
2123 | TypingMode::PostTypeckThroughBorrowck { .. },
2124 ) => RerunDecision::No,
2125 (
2127 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_),
2128 TypingMode::PostAnalysis | TypingMode::Codegen | TypingMode::Reflection,
2129 ) => RerunDecision::Yes,
2130 (
2131 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
2132 TypingMode::Typeck { defining_opaque_types_and_generators: opaques },
2133 ) => {
2134 if let RerunDecision::Yes = any_opaque_has_infer_as_hidden() {
2135 RerunDecision::Yes
2136 } else if let RerunDecision::Yes = opaque_in_storage(opaques, defids) {
2137 RerunDecision::Yes
2138 } else {
2139 RerunDecision::No
2140 }
2141 }
2142 (
2143 RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(defids),
2144 TypingMode::PostBorrowck { defined_opaque_types: opaques }
2145 | TypingMode::PostTypeckThroughBorrowck { defining_opaque_types: opaques },
2146 ) => opaque_in_storage(opaques, defids),
2147 }
2148}
2149
2150pub fn evaluate_root_goal_for_proof_tree_raw_provider<
2152 D: SolverDelegate<Interner = I>,
2153 I: Interner,
2154>(
2155 cx: I,
2156 canonical_goal: I::CanonicalInput,
2157 root_depth: usize,
2158) -> (QueryResult<I>, I::Probe, RequiredDepth) {
2159 let mut inspect = inspect::ProofTreeBuilder::new();
2160 let ((canonical_result, accessed_opaques), required_depth) =
2161 SearchGraph::<D>::evaluate_root_goal_for_proof_tree(
2162 cx,
2163 root_depth,
2164 canonical_goal,
2165 &mut inspect,
2166 );
2167 let final_revision = inspect.unwrap();
2168
2169 if !!accessed_opaques.might_rerun() {
::core::panicking::panic("assertion failed: !accessed_opaques.might_rerun()")
};assert!(!accessed_opaques.might_rerun());
2170 (canonical_result, cx.mk_probe(final_revision), required_depth)
2171}
2172
2173pub(super) fn evaluate_root_goal_for_proof_tree<D: SolverDelegate<Interner = I>, I: Interner>(
2178 delegate: &D,
2179 goal: Goal<I, I::Predicate>,
2180 origin_span: I::Span,
2181 root_depth: usize,
2182) -> (Result<NestedNormalizationGoals<I>, NoSolution>, inspect::GoalEvaluation<I>) {
2183 let opaque_types = delegate.clone_opaque_types_lookup_table();
2184 let (goal, opaque_types) = delegate.deeply_resolve_via_unification_table((goal, opaque_types));
2185 let typing_mode = delegate.typing_mode_raw().assert_not_erased();
2186
2187 let (orig_values, canonical_goal) =
2188 canonicalize_goal(delegate, goal, &opaque_types, typing_mode.into());
2189
2190 let (canonical_result, final_revision, required_depth) =
2191 delegate.cx().evaluate_root_goal_for_proof_tree_raw(canonical_goal, root_depth);
2192
2193 let proof_tree = inspect::GoalEvaluation {
2194 uncanonicalized_goal: goal,
2195 orig_values,
2196 final_revision,
2197 result: canonical_result,
2198 required_depth,
2199 };
2200
2201 let response = match canonical_result {
2202 Err(e) => return (Err(e), proof_tree),
2203 Ok(response) => response,
2204 };
2205
2206 let (normalization_nested_goals, _certainty) = instantiate_and_apply_query_response(
2207 delegate,
2208 &proof_tree.orig_values,
2209 response,
2210 canonical_goal.canonical.var_kinds,
2211 origin_span,
2212 );
2213
2214 (Ok(normalization_nested_goals), proof_tree)
2215}