Skip to content

Commit

Permalink
Remove -Znll-dont-emit-read-for-match
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewjasper committed Dec 25, 2019
1 parent 83a8200 commit 18df721
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
13 changes: 0 additions & 13 deletions src/librustc/ty/context.rs
Expand Up @@ -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 {
Expand Down
8 changes: 1 addition & 7 deletions src/librustc_mir/build/matches/mod.rs
Expand Up @@ -108,8 +108,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
scrutinee: ExprRef<'tcx>,
arms: Vec<Arm<'tcx>>,
) -> BlockAnd<()> {
let tcx = self.hir.tcx();

// Step 1. Evaluate the scrutinee and add the fake read of it.

let scrutinee_span = scrutinee.span();
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_session/options.rs
Expand Up @@ -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],
Expand Down

0 comments on commit 18df721

Please sign in to comment.