rustc_next_trait_solver/solve/project_goals/
mod.rs1mod anon_const;
2mod free_alias;
3mod inherent;
4mod opaque_types;
5
6use rustc_type_ir::solve::QueryResultOrRerunNonErased;
7use rustc_type_ir::{self as ty, Interner, ProjectionClause};
8use tracing::{instrument, trace};
9
10use crate::delegate::SolverDelegate;
11use crate::solve::{
12 Certainty, EvalCtxt, Goal, GoalEvaluation, GoalSource, NestedNormalizationGoals,
13};
14
15impl<D, I> EvalCtxt<'_, D>
16where
17 D: SolverDelegate<Interner = I>,
18 I: Interner,
19{
20 {}
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_projection_goal",
"rustc_next_trait_solver::solve::project_goals",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0abfedbc7cd4e725f126913880c95800394f7c37/compiler/rustc_next_trait_solver/src/solve/project_goals/mod.rs"),
::tracing_core::__macro_support::Option::Some(20u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::project_goals"),
::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:
QueryResultOrRerunNonErased<I> = loop {};
return __tracing_attr_fake_return;
}
{
match goal.predicate.projection_term.kind {
ty::AliasTermKind::ProjectionTy { .. } |
ty::AliasTermKind::ProjectionConst { .. } => {
self.normalize_associated_term(goal)
}
ty::AliasTermKind::InherentTy { .. } |
ty::AliasTermKind::InherentConstSelf { .. } |
ty::AliasTermKind::InherentConstImpl { .. } => {
self.normalize_inherent_associated_term(goal)
}
ty::AliasTermKind::OpaqueTy { .. } =>
self.normalize_opaque_type(goal),
ty::AliasTermKind::FreeTy { .. } |
ty::AliasTermKind::FreeConst { .. } => {
self.normalize_free_alias(goal).map_err(Into::into)
}
ty::AliasTermKind::AnonConst { .. } => {
self.normalize_anon_const(goal).map_err(Into::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/0abfedbc7cd4e725f126913880c95800394f7c37/compiler/rustc_next_trait_solver/src/solve/project_goals/mod.rs:20",
"rustc_next_trait_solver::solve::project_goals",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0abfedbc7cd4e725f126913880c95800394f7c37/compiler/rustc_next_trait_solver/src/solve/project_goals/mod.rs"),
::tracing_core::__macro_support::Option::Some(20u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::project_goals"),
::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)]
21 pub(super) fn compute_projection_goal(
22 &mut self,
23 goal: Goal<I, ProjectionClause<I>>,
24 ) -> QueryResultOrRerunNonErased<I> {
25 match goal.predicate.projection_term.kind {
26 ty::AliasTermKind::ProjectionTy { .. } | ty::AliasTermKind::ProjectionConst { .. } => {
27 self.normalize_associated_term(goal)
28 }
29 ty::AliasTermKind::InherentTy { .. }
30 | ty::AliasTermKind::InherentConstSelf { .. }
31 | ty::AliasTermKind::InherentConstImpl { .. } => {
32 self.normalize_inherent_associated_term(goal)
33 }
34 ty::AliasTermKind::OpaqueTy { .. } => self.normalize_opaque_type(goal),
35 ty::AliasTermKind::FreeTy { .. } | ty::AliasTermKind::FreeConst { .. } => {
36 self.normalize_free_alias(goal).map_err(Into::into)
37 }
38 ty::AliasTermKind::AnonConst { .. } => {
39 self.normalize_anon_const(goal).map_err(Into::into)
40 }
41 }
42 }
43
44 fn normalize_associated_term(
45 &mut self,
46 goal: Goal<I, ProjectionClause<I>>,
47 ) -> QueryResultOrRerunNonErased<I> {
48 let ty::ProjectionClause { projection_term: alias, term } = goal.predicate;
49 let unconstrained_term = self.next_term_infer_of_alias_kind(alias);
50 let normalizes_to =
51 goal.with(self.cx(), ty::NormalizesTo { alias, term: unconstrained_term });
52
53 let (
70 NestedNormalizationGoals(nested_goals),
71 GoalEvaluation { goal: _, certainty, stalled_on: _, has_changed: _ },
72 ) = self.evaluate_goal_raw(GoalSource::Normalization, normalizes_to)?;
73
74 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/0abfedbc7cd4e725f126913880c95800394f7c37/compiler/rustc_next_trait_solver/src/solve/project_goals/mod.rs:74",
"rustc_next_trait_solver::solve::project_goals",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/0abfedbc7cd4e725f126913880c95800394f7c37/compiler/rustc_next_trait_solver/src/solve/project_goals/mod.rs"),
::tracing_core::__macro_support::Option::Some(74u32),
::tracing_core::__macro_support::Option::Some("rustc_next_trait_solver::solve::project_goals"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("nested_goals")
}> =
::tracing::__macro_support::FieldName::new("nested_goals");
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(&nested_goals)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};trace!(?nested_goals);
75
76 self.inspect.make_canonical_response(Certainty::AMBIGUOUS);
81
82 self.eq(goal.param_env, term, unconstrained_term)?;
83
84 for (s, g) in nested_goals {
86 self.add_goal(s, g)?;
87 }
88
89 self.evaluate_added_goals_and_make_canonical_response(certainty)
90 }
91}