]> git.lizzy.rs Git - rust.git/commitdiff
Prefer `#![feature(bind_by_move_pattern_guards)]` over `-Z disable_ast_check_for_muta...
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 28 Sep 2018 13:38:42 +0000 (15:38 +0200)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Fri, 28 Sep 2018 13:40:10 +0000 (15:40 +0200)
src/librustc/session/config.rs
src/librustc/ty/context.rs
src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs
src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs
src/test/ui/nll/match-guards-partially-borrow.rs

index eb779e6382f4bebb5e7418f7645329cea222cc66..8c7445d860f6c8df0791d9204816e553d3dc221b 100644 (file)
@@ -1320,8 +1320,6 @@ fn parse_cross_lang_lto(slot: &mut CrossLangLto, v: Option<&str>) -> bool {
         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],
index 37ef408c6bdee6dcf8631f25b2b7649b6d735e7c..39a3e663a06c7201a8fc05fe2647623007b4d5e9 100644 (file)
@@ -1465,11 +1465,6 @@ pub fn allow_bind_by_move_patterns_with_guards(self) -> bool {
     /// 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
index 3f46b0e312d103787b5575cd836aa0d7681710b6..10a4678107e1c88cb44f69313055f20ced709ac8 100644 (file)
 // 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();
index 39d54f6e7ae28f65df90fda4a4f04ea7561ce7f4..6cbd493b9918207623952629ac01f00eb983f83b 100644 (file)
@@ -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() {
index 49846f620f0c010cbfd339f3d2a9651a54074679..f359800812c87a733ccf55b00b75a79cbcd0a041 100644 (file)
@@ -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) {