Check for free regions in MIR validation
This commit is contained in:
parent
bb1838847d
commit
cb4ebc1453
2 changed files with 11 additions and 6 deletions
|
@ -72,6 +72,17 @@ impl<'tcx> MirPass<'tcx> for Validator {
|
|||
};
|
||||
checker.visit_body(body);
|
||||
checker.check_cleanup_control_flow();
|
||||
|
||||
if let MirPhase::Runtime(_) = body.phase {
|
||||
if let ty::InstanceDef::Item(_) = body.source.instance {
|
||||
if body.has_free_regions() {
|
||||
checker.fail(
|
||||
Location::START,
|
||||
format!("Free regions in optimized {} MIR", body.phase.name()),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue