Skip to content

Commit 5b08200

Browse files
committed
Rollup merge of #54676 - pnkfelix:issue-15287-kill-zflag-disabling-ast-check, r=alexcrichton
Remove `-Z disable_ast_check_for_mutation_in_guard` One should use `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_ast_check_for_mutation_in_guard` cc #15287
2 parents 4433116 + f9ff7b7 commit 5b08200

5 files changed

+5
-13
lines changed

src/librustc/session/config.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13221322
useful for profiling / PGO."),
13231323
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
13241324
"choose which RELRO level to use"),
1325-
disable_ast_check_for_mutation_in_guard: bool = (false, parse_bool, [UNTRACKED],
1326-
"skip AST-based mutation-in-guard check (mir-borrowck provides more precise check)"),
13271325
nll_subminimal_causes: bool = (false, parse_bool, [UNTRACKED],
13281326
"when tracking region error causes, accept subminimal results for faster execution."),
13291327
nll_facts: bool = (false, parse_bool, [UNTRACKED],

src/librustc/ty/context.rs

-5
Original file line numberDiff line numberDiff line change
@@ -1467,11 +1467,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
14671467
/// If true, we should use a naive AST walk to determine if match
14681468
/// guard could perform bad mutations (or mutable-borrows).
14691469
pub fn check_for_mutation_in_guard_via_ast_walk(self) -> bool {
1470-
// If someone passes the `-Z` flag, they're asking for the footgun.
1471-
if self.sess.opts.debugging_opts.disable_ast_check_for_mutation_in_guard {
1472-
return false;
1473-
}
1474-
14751470
// If someone requests the feature, then be a little more
14761471
// careful and ensure that MIR-borrowck is enabled (which can
14771472
// happen via edition selection, via `feature(nll)`, or via an

src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@
1212
// This test illustrates that under NLL, we can remove our overly
1313
// conservative approach for disallowing mutations of match inputs.
1414

15-
// See further discussion on rust-lang/rust#24535 and
16-
// rust-lang/rfcs#1006.
17-
18-
// compile-flags: -Z disable-ast-check-for-mutation-in-guard
15+
// See further discussion on rust-lang/rust#24535,
16+
// rust-lang/rfcs#1006, and rust-lang/rfcs#107
1917

2018
#![feature(nll)]
19+
#![feature(bind_by_move_pattern_guards)]
2120

2221
fn main() {
2322
rust_issue_24535();

src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
// reject it. But I want to make sure that we continue to reject it
1616
// (under NLL) even when that conservaive check goes away.
1717

18-
// compile-flags: -Z disable-ast-check-for-mutation-in-guard
1918

19+
#![feature(bind_by_move_pattern_guards)]
2020
#![feature(nll)]
2121

2222
fn main() {

src/test/ui/nll/match-guards-partially-borrow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Test that we don't allow mutating the value being matched on in a way that
66
// changes which patterns it matches, until we have chosen an arm.
77

8-
// compile-flags: -Zdisable-ast-check-for-mutation-in-guard
98

9+
#![feature(bind_by_move_pattern_guards)]
1010
#![feature(nll)]
1111

1212
fn ok_mutation_in_guard(mut q: i32) {

0 commit comments

Comments
 (0)