Skip to content

Commit

Permalink
Change constant lifetime analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed Oct 10, 2023
1 parent 7e19cc7 commit 9e79e87
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,12 @@ impl<'tcx> Visitor<'tcx> for ConstantRegionCollector<'_, 'tcx> {
self.super_rvalue(rvalue, location);
if let Rvalue::Use(Operand::Constant(constant)) = rvalue {
for r in constant.ty().walk().flat_map(|ga| ga.as_region()) {
assert!(r.is_var(), "{r:?} in {constant:?}");
self.map.set(r.as_var(), RegionKind::ConstRef(false));
// We may run into non-var regions here, e.g. assigning a const closure to a local where
// the closure captures state and thus that has e.g. `BrNamed` regions.
if r.is_var() {
// assert!(r.is_var(), "{r:?} in {constant:?} ({:?} at {location:?})", constant.ty());
self.map.set(r.as_var(), RegionKind::ConstRef(false));
}
}
}
}
Expand Down

0 comments on commit 9e79e87

Please sign in to comment.