Skip to content

Commit

Permalink
Emit EndRegion statements when given -Z mir-emit-validate=N (for …
Browse files Browse the repository at this point in the history
…N > 0).

This way the miri test suite does not have to be updated to explcitly
request `-Z emit-end-regions`.
  • Loading branch information
pnkfelix committed Sep 5, 2017
1 parent c11f3e3 commit f2892ad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ impl Session {
pub fn print_llvm_passes(&self) -> bool {
self.opts.debugging_opts.print_llvm_passes
}
pub fn emit_end_regions(&self) -> bool {
self.opts.debugging_opts.emit_end_regions ||
(self.opts.debugging_opts.mir_emit_validate > 0)
}
pub fn lto(&self) -> bool {
self.opts.cg.lto
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<'tcx> CFG<'tcx> {
block: BasicBlock,
source_info: SourceInfo,
region_scope: region::Scope) {
if tcx.sess.opts.debugging_opts.emit_end_regions {
if tcx.sess.emit_end_regions() {
self.push(block, Statement {
source_info,
kind: StatementKind::EndRegion(region_scope),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/clean_end_regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl MirPass for CleanEndRegions {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
_source: MirSource,
mir: &mut Mir<'tcx>) {
if !tcx.sess.opts.debugging_opts.emit_end_regions { return; }
if !tcx.sess.emit_end_regions() { return; }

let mut gather = GatherBorrowedRegions {
seen_regions: FxHashSet()
Expand Down

0 comments on commit f2892ad

Please sign in to comment.