1use std::fmt;
2
3use rustc_errors::ErrorGuaranteed;
4use rustc_infer::infer::canonical::Canonical;
5use rustc_infer::infer::outlives::env::RegionBoundPairs;
6use rustc_middle::mir::{Body, ConstraintCategory};
7use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, Unnormalized, Upcast};
8use rustc_span::def_id::DefId;
9use rustc_span::{Span, bug};
10use rustc_trait_selection::traits::ObligationCause;
11use rustc_trait_selection::traits::query::type_op::{self, TypeOpOutput};
12use tracing::{debug, instrument};
13
14use super::{Locations, NormalizeLocation, TypeChecker};
15use crate::BorrowckInferCtxt;
16use crate::diagnostics::ToUniverseInfo;
17use crate::type_check::{MirTypeckRegionConstraints, constraint_conversion};
18use crate::universal_regions::UniversalRegions;
19
20{}
#[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("fully_perform_op_raw",
"rustc_borrowck::type_check::canonical",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(20u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("body")
}> =
::tracing::__macro_support::FieldName::new("body");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("universal_regions")
}> =
::tracing::__macro_support::FieldName::new("universal_regions");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("region_bound_pairs")
}> =
::tracing::__macro_support::FieldName::new("region_bound_pairs");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("known_type_outlives_obligations")
}> =
::tracing::__macro_support::FieldName::new("known_type_outlives_obligations");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("locations")
}> =
::tracing::__macro_support::FieldName::new("locations");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("category")
}> =
::tracing::__macro_support::FieldName::new("category");
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(&body)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&universal_regions)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(®ion_bound_pairs)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&known_type_outlives_obligations)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&locations)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&category)
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<R, ErrorGuaranteed> =
loop {};
return __tracing_attr_fake_return;
}
{
let old_universe = infcx.universe();
let TypeOpOutput {
output, constraints: query_constraints, error_info } =
op.fully_perform(infcx, infcx.root_def_id,
locations.span(body))?;
if true {
let data = infcx.take_and_reset_region_constraints();
if !data.is_empty() {
{
::core::panicking::panic_fmt(format_args!("leftover region constraints: {0:#?}",
data));
};
}
}
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs:47",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(47u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("output")
}> =
::tracing::__macro_support::FieldName::new("output");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("query_constraints")
}> =
::tracing::__macro_support::FieldName::new("query_constraints");
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(&output)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&query_constraints)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
if let Some(data) = query_constraints {
constraint_conversion::ConstraintConversion::new(infcx,
universal_regions, region_bound_pairs,
known_type_outlives_obligations, locations,
locations.span(body), category,
constraints).convert_all(data);
}
let universe = infcx.universe();
if old_universe != universe && let Some(error_info) = error_info {
let universe_info = error_info.to_universe_info(old_universe);
for u in (old_universe + 1)..=universe {
constraints.universe_causes.insert(u,
universe_info.clone());
}
}
Ok(output)
}
}
}#[instrument(skip(infcx, constraints, op), level = "trace")]
21pub(crate) fn fully_perform_op_raw<'tcx, R: fmt::Debug, Op>(
22 infcx: &BorrowckInferCtxt<'tcx>,
23 body: &Body<'tcx>,
24 universal_regions: &UniversalRegions<'tcx>,
25 region_bound_pairs: &RegionBoundPairs<'tcx>,
26 known_type_outlives_obligations: &[ty::PolyTypeOutlivesClause<'tcx>],
27 constraints: &mut MirTypeckRegionConstraints<'tcx>,
28 locations: Locations,
29 category: ConstraintCategory<'tcx>,
30 op: Op,
31) -> Result<R, ErrorGuaranteed>
32where
33 Op: type_op::TypeOp<'tcx, Output = R>,
34 Op::ErrorInfo: ToUniverseInfo<'tcx>,
35{
36 let old_universe = infcx.universe();
37
38 let TypeOpOutput { output, constraints: query_constraints, error_info } =
39 op.fully_perform(infcx, infcx.root_def_id, locations.span(body))?;
40 if cfg!(debug_assertions) {
41 let data = infcx.take_and_reset_region_constraints();
42 if !data.is_empty() {
43 panic!("leftover region constraints: {data:#?}");
44 }
45 }
46
47 debug!(?output, ?query_constraints);
48
49 if let Some(data) = query_constraints {
50 constraint_conversion::ConstraintConversion::new(
51 infcx,
52 universal_regions,
53 region_bound_pairs,
54 known_type_outlives_obligations,
55 locations,
56 locations.span(body),
57 category,
58 constraints,
59 )
60 .convert_all(data);
61 }
62
63 let universe = infcx.universe();
66 if old_universe != universe
67 && let Some(error_info) = error_info
68 {
69 let universe_info = error_info.to_universe_info(old_universe);
70 for u in (old_universe + 1)..=universe {
71 constraints.universe_causes.insert(u, universe_info.clone());
72 }
73 }
74
75 Ok(output)
76}
77
78impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
79 {}
#[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("fully_perform_op",
"rustc_borrowck::type_check::canonical",
::tracing::Level::TRACE,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(89u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("locations")
}> =
::tracing::__macro_support::FieldName::new("locations");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("category")
}> =
::tracing::__macro_support::FieldName::new("category");
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(&locations)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&category)
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<R, ErrorGuaranteed> =
loop {};
return __tracing_attr_fake_return;
}
{
fully_perform_op_raw(self.infcx, self.body,
self.universal_regions, self.region_bound_pairs,
self.known_type_outlives_obligations, self.constraints,
locations, category, op)
}
}
}#[instrument(skip(self, op), level = "trace")]
90 pub(super) fn fully_perform_op<R: fmt::Debug, Op>(
91 &mut self,
92 locations: Locations,
93 category: ConstraintCategory<'tcx>,
94 op: Op,
95 ) -> Result<R, ErrorGuaranteed>
96 where
97 Op: type_op::TypeOp<'tcx, Output = R>,
98 Op::ErrorInfo: ToUniverseInfo<'tcx>,
99 {
100 fully_perform_op_raw(
101 self.infcx,
102 self.body,
103 self.universal_regions,
104 self.region_bound_pairs,
105 self.known_type_outlives_obligations,
106 self.constraints,
107 locations,
108 category,
109 op,
110 )
111 }
112
113 pub(super) fn instantiate_canonical<T>(
114 &mut self,
115 span: Span,
116 canonical: &Canonical<'tcx, T>,
117 ) -> T
118 where
119 T: TypeFoldable<TyCtxt<'tcx>>,
120 {
121 let (instantiated, _) = self.infcx.instantiate_canonical(span, canonical);
122 instantiated
123 }
124
125 {}
#[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("prove_trait_ref",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(125u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("trait_ref")
}> =
::tracing::__macro_support::FieldName::new("trait_ref");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("locations")
}> =
::tracing::__macro_support::FieldName::new("locations");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("category")
}> =
::tracing::__macro_support::FieldName::new("category");
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(&trait_ref)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&locations)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&category)
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: () = loop {};
return __tracing_attr_fake_return;
}
{
self.prove_clause(ty::ClauseKind::Trait(ty::TraitClause {
trait_ref,
polarity: ty::ClausePolarity::Positive,
}), locations, category);
}
}
}#[instrument(skip(self), level = "debug")]
126 pub(super) fn prove_trait_ref(
127 &mut self,
128 trait_ref: ty::TraitRef<'tcx>,
129 locations: Locations,
130 category: ConstraintCategory<'tcx>,
131 ) {
132 self.prove_clause(
133 ty::ClauseKind::Trait(ty::TraitClause {
134 trait_ref,
135 polarity: ty::ClausePolarity::Positive,
136 }),
137 locations,
138 category,
139 );
140 }
141
142 {}
#[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("normalize_and_prove_instantiated_clauses",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(142u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("def_id")
}> =
::tracing::__macro_support::FieldName::new("def_id");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("instantiated_clauses")
}> =
::tracing::__macro_support::FieldName::new("instantiated_clauses");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("locations")
}> =
::tracing::__macro_support::FieldName::new("locations");
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(&def_id)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&instantiated_clauses)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&locations)
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: () = loop {};
return __tracing_attr_fake_return;
}
{
for (clause, span) in instantiated_clauses {
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs:150",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(150u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
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("clause")
}> =
::tracing::__macro_support::FieldName::new("clause");
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(&span)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&clause)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let category = ConstraintCategory::Predicate(span, def_id);
let clause =
self.normalize_with_category(clause, locations, category);
self.prove_clause(clause, locations, category);
}
}
}
}#[instrument(level = "debug", skip(self))]
143 pub(super) fn normalize_and_prove_instantiated_clauses(
144 &mut self,
145 def_id: DefId,
146 instantiated_clauses: ty::InstantiatedClauses<'tcx>,
147 locations: Locations,
148 ) {
149 for (clause, span) in instantiated_clauses {
150 debug!(?span, ?clause);
151 let category = ConstraintCategory::Predicate(span, def_id);
152 let clause = self.normalize_with_category(clause, locations, category);
153 self.prove_clause(clause, locations, category);
154 }
155 }
156
157 pub(super) fn prove_clauses(
158 &mut self,
159 clauses: impl IntoIterator<Item: Upcast<TyCtxt<'tcx>, ty::Clause<'tcx>> + std::fmt::Debug>,
160 locations: Locations,
161 category: ConstraintCategory<'tcx>,
162 ) {
163 for clause in clauses {
164 self.prove_clause(clause, locations, category);
165 }
166 }
167
168 {}
#[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("prove_clause",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(168u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("clause")
}> =
::tracing::__macro_support::FieldName::new("clause");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("locations")
}> =
::tracing::__macro_support::FieldName::new("locations");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("category")
}> =
::tracing::__macro_support::FieldName::new("category");
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(&clause)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&locations)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&category)
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: () = loop {};
return __tracing_attr_fake_return;
}
{
let param_env = self.infcx.param_env;
let predicate = clause.upcast(self.tcx()).upcast(self.tcx());
let _: Result<_, ErrorGuaranteed> =
self.fully_perform_op(locations, category,
param_env.and(type_op::prove_predicate::ProvePredicate {
predicate,
}));
}
}
}#[instrument(skip(self), level = "debug")]
169 pub(super) fn prove_clause(
170 &mut self,
171 clause: impl Upcast<TyCtxt<'tcx>, ty::Clause<'tcx>> + std::fmt::Debug,
172 locations: Locations,
173 category: ConstraintCategory<'tcx>,
174 ) {
175 let param_env = self.infcx.param_env;
176 let predicate = clause.upcast(self.tcx()).upcast(self.tcx());
178 let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
179 locations,
180 category,
181 param_env.and(type_op::prove_predicate::ProvePredicate { predicate }),
182 );
183 }
184
185 pub(super) fn normalize<T>(
186 &mut self,
187 value: Unnormalized<'tcx, T>,
188 location: impl NormalizeLocation,
189 ) -> T
190 where
191 T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx,
192 {
193 self.normalize_with_category(value, location, ConstraintCategory::Boring)
194 }
195
196 pub(super) fn deeply_normalize<T>(
197 &mut self,
198 value: Unnormalized<'tcx, T>,
199 location: impl NormalizeLocation,
200 ) -> Result<T, ErrorGuaranteed>
201 where
202 T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx,
203 {
204 self.fully_perform_op(
205 location.to_locations(),
206 ConstraintCategory::Boring,
207 self.infcx.param_env.and(type_op::normalize::Normalize { value }),
208 )
209 }
210
211 {}
#[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("normalize_with_category",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(211u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("value")
}> =
::tracing::__macro_support::FieldName::new("value");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("location")
}> =
::tracing::__macro_support::FieldName::new("location");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("category")
}> =
::tracing::__macro_support::FieldName::new("category");
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(&value)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&location)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&category)
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: T = loop {};
return __tracing_attr_fake_return;
}
{
let param_env = self.infcx.param_env;
let result: Result<_, ErrorGuaranteed> =
self.fully_perform_op(location.to_locations(), category,
param_env.and(type_op::normalize::Normalize { value }));
result.unwrap_or(value.skip_norm_wip())
}
}
}#[instrument(skip(self), level = "debug")]
212 pub(super) fn normalize_with_category<T>(
213 &mut self,
214 value: Unnormalized<'tcx, T>,
215 location: impl NormalizeLocation,
216 category: ConstraintCategory<'tcx>,
217 ) -> T
218 where
219 T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx,
220 {
221 let param_env = self.infcx.param_env;
222 let result: Result<_, ErrorGuaranteed> = self.fully_perform_op(
223 location.to_locations(),
224 category,
225 param_env.and(type_op::normalize::Normalize { value }),
226 );
227 result.unwrap_or(value.skip_norm_wip())
228 }
229
230 {}
#[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("struct_tail",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(230u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
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("location")
}> =
::tracing::__macro_support::FieldName::new("location");
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(&ty)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&location)
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: Ty<'tcx> = loop {};
return __tracing_attr_fake_return;
}
{
let tcx = self.tcx();
let body = self.body;
let cause =
ObligationCause::misc(location.to_locations().span(body),
body.source.def_id().expect_local());
let mut normalize = |ty| self.normalize(ty, location);
tcx.struct_tail_raw(ty, &cause, &mut normalize, || {})
}
}
}#[instrument(skip(self), level = "debug")]
231 pub(super) fn struct_tail(
232 &mut self,
233 ty: Ty<'tcx>,
234 location: impl NormalizeLocation,
235 ) -> Ty<'tcx> {
236 let tcx = self.tcx();
237 let body = self.body;
238
239 let cause = ObligationCause::misc(
240 location.to_locations().span(body),
241 body.source.def_id().expect_local(),
242 );
243
244 let mut normalize = |ty| self.normalize(ty, location);
245 tcx.struct_tail_raw(ty, &cause, &mut normalize, || {})
246 }
247
248 {}
#[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("ascribe_user_type",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(248u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("mir_ty")
}> =
::tracing::__macro_support::FieldName::new("mir_ty");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("user_ty")
}> =
::tracing::__macro_support::FieldName::new("user_ty");
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(&mir_ty)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&user_ty)
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: () = loop {};
return __tracing_attr_fake_return;
}
{
let _: Result<_, ErrorGuaranteed> =
self.fully_perform_op(Locations::All(span),
ConstraintCategory::Boring,
self.infcx.param_env.and(type_op::ascribe_user_type::AscribeUserType {
mir_ty,
user_ty,
}));
}
}
}#[instrument(skip(self), level = "debug")]
249 pub(super) fn ascribe_user_type(
250 &mut self,
251 mir_ty: Ty<'tcx>,
252 user_ty: ty::UserType<'tcx>,
253 span: Span,
254 ) {
255 let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
256 Locations::All(span),
257 ConstraintCategory::Boring,
258 self.infcx
259 .param_env
260 .and(type_op::ascribe_user_type::AscribeUserType { mir_ty, user_ty }),
261 );
262 }
263
264 {}
#[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("ascribe_user_type_skip_wf",
"rustc_borrowck::type_check::canonical",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/28221559263a3976766cf305940e80e30cf9ba8a/compiler/rustc_borrowck/src/type_check/canonical.rs"),
::tracing_core::__macro_support::Option::Some(267u32),
::tracing_core::__macro_support::Option::Some("rustc_borrowck::type_check::canonical"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("mir_ty")
}> =
::tracing::__macro_support::FieldName::new("mir_ty");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("user_ty")
}> =
::tracing::__macro_support::FieldName::new("user_ty");
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(&mir_ty)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&user_ty)
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: () = loop {};
return __tracing_attr_fake_return;
}
{
let ty::UserTypeKind::Ty(user_ty) =
user_ty.kind else {
::rustc_span::macros::bug_impl(None,
format_args!("impossible case reached"), Location::caller())
};
if let ty::Infer(_) = user_ty.kind() {
self.eq_types(user_ty, mir_ty, Locations::All(span),
ConstraintCategory::Boring).unwrap();
return;
}
let mir_ty =
match self.infcx.next_trait_solver() {
true => mir_ty,
false =>
self.normalize(Unnormalized::new_wip(mir_ty),
Locations::All(span)),
};
let cause = ObligationCause::dummy_with_span(span);
let param_env = self.infcx.param_env;
let _: Result<_, ErrorGuaranteed> =
self.fully_perform_op(Locations::All(span),
ConstraintCategory::Boring,
type_op::custom::CustomTypeOp::new(|ocx|
{
let user_ty =
ocx.normalize(&cause, param_env,
Unnormalized::new_wip(user_ty));
ocx.eq(&cause, param_env, user_ty, mir_ty)?;
Ok(())
}, "ascribe_user_type_skip_wf"));
}
}
}#[instrument(skip(self), level = "debug")]
268 pub(super) fn ascribe_user_type_skip_wf(
269 &mut self,
270 mir_ty: Ty<'tcx>,
271 user_ty: ty::UserType<'tcx>,
272 span: Span,
273 ) {
274 let ty::UserTypeKind::Ty(user_ty) = user_ty.kind else { bug!() };
275
276 if let ty::Infer(_) = user_ty.kind() {
278 self.eq_types(user_ty, mir_ty, Locations::All(span), ConstraintCategory::Boring)
279 .unwrap();
280 return;
281 }
282
283 let mir_ty = match self.infcx.next_trait_solver() {
289 true => mir_ty,
290 false => self.normalize(Unnormalized::new_wip(mir_ty), Locations::All(span)),
291 };
292
293 let cause = ObligationCause::dummy_with_span(span);
294 let param_env = self.infcx.param_env;
295 let _: Result<_, ErrorGuaranteed> = self.fully_perform_op(
296 Locations::All(span),
297 ConstraintCategory::Boring,
298 type_op::custom::CustomTypeOp::new(
299 |ocx| {
300 let user_ty = ocx.normalize(&cause, param_env, Unnormalized::new_wip(user_ty));
305 ocx.eq(&cause, param_env, user_ty, mir_ty)?;
306 Ok(())
307 },
308 "ascribe_user_type_skip_wf",
309 ),
310 );
311 }
312}