diff options
| author | Ben Kimock <kimockb@gmail.com> | 2023-03-05 13:20:17 -0500 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2023-03-05 13:46:20 -0500 |
| commit | cb4ebc1453a69145d6602de798dc704871a200da (patch) | |
| tree | 0dd31d32391aefbca52cc00deeb25b857725c640 /compiler/rustc_const_eval | |
| parent | bb1838847d8bb568a1bd4c4c434c6173c174a496 (diff) | |
| download | rust-cb4ebc1453a69145d6602de798dc704871a200da.tar.gz rust-cb4ebc1453a69145d6602de798dc704871a200da.zip | |
Check for free regions in MIR validation
Diffstat (limited to 'compiler/rustc_const_eval')
| -rw-r--r-- | compiler/rustc_const_eval/src/transform/validate.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index fb37eb79a33..272fe3d1b31 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -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()), + ); + } + } + } } } |
