]> git.lizzy.rs Git - rust.git/commitdiff
Remove functions to simplify
authorYuki OKUSHI <huyuumi.dev@gmail.com>
Tue, 30 Apr 2019 06:25:37 +0000 (15:25 +0900)
committerYuki OKUSHI <huyuumi.dev@gmail.com>
Tue, 30 Apr 2019 08:00:36 +0000 (17:00 +0900)
src/librustc/ty/context.rs
src/librustc_mir/hair/pattern/check_match.rs

index 132477547a0d86d999e5edc097d716d24983beb5..ba2fc05584ae644dffafe261a7c0ff6dbd5a8c50 100644 (file)
@@ -1486,26 +1486,6 @@ pub fn serialize_query_result_cache<E>(self,
         self.queries.on_disk_cache.serialize(self.global_tcx(), encoder)
     }
 
-    /// This checks whether one is allowed to have pattern bindings
-    /// that bind-by-move on a match arm that has a guard, e.g.:
-    ///
-    /// ```rust
-    /// match foo { A(inner) if { /* something */ } => ..., ... }
-    /// ```
-    ///
-    /// It is separate from check_for_mutation_in_guard_via_ast_walk,
-    /// because that method has a narrower effect that can be toggled
-    /// off via a separate `-Z` flag, at least for the short term.
-    pub fn allow_bind_by_move_patterns_with_guards(self) -> bool {
-        self.features().bind_by_move_pattern_guards
-    }
-
-    /// 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 {
-        !self.allow_bind_by_move_patterns_with_guards()
-    }
-
     /// If true, we should use the AST-based borrowck (we may *also* use
     /// the MIR-based borrowck).
     pub fn use_ast_borrowck(self) -> bool {
index 2d7f8b1a1aec9459f8b747bf05e0f101e445e523..d6a6b111f49a013cd8e52bddfa511bf55e287f8d 100644 (file)
@@ -147,7 +147,7 @@ fn check_match(
             // Second, if there is a guard on each arm, make sure it isn't
             // assigning or borrowing anything mutably.
             if let Some(ref guard) = arm.guard {
-                if self.tcx.check_for_mutation_in_guard_via_ast_walk() {
+                if !self.tcx.features().bind_by_move_pattern_guards {
                     check_for_mutation_in_guard(self, &guard);
                 }
             }
@@ -562,7 +562,7 @@ fn check_legality_of_move_bindings(
                              "cannot bind by-move with sub-bindings")
                 .span_label(p.span, "binds an already bound by-move value by moving it")
                 .emit();
-        } else if has_guard && !cx.tcx.allow_bind_by_move_patterns_with_guards() {
+        } else if has_guard && !cx.tcx.features().bind_by_move_pattern_guards {
             let mut err = struct_span_err!(cx.tcx.sess, p.span, E0008,
                                            "cannot bind by-move into a pattern guard");
             err.span_label(p.span, "moves value into pattern guard");