1use rustc_data_structures::transitive_relation::{TransitiveRelation, TransitiveRelationBuilder};
63use rustc_data_structures::undo_log::UndoLogs;
64use rustc_middle::mir::ConstraintCategory;
65use rustc_middle::ty::outlives::{Component, push_outlives_components};
66use rustc_middle::ty::{
67 self, GenericArgKind, GenericArgsRef, PolyTypeOutlivesClause, Region, RegionVid, Ty, TyCtxt,
68 TypeVisitableExt, Upcast,
69};
70use rustc_span::bug;
71use rustc_type_ir::region_constraint::{self, LeafRegionConstraint};
72use smallvec::smallvec;
73use tracing::{debug, instrument};
74
75use super::env::OutlivesEnvironment;
76use crate::infer::outlives::env::RegionBoundPairs;
77use crate::infer::outlives::verify::VerifyBoundCx;
78use crate::infer::snapshot::undo_log::UndoLog;
79use crate::infer::{
80 self, GenericKind, InferCtxt, SolverRegionConstraint, SubregionOrigin, TypeOutlivesConstraint,
81 VerifyBound,
82};
83use crate::traits::{ObligationCause, ObligationCauseCode};
84
85impl<'tcx> InferCtxt<'tcx> {
86 pub fn register_outlives_constraint(
87 &self,
88 ty::OutlivesClause(arg, r2): ty::ArgOutlivesClause<'tcx>,
89 vis: ty::VisibleForLeakCheck,
90 cause: &ObligationCause<'tcx>,
91 ) {
92 match arg.kind() {
93 ty::GenericArgKind::Lifetime(r1) => {
94 self.register_region_outlives_constraint(ty::OutlivesClause(r1, r2), vis, cause);
95 }
96 ty::GenericArgKind::Type(ty1) => {
97 self.register_type_outlives_constraint(ty1, r2, cause);
98 }
99 ty::GenericArgKind::Const(_) => ::core::panicking::unreachable_default_msg()unreachable!(),
100 }
101 }
102
103 pub fn register_region_eq_constraint(
104 &self,
105 ty::RegionEqPredicate(r_a, r_b): ty::RegionEqPredicate<'tcx>,
106 vis: ty::VisibleForLeakCheck,
107 cause: &ObligationCause<'tcx>,
108 ) {
109 let origin = SubregionOrigin::from_obligation_cause(cause, || {
110 SubregionOrigin::RelateRegionParamBound(cause.span, None)
111 });
112 self.equate_regions(origin, r_a, r_b, vis);
113 }
114
115 pub fn register_region_outlives_constraint(
116 &self,
117 ty::OutlivesClause(r_a, r_b): ty::RegionOutlivesClause<'tcx>,
118 vis: ty::VisibleForLeakCheck,
119 cause: &ObligationCause<'tcx>,
120 ) {
121 let origin = SubregionOrigin::from_obligation_cause(cause, || {
122 SubregionOrigin::RelateRegionParamBound(cause.span, None)
123 });
124 self.sub_regions(origin, r_b, r_a, vis);
126 }
127
128 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(133u32),
::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))]
134 pub fn register_type_outlives_constraint_inner(
135 &self,
136 obligation: TypeOutlivesConstraint<'tcx>,
137 ) {
138 let mut inner = self.inner.borrow_mut();
139 inner.undo_log.push(UndoLog::PushTypeOutlivesConstraint);
140 inner.region_obligations.push(obligation);
141 }
142
143 pub fn register_solver_region_constraint(&self, c: SolverRegionConstraint<'tcx>) {
144 self.inner.borrow_mut().unwrap_region_constraints().register_solver_constraint(c);
145 }
146
147 pub fn register_type_outlives_constraint(
148 &self,
149 sup_type: Ty<'tcx>,
150 sub_region: Region<'tcx>,
151 cause: &ObligationCause<'tcx>,
152 ) {
153 if !!self.tcx.assumptions_on_binders() {
::core::panicking::panic("assertion failed: !self.tcx.assumptions_on_binders()")
};assert!(!self.tcx.assumptions_on_binders());
154
155 if sup_type.is_global() {
160 return;
161 }
162
163 {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:163",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(163u32),
::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);
164 let origin = SubregionOrigin::from_obligation_cause(cause, || {
165 SubregionOrigin::RelateParamBound(
166 cause.span,
167 sup_type,
168 match cause.code().peel_derives() {
169 ObligationCauseCode::WhereClause(_, span)
170 | ObligationCauseCode::WhereClauseInExpr(_, span, ..)
171 | ObligationCauseCode::OpaqueTypeBound(span, _)
172 if !span.is_dummy() =>
173 {
174 Some(*span)
175 }
176 _ => None,
177 },
178 )
179 });
180
181 self.register_type_outlives_constraint_inner(TypeOutlivesConstraint {
182 sup_type,
183 sub_region,
184 origin,
185 });
186 }
187
188 pub fn take_registered_region_obligations(&self) -> Vec<TypeOutlivesConstraint<'tcx>> {
190 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");
191 std::mem::take(&mut self.inner.borrow_mut().region_obligations)
192 }
193
194 pub fn num_registered_region_obligations(&self) -> usize {
195 self.inner.borrow().region_obligations.len()
196 }
197
198 pub fn registered_region_obligations_since(
199 &self,
200 prev: usize,
201 ) -> Vec<TypeOutlivesConstraint<'tcx>> {
202 self.inner.borrow().region_obligations.iter().skip(prev).cloned().collect()
203 }
204
205 pub fn clone_registered_region_obligations(&self) -> Vec<TypeOutlivesConstraint<'tcx>> {
206 self.inner.borrow().region_obligations.clone()
207 }
208
209 pub fn register_region_assumption(&self, assumption: ty::ArgOutlivesClause<'tcx>) {
210 let mut inner = self.inner.borrow_mut();
211 inner.undo_log.push(UndoLog::PushRegionAssumption);
212 inner.region_assumptions.push(assumption);
213 }
214
215 pub fn take_registered_region_assumptions(&self) -> Vec<ty::ArgOutlivesClause<'tcx>> {
216 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");
217 std::mem::take(&mut self.inner.borrow_mut().region_assumptions)
218 }
219
220 pub fn destructure_solver_region_constraints_for_regionck(
221 &self,
222 outlives_env: &OutlivesEnvironment<'tcx>,
223 ) {
224 let mut region_outlives = TransitiveRelationBuilder::default();
228 for (r1, r2) in outlives_env.free_region_map().relation.base_edges() {
229 region_outlives.add(r2, r1);
230 }
231 let assumptions = rustc_type_ir::region_constraint::Assumptions::new(
232 self,
233 assumed_type_outlives(
234 self.tcx,
235 outlives_env.known_type_outlives(),
236 outlives_env.region_bound_pairs(),
237 ),
238 region_outlives.freeze(),
239 ty::UniverseIndex::ROOT,
240 );
241 self.destructure_solver_region_constraints(assumptions, self);
242 }
243
244 pub fn destructure_solver_region_constraints_for_borrowck(
245 &self,
246 conversion: impl TypeOutlivesDelegate<'tcx>,
248 known_type_outlives: &[PolyTypeOutlivesClause<'tcx>],
249 region_bound_pairs: &RegionBoundPairs<'tcx>,
250 region_outlives: TransitiveRelation<RegionVid>,
251 ) {
252 let assumptions = region_constraint::Assumptions::new(
253 self,
254 assumed_type_outlives(self.tcx, known_type_outlives, region_bound_pairs),
255 region_outlives.maybe_map(|r| Some(Region::new_var(self.tcx, r))).unwrap(),
256 ty::UniverseIndex::ROOT,
257 );
258 self.destructure_solver_region_constraints(assumptions, conversion);
259 }
260
261 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(261u32),
::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()
}], ::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))])
})
} 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 constraint = self.get_solver_region_constraint();
{
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite =
{
static META: ::tracing::Metadata<'static> =
{
::tracing_core::metadata::Metadata::new("event /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:271",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(271u32),
::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 =
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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:277",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(277u32),
::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 { ; }
};
for c in
constraint.and_constraint.0.into_iter().chain(constraint.or_constraint.0.into_iter().flat_map(|and_constraint|
and_constraint.0.into_iter())) {
use LeafRegionConstraint::*;
match c {
Ambiguity(span) => {
self.dcx().struct_span_err(span,
"unable to satisfy constraints involving placeholders due to unknown implied bounds").emit();
}
RegionOutlives(a, b, span) => {
let origin = SubregionOrigin::SolverRegionConstraint(span);
let category = origin.to_constraint_category();
conversion.push_sub_region_constraint(origin, b, a,
category);
}
AliasTyOutlivesViaEnv(..) | PlaceholderTyOutlives(..) => {
::core::panicking::unreachable_default_msg()
}
}
}
}
}
}#[instrument(level = "debug", skip(self, conversion))]
262 pub fn destructure_solver_region_constraints(
263 &self,
264 assumptions: rustc_type_ir::region_constraint::Assumptions<TyCtxt<'tcx>>,
265 mut conversion: impl TypeOutlivesDelegate<'tcx>,
266 ) {
267 assert!(self.tcx.assumptions_on_binders());
268 assert!(self.next_trait_solver());
269
270 let constraint = self.get_solver_region_constraint();
271 debug!(?constraint);
272 let constraint = region_constraint::destructure_type_outlives_constraints_in_root(
273 self,
274 constraint,
275 &assumptions,
276 );
277 debug!(?constraint);
278
279 for c in constraint.and_constraint.0.into_iter().chain(
281 constraint
282 .or_constraint
283 .0
284 .into_iter()
285 .flat_map(|and_constraint| and_constraint.0.into_iter()),
286 ) {
287 use LeafRegionConstraint::*;
288
289 match c {
290 Ambiguity(span) => {
291 self.dcx()
292 .struct_span_err(
293 span,
294 "unable to satisfy constraints involving placeholders due to unknown implied bounds",
295 )
296 .emit();
297 }
298 RegionOutlives(a, b, span) => {
299 let origin = SubregionOrigin::SolverRegionConstraint(span);
300 let category = origin.to_constraint_category();
301 conversion.push_sub_region_constraint(
302 origin, b, a, category,
304 );
305 }
306 AliasTyOutlivesViaEnv(..) | PlaceholderTyOutlives(..) => {
307 unreachable!()
308 }
309 }
310 }
311 }
312
313 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(322u32),
::tracing_core::__macro_support::Option::Some("rustc_infer::infer::outlives::obligations"),
::tracing_core::field::FieldSet::new(&[],
::tracing_core::callsite::Identifier(&__CALLSITE)),
::tracing::metadata::Kind::SPAN)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let mut interest = ::tracing::subscriber::Interest::never();
if ::tracing::Level::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,
&{ meta.fields().value_set_all(&[]) })
} else {
let span =
::tracing::__macro_support::__disabled_span(__CALLSITE.metadata());
{};
span
}
};
__tracing_attr_guard = __tracing_attr_span.enter();
}
#[warn(clippy :: suspicious_else_formatting)]
{
#[allow(unknown_lints, unreachable_code, clippy ::
diverging_sub_expression, clippy :: empty_loop, clippy ::
let_unit_value, clippy :: let_with_type_underscore, clippy ::
needless_return, clippy :: unreachable)]
if false {
let __tracing_attr_fake_return: () = 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);
}
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_span::macros::bug_impl(None,
format_args!("unexpected overflowed when processing region obligations: {0:#?}",
my_region_obligations), Location::caller());
}
for TypeOutlivesConstraint { sup_type, sub_region, origin } in
my_region_obligations {
#[allow(rustc::usage_of_type_ir_traits)]
let (sup_type, sub_region) =
self.deeply_resolve_via_unification_table((sup_type,
sub_region));
if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions
&&
outlives_env.higher_ranked_assumptions().contains(&ty::OutlivesClause(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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:365",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(365u32),
::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);
}
}
}
}
}#[instrument(level = "debug", skip(self, outlives_env))]
323 pub fn process_registered_region_obligations(&self, outlives_env: &OutlivesEnvironment<'tcx>) {
324 assert!(!self.in_snapshot(), "cannot process registered region obligations in a snapshot");
325
326 if self.tcx.assumptions_on_binders() {
327 self.destructure_solver_region_constraints_for_regionck(outlives_env);
328 }
329
330 for iteration in 0.. {
332 let my_region_obligations = self.take_registered_region_obligations();
333 if my_region_obligations.is_empty() {
334 break;
335 }
336
337 if !self.tcx.recursion_limit().value_within_limit(iteration) {
338 bug!(
342 "unexpected overflowed when processing region obligations: {my_region_obligations:#?}"
343 );
344 }
345
346 for TypeOutlivesConstraint { sup_type, sub_region, origin } in my_region_obligations {
347 #[allow(rustc::usage_of_type_ir_traits)]
354 let (sup_type, sub_region) =
355 self.deeply_resolve_via_unification_table((sup_type, sub_region));
356
357 if self.tcx.sess.opts.unstable_opts.higher_ranked_assumptions
358 && outlives_env
359 .higher_ranked_assumptions()
360 .contains(&ty::OutlivesClause(sup_type.into(), sub_region))
361 {
362 continue;
363 }
364
365 debug!(?sup_type, ?sub_region, ?origin);
366
367 let outlives = &mut TypeOutlives::new(
368 self,
369 self.tcx,
370 outlives_env.region_bound_pairs(),
371 None,
372 outlives_env.known_type_outlives(),
373 );
374 let category = origin.to_constraint_category();
375 outlives.type_must_outlive(origin, sup_type, sub_region, category);
376 }
377 }
378 }
379}
380
381fn assumed_type_outlives<'tcx>(
389 tcx: TyCtxt<'tcx>,
390 known_type_outlives: &[PolyTypeOutlivesClause<'tcx>],
391 region_bound_pairs: &RegionBoundPairs<'tcx>,
392) -> Vec<ty::Clause<'tcx>> {
393 known_type_outlives
394 .iter()
395 .copied()
396 .chain(region_bound_pairs.iter().map(|&ty::OutlivesClause(kind, r)| {
397 ty::Binder::dummy(ty::OutlivesClause(kind.to_ty(tcx), r))
398 }))
399 .map(|c| c.map_bound(ty::ClauseKind::TypeOutlives).upcast(tcx))
400 .collect()
401}
402
403pub struct TypeOutlives<'cx, 'tcx, D>
410where
411 D: TypeOutlivesDelegate<'tcx>,
412{
413 delegate: D,
416 tcx: TyCtxt<'tcx>,
417 verify_bound: VerifyBoundCx<'cx, 'tcx>,
418}
419
420pub trait TypeOutlivesDelegate<'tcx> {
421 fn push_sub_region_constraint(
422 &mut self,
423 origin: SubregionOrigin<'tcx>,
424 a: ty::Region<'tcx>,
425 b: ty::Region<'tcx>,
426 constraint_category: ConstraintCategory<'tcx>,
427 );
428
429 fn push_verify(
430 &mut self,
431 origin: SubregionOrigin<'tcx>,
432 kind: GenericKind<'tcx>,
433 a: ty::Region<'tcx>,
434 bound: VerifyBound<'tcx>,
435 );
436}
437
438impl<'cx, 'tcx, D> TypeOutlives<'cx, 'tcx, D>
439where
440 D: TypeOutlivesDelegate<'tcx>,
441{
442 pub fn new(
443 delegate: D,
444 tcx: TyCtxt<'tcx>,
445 region_bound_pairs: &'cx RegionBoundPairs<'tcx>,
446 implicit_region_bound: Option<ty::Region<'tcx>>,
447 caller_bounds: &'cx [ty::PolyTypeOutlivesClause<'tcx>],
448 ) -> Self {
449 Self {
450 delegate,
451 tcx,
452 verify_bound: VerifyBoundCx::new(
453 tcx,
454 region_bound_pairs,
455 implicit_region_bound,
456 caller_bounds,
457 ),
458 }
459 }
460
461 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(469u32),
::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()")
};
if true {
if !!ty.has_non_region_infer() {
::core::panicking::panic("assertion failed: !ty.has_non_region_infer()")
};
};
if true {
if !(!self.tcx.next_trait_solver_globally() ||
!ty.has_non_rigid_aliases()) {
{
::core::panicking::panic_fmt(format_args!("{0:?} has non-rigid aliases",
ty));
}
};
};
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))]
470 pub fn type_must_outlive(
471 &mut self,
472 origin: infer::SubregionOrigin<'tcx>,
473 ty: Ty<'tcx>,
474 region: ty::Region<'tcx>,
475 category: ConstraintCategory<'tcx>,
476 ) {
477 assert!(!ty.has_escaping_bound_vars());
478 debug_assert!(!ty.has_non_region_infer());
479 debug_assert!(
480 !self.tcx.next_trait_solver_globally() || !ty.has_non_rigid_aliases(),
481 "{ty:?} has non-rigid aliases"
482 );
483
484 let mut components = smallvec![];
485 push_outlives_components(self.tcx, ty, &mut components);
486 self.components_must_outlive(origin, &components, region, category);
487 }
488
489 fn components_must_outlive(
490 &mut self,
491 origin: infer::SubregionOrigin<'tcx>,
492 components: &[Component<TyCtxt<'tcx>>],
493 region: ty::Region<'tcx>,
494 category: ConstraintCategory<'tcx>,
495 ) {
496 for component in components.iter() {
497 let origin = origin.clone();
498 match component {
499 Component::Region(region1) => {
500 self.delegate.push_sub_region_constraint(origin, region, *region1, category);
501 }
502 Component::Param(param_ty) => {
503 self.param_ty_must_outlive(origin, region, *param_ty);
504 }
505 Component::Placeholder(placeholder_ty) => {
506 self.placeholder_ty_must_outlive(origin, region, *placeholder_ty);
507 }
508 Component::Alias(is_rigid, alias_ty) => {
509 if true {
{
match (&*is_rigid, &ty::IsRigid::yes_if_next_solver(self.tcx)) {
(left_val, right_val) => {
if !(*left_val == *right_val) {
let kind = ::core::panicking::AssertKind::Eq;
::core::panicking::assert_failed(kind, &*left_val,
&*right_val, ::core::option::Option::None);
}
}
}
};
};debug_assert_eq!(*is_rigid, ty::IsRigid::yes_if_next_solver(self.tcx));
510 self.alias_ty_must_outlive(origin, region, *alias_ty);
511 }
512 Component::EscapingAlias(subcomponents) => {
513 self.components_must_outlive(origin, subcomponents, region, category);
514 }
515 Component::UnresolvedInferenceVariable(v) => {
516 self.tcx.dcx().span_delayed_bug(
520 origin.span(),
521 ::alloc::__export::must_use({
::alloc::fmt::format(format_args!("unresolved inference variable in outlives: {0:?}",
v))
})format!("unresolved inference variable in outlives: {v:?}"),
522 );
523 }
524 }
525 }
526 }
527
528 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(528u32),
::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))]
529 fn param_ty_must_outlive(
530 &mut self,
531 origin: infer::SubregionOrigin<'tcx>,
532 region: ty::Region<'tcx>,
533 param_ty: ty::ParamTy,
534 ) {
535 let verify_bound = self.verify_bound.param_or_placeholder_bound(param_ty.to_ty(self.tcx));
536 self.delegate.push_verify(origin, GenericKind::Param(param_ty), region, verify_bound);
537 }
538
539 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(539u32),
::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))]
540 fn placeholder_ty_must_outlive(
541 &mut self,
542 origin: infer::SubregionOrigin<'tcx>,
543 region: ty::Region<'tcx>,
544 placeholder_ty: ty::PlaceholderType<'tcx>,
545 ) {
546 let verify_bound = self
547 .verify_bound
548 .param_or_placeholder_bound(Ty::new_placeholder(self.tcx, placeholder_ty));
549 self.delegate.push_verify(
550 origin,
551 GenericKind::Placeholder(placeholder_ty),
552 region,
553 verify_bound,
554 );
555 }
556
557 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(557u32),
::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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:596",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(596u32),
::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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:602",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(602u32),
::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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:623",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/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(&["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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:654",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(654u32),
::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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:655",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(655u32),
::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 /rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs:667",
"rustc_infer::infer::outlives::obligations",
::tracing::Level::DEBUG,
::tracing_core::__macro_support::Option::Some("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(667u32),
::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))]
558 fn alias_ty_must_outlive(
559 &mut self,
560 origin: infer::SubregionOrigin<'tcx>,
561 region: ty::Region<'tcx>,
562 alias_ty: ty::AliasTy<'tcx>,
563 ) {
564 if alias_ty.args.is_empty() {
566 return;
567 }
568
569 if alias_ty.has_non_region_infer() {
570 self.tcx
571 .dcx()
572 .span_delayed_bug(origin.span(), "an alias has infers during region solving");
573 return;
574 }
575
576 let trait_bounds: Vec<_> =
594 rustc_type_ir::outlives::declared_bounds_from_definition(self.tcx, alias_ty).collect();
595
596 debug!(?trait_bounds);
597
598 let approx_env_bounds = self.verify_bound.approx_declared_bounds_from_env(alias_ty);
602 debug!(?approx_env_bounds);
603
604 let kind = alias_ty.kind;
619 if approx_env_bounds.is_empty()
620 && trait_bounds.is_empty()
621 && (alias_ty.has_infer_regions() || matches!(kind, ty::Opaque { .. }))
622 {
623 debug!("no declared bounds");
624 let opt_variances = self.tcx.opt_alias_variances(kind);
625 self.args_must_outlive(alias_ty.args, origin, region, opt_variances);
626 return;
627 }
628
629 if !trait_bounds.is_empty()
640 && trait_bounds[1..]
641 .iter()
642 .map(|r| Some(*r))
643 .chain(
644 approx_env_bounds.iter().map(|b| b.map_bound(|b| b.1).no_bound_vars()),
650 )
651 .all(|b| b == Some(trait_bounds[0]))
652 {
653 let unique_bound = trait_bounds[0];
654 debug!(?unique_bound);
655 debug!("unique declared bound appears in trait ref");
656 let category = origin.to_constraint_category();
657 self.delegate.push_sub_region_constraint(origin, region, unique_bound, category);
658 return;
659 }
660
661 let verify_bound = self.verify_bound.alias_bound(alias_ty);
667 debug!("alias_must_outlive: pushing {:?}", verify_bound);
668 self.delegate.push_verify(origin, GenericKind::Alias(alias_ty), region, verify_bound);
669 }
670
671 {}
#[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("/rustc-dev/76456a688bc0ed897fa23a677d4ddb5b3fdb575a/compiler/rustc_infer/src/infer/outlives/obligations.rs"),
::tracing_core::__macro_support::Option::Some(671u32),
::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))]
672 fn args_must_outlive(
673 &mut self,
674 args: GenericArgsRef<'tcx>,
675 origin: infer::SubregionOrigin<'tcx>,
676 region: ty::Region<'tcx>,
677 opt_variances: Option<&[ty::Variance]>,
678 ) {
679 let constraint = origin.to_constraint_category();
680 for (index, arg) in args.iter().enumerate() {
681 match arg.kind() {
682 GenericArgKind::Lifetime(lt) => {
683 let variance = if let Some(variances) = opt_variances {
684 variances[index]
685 } else {
686 ty::Invariant
687 };
688 if variance == ty::Invariant {
689 self.delegate.push_sub_region_constraint(
690 origin.clone(),
691 region,
692 lt,
693 constraint,
694 );
695 }
696 }
697 GenericArgKind::Type(ty) => {
698 self.type_must_outlive(origin.clone(), ty, region, constraint);
699 }
700 GenericArgKind::Const(_) => {
701 }
703 }
704 }
705 }
706}
707
708impl<'cx, 'tcx> TypeOutlivesDelegate<'tcx> for &'cx InferCtxt<'tcx> {
709 fn push_sub_region_constraint(
710 &mut self,
711 origin: SubregionOrigin<'tcx>,
712 a: ty::Region<'tcx>,
713 b: ty::Region<'tcx>,
714 _constraint_category: ConstraintCategory<'tcx>,
715 ) {
716 self.sub_regions(origin, a, b, ty::VisibleForLeakCheck::Unreachable)
718 }
719
720 fn push_verify(
721 &mut self,
722 origin: SubregionOrigin<'tcx>,
723 kind: GenericKind<'tcx>,
724 a: ty::Region<'tcx>,
725 bound: VerifyBound<'tcx>,
726 ) {
727 self.verify_generic_bound(origin, kind, a, bound)
728 }
729}