From 18df72142ae7694c5661f0feb7d78ffc7b433e6b Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Tue, 24 Dec 2019 14:31:03 +0000 Subject: [PATCH] Remove `-Znll-dont-emit-read-for-match` --- src/librustc/ty/context.rs | 13 ------------- src/librustc_mir/build/matches/mod.rs | 8 +------- src/librustc_session/options.rs | 2 -- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 39341de6367f..e99e00a366d3 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1370,19 +1370,6 @@ impl<'tcx> TyCtxt<'tcx> { self.borrowck_mode().migrate() } - /// If `true`, make MIR codegen for `match` emit a temp that holds a - /// borrow of the input to the match expression. - pub fn generate_borrow_of_any_match_input(&self) -> bool { - self.emit_read_for_match() - } - - /// If `true`, make MIR codegen for `match` emit FakeRead - /// statements (which simulate the maximal effect of executing the - /// patterns in a match arm). - pub fn emit_read_for_match(&self) -> bool { - !self.sess.opts.debugging_opts.nll_dont_emit_read_for_match - } - /// What mode(s) of borrowck should we run? AST? MIR? both? /// (Also considers the `#![feature(nll)]` setting.) pub fn borrowck_mode(&self) -> BorrowckMode { diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index e1a51e2fb35e..60049a3a9fe4 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -108,8 +108,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { scrutinee: ExprRef<'tcx>, arms: Vec>, ) -> BlockAnd<()> { - let tcx = self.hir.tcx(); - // Step 1. Evaluate the scrutinee and add the fake read of it. let scrutinee_span = scrutinee.span(); @@ -183,11 +181,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { // The set of places that we are creating fake borrows of. If there are // no match guards then we don't need any fake borrows, so don't track // them. - let mut fake_borrows = if match_has_guard && tcx.generate_borrow_of_any_match_input() { - Some(FxHashSet::default()) - } else { - None - }; + let mut fake_borrows = if match_has_guard { Some(FxHashSet::default()) } else { None }; // These candidates are kept sorted such that the highest priority // candidate comes first in the list. (i.e., same order as in source) diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs index c90213f09582..38c17bbbde79 100644 --- a/src/librustc_session/options.rs +++ b/src/librustc_session/options.rs @@ -872,8 +872,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "choose which RELRO level to use"), nll_facts: bool = (false, parse_bool, [UNTRACKED], "dump facts from NLL analysis into side files"), - nll_dont_emit_read_for_match: bool = (false, parse_bool, [UNTRACKED], - "in match codegen, do not include FakeRead statements (used by mir-borrowck)"), dont_buffer_diagnostics: bool = (false, parse_bool, [UNTRACKED], "emit diagnostics rather than buffering (breaks NLL error downgrading, sorting)."), polonius: bool = (false, parse_bool, [UNTRACKED],