1
Fork 0

Pass ConstraintCategory thorough a few more places

This commit is contained in:
Jack Huey 2022-09-16 16:44:18 -04:00
parent a46376e247
commit 6075877c89
3 changed files with 44 additions and 15 deletions

View file

@ -103,13 +103,13 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
bug!("query_constraint {:?} contained bound vars", query_constraint,);
});
let _constraint_category = query_constraint.1;
let constraint_category = query_constraint.1;
match k1.unpack() {
GenericArgKind::Lifetime(r1) => {
let r1_vid = self.to_region_vid(r1);
let r2_vid = self.to_region_vid(r2);
self.add_outlives(r1_vid, r2_vid);
self.add_outlives(r1_vid, r2_vid, constraint_category);
}
GenericArgKind::Type(t1) => {
@ -124,7 +124,7 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
Some(implicit_region_bound),
param_env,
)
.type_must_outlive(origin, t1, r2);
.type_must_outlive(origin, t1, r2, constraint_category);
}
GenericArgKind::Const(_) => {
@ -171,10 +171,19 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
}
}
fn add_outlives(&mut self, sup: ty::RegionVid, sub: ty::RegionVid) {
fn add_outlives(
&mut self,
sup: ty::RegionVid,
sub: ty::RegionVid,
category: ConstraintCategory<'tcx>,
) {
let category = match self.category {
ConstraintCategory::Boring | ConstraintCategory::BoringNoLocation => category,
_ => self.category,
};
self.constraints.outlives_constraints.push(OutlivesConstraint {
locations: self.locations,
category: self.category,
category,
span: self.span,
sub,
sup,
@ -194,10 +203,11 @@ impl<'a, 'b, 'tcx> TypeOutlivesDelegate<'tcx> for &'a mut ConstraintConversion<'
_origin: SubregionOrigin<'tcx>,
a: ty::Region<'tcx>,
b: ty::Region<'tcx>,
constraint_category: ConstraintCategory<'tcx>,
) {
let b = self.to_region_vid(b);
let a = self.to_region_vid(a);
self.add_outlives(b, a);
self.add_outlives(b, a, constraint_category);
}
fn push_verify(