1use rustc_data_structures::transitive_relation::TransitiveRelation;
63use rustc_data_structures::undo_log::UndoLogs;
64use rustc_middle::bug;
65use rustc_middle::mir::ConstraintCategory;
66use rustc_middle::traits::query::NoSolution;
67use rustc_middle::ty::outlives::{Component, push_outlives_components};
68use rustc_middle::ty::{
69 self, GenericArgKind, GenericArgsRef, PolyTypeOutlivesPredicate, Region, RegionExt, RegionVid,
70 Ty, TyCtxt, TypeFoldable as _, TypeVisitableExt,
71};
72use rustc_span::Span;
73use smallvec::smallvec;
74use tracing::{debug, instrument};
75
76use super::env::OutlivesEnvironment;
77use crate::infer::outlives::env::RegionBoundPairs;
78use crate::infer::outlives::verify::VerifyBoundCx;
79use crate::infer::resolve::OpportunisticRegionResolver;
80use crate::infer::snapshot::undo_log::UndoLog;
81use crate::infer::{
82 self, GenericKind, InferCtxt, SubregionOrigin, TypeOutlivesConstraint, VerifyBound,
83};
84use crate::traits::{ObligationCause, ObligationCauseCode};
85
86impl<'tcx> InferCtxt<'tcx> {
87 pub fn register_outlives_constraint(
88 &self,
89 ty::OutlivesPredicate(arg, r2): ty::ArgOutlivesPredicate<'tcx>,
90 vis: ty::VisibleForLeakCheck,
91 cause: &ObligationCause<'tcx>,
92 ) {
93 match arg.kind() {
94 ty::GenericArgKind::Lifetime(r1) => {
95 self.register_region_outlives_constraint(ty::OutlivesPredicate(r1, r2), vis, cause);
96 }
97 ty::GenericArgKind::Type(ty1) => {
98 self.register_type_outlives_constraint(ty1, r2, cause);
99 }
100 ty::GenericArgKind::Const(_) => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
101 }
102 }
103
104 pub fn register_region_eq_constraint(
105 &self,
106 ty::RegionEqPredicate(r_a, r_b): ty::RegionEqPredicate<'tcx>,
107 vis: ty::VisibleForLeakCheck,
108 cause: &ObligationCause<'tcx>,
109 ) {
110 let origin = SubregionOrigin::from_obligation_cause(cause, || {
111 SubregionOrigin::RelateRegionParamBound(cause.span, None)
112 });
113 self.equate_regions(origin, r_a, r_b, vis);
114 }
115
116 pub fn register_region_outlives_constraint(
117 &self,
118 ty::OutlivesPredicate(r_a, r_b): ty::RegionOutlivesPredicate<'tcx>,
119 vis: ty::VisibleForLeakCheck,
120 cause: &ObligationCause<'tcx>,
121 ) {
122 let origin = SubregionOrigin::from_obligation_cause(cause, || {
123 SubregionOrigin::RelateRegionParamBound(cause.span, None)
124 });
125 self.sub_regions(origin, r_b, r_a, vis);
127 }
128
129 #[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("register_type_outlives_constraint_inner",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(134u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("obligation")
}> =
::tracing::__macro_support::FieldName::new("obligation");
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(&obligation)
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 mut inner = self.inner.borrow_mut();
inner.undo_log.push(UndoLog::PushTypeOutlivesConstraint);
inner.region_obligations.push(obligation);
}
}
}#[instrument(level = "debug", skip(self))]
135 pub fn register_type_outlives_constraint_inner(
136 &self,
137 obligation: TypeOutlivesConstraint<'tcx>,
138 ) {
139 let mut inner = self.inner.borrow_mut();
140 inner.undo_log.push(UndoLog::PushTypeOutlivesConstraint);
141 inner.region_obligations.push(obligation);
142 }
143
144 pub fn register_type_outlives_constraint(
145 &self,
146 sup_type: Ty<'tcx>,
147 sub_region: Region<'tcx>,
148 cause: &ObligationCause<'tcx>,
149 ) {
150 if !!self.tcx.assumptions_on_binders() {
::core::panicking::panic("assertion failed: !self.tcx.assumptions_on_binders()")
};assert!(!self.tcx.assumptions_on_binders());
151
152 if sup_type.is_global() {
157 return;
158 }
159
160 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:160",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(160u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("sup_type")
}> =
::tracing::__macro_support::FieldName::new("sup_type");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("sub_region")
}> =
::tracing::__macro_support::FieldName::new("sub_region");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("cause")
}> =
::tracing::__macro_support::FieldName::new("cause");
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(&sup_type)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&sub_region)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&cause)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};debug!(?sup_type, ?sub_region, ?cause);
161 let origin = SubregionOrigin::from_obligation_cause(cause, || {
162 SubregionOrigin::RelateParamBound(
163 cause.span,
164 sup_type,
165 match cause.code().peel_derives() {
166 ObligationCauseCode::WhereClause(_, span)
167 | ObligationCauseCode::WhereClauseInExpr(_, span, ..)
168 | ObligationCauseCode::OpaqueTypeBound(span, _)
169 if !span.is_dummy() =>
170 {
171 Some(*span)
172 }
173 _ => None,
174 },
175 )
176 });
177
178 self.register_type_outlives_constraint_inner(TypeOutlivesConstraint {
179 sup_type,
180 sub_region,
181 origin,
182 });
183 }
184
185 pub fn take_registered_region_obligations(&self) -> Vec<TypeOutlivesConstraint<'tcx>> {
187 if !!self.in_snapshot() {
{
::core::panicking::panic_fmt(format_args!("cannot take registered region obligations in a snapshot"));
}
};assert!(!self.in_snapshot(), "cannot take registered region obligations in a snapshot");
188 std::mem::take(&mut self.inner.borrow_mut().region_obligations)
189 }
190
191 pub fn clone_registered_region_obligations(&self) -> Vec<TypeOutlivesConstraint<'tcx>> {
192 self.inner.borrow().region_obligations.clone()
193 }
194
195 pub fn register_region_assumption(&self, assumption: ty::ArgOutlivesPredicate<'tcx>) {
196 let mut inner = self.inner.borrow_mut();
197 inner.undo_log.push(UndoLog::PushRegionAssumption);
198 inner.region_assumptions.push(assumption);
199 }
200
201 pub fn take_registered_region_assumptions(&self) -> Vec<ty::ArgOutlivesPredicate<'tcx>> {
202 if !!self.in_snapshot() {
{
::core::panicking::panic_fmt(format_args!("cannot take registered region assumptions in a snapshot"));
}
};assert!(!self.in_snapshot(), "cannot take registered region assumptions in a snapshot");
203 std::mem::take(&mut self.inner.borrow_mut().region_assumptions)
204 }
205
206 pub fn destructure_solver_region_constraints_for_regionck(
207 &self,
208 outlives_env: &OutlivesEnvironment<'tcx>,
209 span: Span,
210 ) {
211 let assumptions = rustc_type_ir::region_constraint::Assumptions::new(
212 outlives_env.known_type_outlives().into_iter().cloned().collect(),
213 outlives_env.free_region_map().relation.clone(),
214 );
215 self.destructure_solver_region_constraints(assumptions, self, span);
216 }
217
218 pub fn destructure_solver_region_constraints_for_borrowck(
219 &self,
220 conversion: impl TypeOutlivesDelegate<'tcx>,
222 known_type_outlives: &[PolyTypeOutlivesPredicate<'tcx>],
223 region_outlives: TransitiveRelation<RegionVid>,
224 span: Span,
225 ) {
226 let assumptions = rustc_type_ir::region_constraint::Assumptions::new(
227 known_type_outlives.into_iter().cloned().collect(),
228 region_outlives.maybe_map(|r| Some(Region::new_var(self.tcx, r))).unwrap(),
229 );
230 self.destructure_solver_region_constraints(assumptions, conversion, span);
231 }
232
233 #[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("destructure_solver_region_constraints",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(233u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("assumptions")
}> =
::tracing::__macro_support::FieldName::new("assumptions");
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(&assumptions)
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;
}
{
if !self.tcx.assumptions_on_binders() {
::core::panicking::panic("assertion failed: self.tcx.assumptions_on_binders()")
};
if !self.next_trait_solver() {
::core::panicking::panic("assertion failed: self.next_trait_solver()")
};
let origin = SubregionOrigin::SolverRegionConstraint(span);
let category = origin.to_constraint_category();
let constraint =
self.inner.borrow().solver_region_constraint_storage.get_constraint();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:247",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(247u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("constraint")
}> =
::tracing::__macro_support::FieldName::new("constraint");
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(&constraint)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let constraint =
rustc_type_ir::region_constraint::destructure_type_outlives_constraints_in_root(self,
constraint, &assumptions);
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:254",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(254u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("constraint")
}> =
::tracing::__macro_support::FieldName::new("constraint");
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(&constraint)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let constraint =
rustc_type_ir::region_constraint::evaluate_solver_constraint(&constraint);
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:256",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(256u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("constraint")
}> =
::tracing::__macro_support::FieldName::new("constraint");
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(&constraint)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let mut constraints =
::alloc::boxed::box_assume_init_into_vec_unsafe(::alloc::intrinsics::write_box_via_move(::alloc::boxed::Box::new_uninit(),
[constraint]));
while let Some(c) = constraints.pop() {
use rustc_type_ir::region_constraint::RegionConstraint::*;
match c {
Ambiguity => {
self.dcx().err("unable to satisfy constraints involving placeholders due to unknown implied bounds");
}
RegionOutlives(a, b) => {
conversion.push_sub_region_constraint(origin.clone(), b, a,
category);
}
And(nested) | Or(nested) => constraints.extend(nested),
AliasTyOutlivesViaEnv(..) | PlaceholderTyOutlives(..) =>
::core::panicking::panic("internal error: entered unreachable code"),
}
}
}
}
}#[instrument(level = "debug", skip(self, conversion))]
234 pub fn destructure_solver_region_constraints(
235 &self,
236 assumptions: rustc_type_ir::region_constraint::Assumptions<TyCtxt<'tcx>>,
237 mut conversion: impl TypeOutlivesDelegate<'tcx>,
238 span: Span,
239 ) {
240 assert!(self.tcx.assumptions_on_binders());
241 assert!(self.next_trait_solver());
242
243 let origin = SubregionOrigin::SolverRegionConstraint(span);
244 let category = origin.to_constraint_category();
245
246 let constraint = self.inner.borrow().solver_region_constraint_storage.get_constraint();
247 debug!(?constraint);
248 let constraint =
249 rustc_type_ir::region_constraint::destructure_type_outlives_constraints_in_root(
250 self,
251 constraint,
252 &assumptions,
253 );
254 debug!(?constraint);
255 let constraint = rustc_type_ir::region_constraint::evaluate_solver_constraint(&constraint);
256 debug!(?constraint);
257
258 let mut constraints = vec![constraint];
259 while let Some(c) = constraints.pop() {
260 use rustc_type_ir::region_constraint::RegionConstraint::*;
261
262 match c {
263 Ambiguity => {
264 self.dcx().err("unable to satisfy constraints involving placeholders due to unknown implied bounds");
265 }
266 RegionOutlives(a, b) => {
267 conversion.push_sub_region_constraint(
268 origin.clone(),
269 b,
271 a,
272 category,
273 );
274 }
275 And(nested) | Or(nested) => constraints.extend(nested),
277 AliasTyOutlivesViaEnv(..) | PlaceholderTyOutlives(..) => unreachable!(),
278 }
279 }
280 }
281
282 #[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("process_registered_region_obligations",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(291u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::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()
}], ::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(&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<(),
(PolyTypeOutlivesPredicate<'tcx>, SubregionOrigin<'tcx>)> =
loop {};
return __tracing_attr_fake_return;
}
{
if !!self.in_snapshot() {
{
::core::panicking::panic_fmt(format_args!("cannot process registered region obligations in a snapshot"));
}
};
if self.tcx.assumptions_on_binders() {
self.destructure_solver_region_constraints_for_regionck(outlives_env,
span);
}
for iteration in 0.. {
let my_region_obligations =
self.take_registered_region_obligations();
if my_region_obligations.is_empty() { break; }
if !self.tcx.recursion_limit().value_within_limit(iteration) {
::rustc_middle::util::bug::bug_fmt(format_args!("unexpected overflowed when processing region obligations: {0:#?}",
my_region_obligations));
}
for TypeOutlivesConstraint { sup_type, sub_region, origin } in
my_region_obligations {
let outlives =
ty::Binder::dummy(ty::OutlivesPredicate(sup_type,
sub_region));
let ty::OutlivesPredicate(sup_type, sub_region) =
deeply_normalize_ty(outlives,
origin.clone()).map_err(|NoSolution|
(outlives,
origin.clone()))?.no_bound_vars().expect("started with no bound vars, should end with no bound vars");
let (sup_type, sub_region) =
(sup_type,
sub_region).fold_with(&mut OpportunisticRegionResolver::new(self));
if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions
&&
outlives_env.higher_ranked_assumptions().contains(&ty::OutlivesPredicate(sup_type.into(),
sub_region)) {
continue;
}
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:345",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(345u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("sup_type")
}> =
::tracing::__macro_support::FieldName::new("sup_type");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("sub_region")
}> =
::tracing::__macro_support::FieldName::new("sub_region");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("origin")
}> =
::tracing::__macro_support::FieldName::new("origin");
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(&sup_type)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&sub_region)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&origin)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let outlives =
&mut TypeOutlives::new(self, self.tcx,
outlives_env.region_bound_pairs(), None,
outlives_env.known_type_outlives());
let category = origin.to_constraint_category();
outlives.type_must_outlive(origin, sup_type, sub_region,
category);
}
}
Ok(())
}
}
}#[instrument(level = "debug", skip(self, outlives_env, deeply_normalize_ty))]
292 pub fn process_registered_region_obligations(
293 &self,
294 outlives_env: &OutlivesEnvironment<'tcx>,
295 mut deeply_normalize_ty: impl FnMut(
296 PolyTypeOutlivesPredicate<'tcx>,
297 SubregionOrigin<'tcx>,
298 )
299 -> Result<PolyTypeOutlivesPredicate<'tcx>, NoSolution>,
300 span: Span,
301 ) -> Result<(), (PolyTypeOutlivesPredicate<'tcx>, SubregionOrigin<'tcx>)> {
302 assert!(!self.in_snapshot(), "cannot process registered region obligations in a snapshot");
303
304 if self.tcx.assumptions_on_binders() {
305 self.destructure_solver_region_constraints_for_regionck(outlives_env, span);
306 }
307
308 for iteration in 0.. {
310 let my_region_obligations = self.take_registered_region_obligations();
311 if my_region_obligations.is_empty() {
312 break;
313 }
314
315 if !self.tcx.recursion_limit().value_within_limit(iteration) {
316 bug!(
320 "unexpected overflowed when processing region obligations: {my_region_obligations:#?}"
321 );
322 }
323
324 for TypeOutlivesConstraint { sup_type, sub_region, origin } in my_region_obligations {
325 let outlives = ty::Binder::dummy(ty::OutlivesPredicate(sup_type, sub_region));
326 let ty::OutlivesPredicate(sup_type, sub_region) =
327 deeply_normalize_ty(outlives, origin.clone())
328 .map_err(|NoSolution| (outlives, origin.clone()))?
329 .no_bound_vars()
330 .expect("started with no bound vars, should end with no bound vars");
331 let (sup_type, sub_region) =
335 (sup_type, sub_region).fold_with(&mut OpportunisticRegionResolver::new(self));
336
337 if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions
338 && outlives_env
339 .higher_ranked_assumptions()
340 .contains(&ty::OutlivesPredicate(sup_type.into(), sub_region))
341 {
342 continue;
343 }
344
345 debug!(?sup_type, ?sub_region, ?origin);
346
347 let outlives = &mut TypeOutlives::new(
348 self,
349 self.tcx,
350 outlives_env.region_bound_pairs(),
351 None,
352 outlives_env.known_type_outlives(),
353 );
354 let category = origin.to_constraint_category();
355 outlives.type_must_outlive(origin, sup_type, sub_region, category);
356 }
357 }
358
359 Ok(())
360 }
361}
362
363pub struct TypeOutlives<'cx, 'tcx, D>
370where
371 D: TypeOutlivesDelegate<'tcx>,
372{
373 delegate: D,
376 tcx: TyCtxt<'tcx>,
377 verify_bound: VerifyBoundCx<'cx, 'tcx>,
378}
379
380pub trait TypeOutlivesDelegate<'tcx> {
381 fn push_sub_region_constraint(
382 &mut self,
383 origin: SubregionOrigin<'tcx>,
384 a: ty::Region<'tcx>,
385 b: ty::Region<'tcx>,
386 constraint_category: ConstraintCategory<'tcx>,
387 );
388
389 fn push_verify(
390 &mut self,
391 origin: SubregionOrigin<'tcx>,
392 kind: GenericKind<'tcx>,
393 a: ty::Region<'tcx>,
394 bound: VerifyBound<'tcx>,
395 );
396}
397
398impl<'cx, 'tcx, D> TypeOutlives<'cx, 'tcx, D>
399where
400 D: TypeOutlivesDelegate<'tcx>,
401{
402 pub fn new(
403 delegate: D,
404 tcx: TyCtxt<'tcx>,
405 region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
406 implicit_region_bound: Option<ty::Region<'tcx>>,
407 caller_bounds: &'cx [ty::PolyTypeOutlivesPredicate<'tcx>],
408 ) -> Self {
409 Self {
410 delegate,
411 tcx,
412 verify_bound: VerifyBoundCx::new(
413 tcx,
414 region_bound_pairs,
415 implicit_region_bound,
416 caller_bounds,
417 ),
418 }
419 }
420
421 #[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("type_must_outlive",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(429u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("origin")
}> =
::tracing::__macro_support::FieldName::new("origin");
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("region")
}> =
::tracing::__macro_support::FieldName::new("region");
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(&origin)
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(®ion)
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;
}
{
if !!ty.has_escaping_bound_vars() {
::core::panicking::panic("assertion failed: !ty.has_escaping_bound_vars()")
};
let mut components = ::smallvec::SmallVec::new();
push_outlives_components(self.tcx, ty, &mut components);
self.components_must_outlive(origin, &components, region,
category);
}
}
}#[instrument(level = "debug", skip(self))]
430 pub fn type_must_outlive(
431 &mut self,
432 origin: infer::SubregionOrigin<'tcx>,
433 ty: Ty<'tcx>,
434 region: ty::Region<'tcx>,
435 category: ConstraintCategory<'tcx>,
436 ) {
437 assert!(!ty.has_escaping_bound_vars());
438
439 let mut components = smallvec![];
440 push_outlives_components(self.tcx, ty, &mut components);
441 self.components_must_outlive(origin, &components, region, category);
442 }
443
444 fn components_must_outlive(
445 &mut self,
446 origin: infer::SubregionOrigin<'tcx>,
447 components: &[Component<TyCtxt<'tcx>>],
448 region: ty::Region<'tcx>,
449 category: ConstraintCategory<'tcx>,
450 ) {
451 for component in components.iter() {
452 let origin = origin.clone();
453 match component {
454 Component::Region(region1) => {
455 self.delegate.push_sub_region_constraint(origin, region, *region1, category);
456 }
457 Component::Param(param_ty) => {
458 self.param_ty_must_outlive(origin, region, *param_ty);
459 }
460 Component::Placeholder(placeholder_ty) => {
461 self.placeholder_ty_must_outlive(origin, region, *placeholder_ty);
462 }
463 Component::Alias(alias_ty) => self.alias_ty_must_outlive(origin, region, *alias_ty),
464 Component::EscapingAlias(subcomponents) => {
465 self.components_must_outlive(origin, subcomponents, region, category);
466 }
467 Component::UnresolvedInferenceVariable(v) => {
468 self.tcx.dcx().span_delayed_bug(
472 origin.span(),
473 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unresolved inference variable in outlives: {0:?}",
v))
})format!("unresolved inference variable in outlives: {v:?}"),
474 );
475 }
476 }
477 }
478 }
479
480 #[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("param_ty_must_outlive",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(480u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("origin")
}> =
::tracing::__macro_support::FieldName::new("origin");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("region")
}> =
::tracing::__macro_support::FieldName::new("region");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("param_ty")
}> =
::tracing::__macro_support::FieldName::new("param_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(&origin)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(®ion)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(¶m_ty)
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 verify_bound =
self.verify_bound.param_or_placeholder_bound(param_ty.to_ty(self.tcx));
self.delegate.push_verify(origin, GenericKind::Param(param_ty),
region, verify_bound);
}
}
}#[instrument(level = "debug", skip(self))]
481 fn param_ty_must_outlive(
482 &mut self,
483 origin: infer::SubregionOrigin<'tcx>,
484 region: ty::Region<'tcx>,
485 param_ty: ty::ParamTy,
486 ) {
487 let verify_bound = self.verify_bound.param_or_placeholder_bound(param_ty.to_ty(self.tcx));
488 self.delegate.push_verify(origin, GenericKind::Param(param_ty), region, verify_bound);
489 }
490
491 #[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("placeholder_ty_must_outlive",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(491u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("origin")
}> =
::tracing::__macro_support::FieldName::new("origin");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("region")
}> =
::tracing::__macro_support::FieldName::new("region");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("placeholder_ty")
}> =
::tracing::__macro_support::FieldName::new("placeholder_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(&origin)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(®ion)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&placeholder_ty)
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 verify_bound =
self.verify_bound.param_or_placeholder_bound(Ty::new_placeholder(self.tcx,
placeholder_ty));
self.delegate.push_verify(origin,
GenericKind::Placeholder(placeholder_ty), region,
verify_bound);
}
}
}#[instrument(level = "debug", skip(self))]
492 fn placeholder_ty_must_outlive(
493 &mut self,
494 origin: infer::SubregionOrigin<'tcx>,
495 region: ty::Region<'tcx>,
496 placeholder_ty: ty::PlaceholderType<'tcx>,
497 ) {
498 let verify_bound = self
499 .verify_bound
500 .param_or_placeholder_bound(Ty::new_placeholder(self.tcx, placeholder_ty));
501 self.delegate.push_verify(
502 origin,
503 GenericKind::Placeholder(placeholder_ty),
504 region,
505 verify_bound,
506 );
507 }
508
509 #[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("alias_ty_must_outlive",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(509u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("origin")
}> =
::tracing::__macro_support::FieldName::new("origin");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("region")
}> =
::tracing::__macro_support::FieldName::new("region");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("alias_ty")
}> =
::tracing::__macro_support::FieldName::new("alias_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(&origin)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(®ion)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&alias_ty)
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;
}
{
if alias_ty.args.is_empty() { return; }
if alias_ty.has_non_region_infer() {
self.tcx.dcx().span_delayed_bug(origin.span(),
"an alias has infers during region solving");
return;
}
let trait_bounds: Vec<_> =
rustc_type_ir::outlives::declared_bounds_from_definition(self.tcx,
alias_ty).collect();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:548",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(548u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("trait_bounds")
}> =
::tracing::__macro_support::FieldName::new("trait_bounds");
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(&trait_bounds)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let approx_env_bounds =
self.verify_bound.approx_declared_bounds_from_env(alias_ty);
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:554",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(554u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("approx_env_bounds")
}> =
::tracing::__macro_support::FieldName::new("approx_env_bounds");
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(&approx_env_bounds)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let kind = alias_ty.kind;
if approx_env_bounds.is_empty() && trait_bounds.is_empty() &&
(alias_ty.has_infer_regions() ||
#[allow(non_exhaustive_omitted_patterns)] match kind {
ty::Opaque { .. } => true,
_ => false,
}) {
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:575",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(575u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::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!("no declared bounds")
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let opt_variances = self.tcx.opt_alias_variances(kind);
self.args_must_outlive(alias_ty.args, origin, region,
opt_variances);
return;
}
if !trait_bounds.is_empty() &&
trait_bounds[1..].iter().map(|r|
Some(*r)).chain(approx_env_bounds.iter().map(|b|
b.map_bound(|b|
b.1).no_bound_vars())).all(|b| b == Some(trait_bounds[0])) {
let unique_bound = trait_bounds[0];
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:606",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(606u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("unique_bound")
}> =
::tracing::__macro_support::FieldName::new("unique_bound");
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(&unique_bound)
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:607",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(607u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::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!("unique declared bound appears in trait ref")
as &dyn ::tracing::field::Value))])
});
} else { ; }
};
let category = origin.to_constraint_category();
self.delegate.push_sub_region_constraint(origin, region,
unique_bound, category);
return;
}
let verify_bound = self.verify_bound.alias_bound(alias_ty);
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event compiler/rustc_infer/src/infer/outlives/obligations.rs:619",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(619u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::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!("alias_must_outlive: pushing {0:?}",
verify_bound) as &dyn ::tracing::field::Value))])
});
} else { ; }
};
self.delegate.push_verify(origin, GenericKind::Alias(alias_ty),
region, verify_bound);
}
}
}#[instrument(level = "debug", skip(self))]
510 fn alias_ty_must_outlive(
511 &mut self,
512 origin: infer::SubregionOrigin<'tcx>,
513 region: ty::Region<'tcx>,
514 alias_ty: ty::AliasTy<'tcx>,
515 ) {
516 if alias_ty.args.is_empty() {
518 return;
519 }
520
521 if alias_ty.has_non_region_infer() {
522 self.tcx
523 .dcx()
524 .span_delayed_bug(origin.span(), "an alias has infers during region solving");
525 return;
526 }
527
528 let trait_bounds: Vec<_> =
546 rustc_type_ir::outlives::declared_bounds_from_definition(self.tcx, alias_ty).collect();
547
548 debug!(?trait_bounds);
549
550 let approx_env_bounds = self.verify_bound.approx_declared_bounds_from_env(alias_ty);
554 debug!(?approx_env_bounds);
555
556 let kind = alias_ty.kind;
571 if approx_env_bounds.is_empty()
572 && trait_bounds.is_empty()
573 && (alias_ty.has_infer_regions() || matches!(kind, ty::Opaque { .. }))
574 {
575 debug!("no declared bounds");
576 let opt_variances = self.tcx.opt_alias_variances(kind);
577 self.args_must_outlive(alias_ty.args, origin, region, opt_variances);
578 return;
579 }
580
581 if !trait_bounds.is_empty()
592 && trait_bounds[1..]
593 .iter()
594 .map(|r| Some(*r))
595 .chain(
596 approx_env_bounds.iter().map(|b| b.map_bound(|b| b.1).no_bound_vars()),
602 )
603 .all(|b| b == Some(trait_bounds[0]))
604 {
605 let unique_bound = trait_bounds[0];
606 debug!(?unique_bound);
607 debug!("unique declared bound appears in trait ref");
608 let category = origin.to_constraint_category();
609 self.delegate.push_sub_region_constraint(origin, region, unique_bound, category);
610 return;
611 }
612
613 let verify_bound = self.verify_bound.alias_bound(alias_ty);
619 debug!("alias_must_outlive: pushing {:?}", verify_bound);
620 self.delegate.push_verify(origin, GenericKind::Alias(alias_ty), region, verify_bound);
621 }
622
623 #[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("args_must_outlive",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(623u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("args")
}> =
::tracing::__macro_support::FieldName::new("args");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("origin")
}> =
::tracing::__macro_support::FieldName::new("origin");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("region")
}> =
::tracing::__macro_support::FieldName::new("region");
NAME.as_str()
},
{
const NAME:
::tracing::__macro_support::FieldName<{
::tracing::__macro_support::FieldName::len("opt_variances")
}> =
::tracing::__macro_support::FieldName::new("opt_variances");
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(&args)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&origin)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(®ion)
as &dyn ::tracing::field::Value)),
(::tracing::__macro_support::Option::Some(&::tracing::field::debug(&opt_variances)
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 constraint = origin.to_constraint_category();
for (index, arg) in args.iter().enumerate() {
match arg.kind() {
GenericArgKind::Lifetime(lt) => {
let variance =
if let Some(variances) = opt_variances {
variances[index]
} else { ty::Invariant };
if variance == ty::Invariant {
self.delegate.push_sub_region_constraint(origin.clone(),
region, lt, constraint);
}
}
GenericArgKind::Type(ty) => {
self.type_must_outlive(origin.clone(), ty, region,
constraint);
}
GenericArgKind::Const(_) => {}
}
}
}
}
}#[instrument(level = "debug", skip(self))]
624 fn args_must_outlive(
625 &mut self,
626 args: GenericArgsRef<'tcx>,
627 origin: infer::SubregionOrigin<'tcx>,
628 region: ty::Region<'tcx>,
629 opt_variances: Option<&[ty::Variance]>,
630 ) {
631 let constraint = origin.to_constraint_category();
632 for (index, arg) in args.iter().enumerate() {
633 match arg.kind() {
634 GenericArgKind::Lifetime(lt) => {
635 let variance = if let Some(variances) = opt_variances {
636 variances[index]
637 } else {
638 ty::Invariant
639 };
640 if variance == ty::Invariant {
641 self.delegate.push_sub_region_constraint(
642 origin.clone(),
643 region,
644 lt,
645 constraint,
646 );
647 }
648 }
649 GenericArgKind::Type(ty) => {
650 self.type_must_outlive(origin.clone(), ty, region, constraint);
651 }
652 GenericArgKind::Const(_) => {
653 }
655 }
656 }
657 }
658}
659
660impl<'cx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'tcx> {
661 fn push_sub_region_constraint(
662 &mut self,
663 origin: SubregionOrigin<'tcx>,
664 a: ty::Region<'tcx>,
665 b: ty::Region<'tcx>,
666 _constraint_category: ConstraintCategory<'tcx>,
667 ) {
668 self.sub_regions(origin, a, b, ty::VisibleForLeakCheck::Unreachable)
670 }
671
672 fn push_verify(
673 &mut self,
674 origin: SubregionOrigin<'tcx>,
675 kind: GenericKind<'tcx>,
676 a: ty::Region<'tcx>,
677 bound: VerifyBound<'tcx>,
678 ) {
679 self.verify_generic_bound(origin, kind, a, bound)
680 }
681}