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