diff options
| author | kennytm <kennytm@gmail.com> | 2018-10-01 17:49:33 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-10-01 17:49:33 +0800 |
| commit | 5b08200223d7307edca13a925a4ae58a68bc9872 (patch) | |
| tree | 867c17d68b0dce674e3ed4905b07d726ec4171ce | |
| parent | 4433116da136e2e5ef388402b8e9d21f9787034c (diff) | |
| parent | f9ff7b7336fef738caba56f1eabe72a299f2e136 (diff) | |
| download | rust-5b08200223d7307edca13a925a4ae58a68bc9872.tar.gz rust-5b08200223d7307edca13a925a4ae58a68bc9872.zip | |
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
5 files changed, 5 insertions, 13 deletions
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 5ca2bfebbeb..c532b5ee56f 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1322,8 +1322,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, useful for profiling / PGO."), relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED], "choose which RELRO level to use"), - disable_ast_check_for_mutation_in_guard: bool = (false, parse_bool, [UNTRACKED], - "skip AST-based mutation-in-guard check (mir-borrowck provides more precise check)"), nll_subminimal_causes: bool = (false, parse_bool, [UNTRACKED], "when tracking region error causes, accept subminimal results for faster execution."), nll_facts: bool = (false, parse_bool, [UNTRACKED], diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 63408d809ec..64e9d15092e 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1467,11 +1467,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// If true, we should use a naive AST walk to determine if match /// guard could perform bad mutations (or mutable-borrows). pub fn check_for_mutation_in_guard_via_ast_walk(self) -> bool { - // If someone passes the `-Z` flag, they're asking for the footgun. - if self.sess.opts.debugging_opts.disable_ast_check_for_mutation_in_guard { - return false; - } - // If someone requests the feature, then be a little more // careful and ensure that MIR-borrowck is enabled (which can // happen via edition selection, via `feature(nll)`, or via an diff --git a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs index 3f46b0e312d..10a4678107e 100644 --- a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs +++ b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs @@ -12,12 +12,11 @@ // This test illustrates that under NLL, we can remove our overly // conservative approach for disallowing mutations of match inputs. -// See further discussion on rust-lang/rust#24535 and -// rust-lang/rfcs#1006. - -// compile-flags: -Z disable-ast-check-for-mutation-in-guard +// See further discussion on rust-lang/rust#24535, +// rust-lang/rfcs#1006, and rust-lang/rfcs#107 #![feature(nll)] +#![feature(bind_by_move_pattern_guards)] fn main() { rust_issue_24535(); diff --git a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs index 39d54f6e7ae..6cbd493b991 100644 --- a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs +++ b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs @@ -15,8 +15,8 @@ // reject it. But I want to make sure that we continue to reject it // (under NLL) even when that conservaive check goes away. -// compile-flags: -Z disable-ast-check-for-mutation-in-guard +#![feature(bind_by_move_pattern_guards)] #![feature(nll)] fn main() { diff --git a/src/test/ui/nll/match-guards-partially-borrow.rs b/src/test/ui/nll/match-guards-partially-borrow.rs index 49846f620f0..f359800812c 100644 --- a/src/test/ui/nll/match-guards-partially-borrow.rs +++ b/src/test/ui/nll/match-guards-partially-borrow.rs @@ -5,8 +5,8 @@ // Test that we don't allow mutating the value being matched on in a way that // changes which patterns it matches, until we have chosen an arm. -// compile-flags: -Zdisable-ast-check-for-mutation-in-guard +#![feature(bind_by_move_pattern_guards)] #![feature(nll)] fn ok_mutation_in_guard(mut q: i32) { |
