]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/check_const.rs
Auto merge of #28846 - Ms2ger:categorization, r=nikomatsakis
[rust.git] / src / librustc / middle / check_const.rs
index 2ce57ec862fd6275d2c4ed390cfe0baba27cf172..76fa54317fc1123cd59df792356aac98476b7f57 100644 (file)
@@ -32,6 +32,7 @@
 use middle::expr_use_visitor as euv;
 use middle::infer;
 use middle::mem_categorization as mc;
+use middle::mem_categorization::Categorization;
 use middle::traits;
 use middle::ty::{self, Ty};
 use util::nodemap::NodeMap;
@@ -855,7 +856,7 @@ fn consume(&mut self,
         let mut cur = &cmt;
         loop {
             match cur.cat {
-                mc::cat_static_item => {
+                Categorization::StaticItem => {
                     if self.mode != Mode::Var {
                         // statics cannot be consumed by value at any time, that would imply
                         // that they're an initializer (what a const is for) or kept in sync
@@ -866,13 +867,13 @@ fn consume(&mut self,
                     }
                     break;
                 }
-                mc::cat_deref(ref cmt, _, _) |
-                mc::cat_downcast(ref cmt, _) |
-                mc::cat_interior(ref cmt, _) => cur = cmt,
+                Categorization::Deref(ref cmt, _, _) |
+                Categorization::Downcast(ref cmt, _) |
+                Categorization::Interior(ref cmt, _) => cur = cmt,
 
-                mc::cat_rvalue(..) |
-                mc::cat_upvar(..) |
-                mc::cat_local(..) => break
+                Categorization::Rvalue(..) |
+                Categorization::Upvar(..) |
+                Categorization::Local(..) => break
             }
         }
     }
@@ -899,7 +900,7 @@ fn borrow(&mut self,
         let mut is_interior = false;
         loop {
             match cur.cat {
-                mc::cat_rvalue(..) => {
+                Categorization::Rvalue(..) => {
                     if loan_cause == euv::MatchDiscriminant {
                         // Ignore the dummy immutable borrow created by EUV.
                         break;
@@ -920,7 +921,7 @@ fn borrow(&mut self,
                     self.record_borrow(borrow_id, mutbl);
                     break;
                 }
-                mc::cat_static_item => {
+                Categorization::StaticItem => {
                     if is_interior && self.mode != Mode::Var {
                         // Borrowed statics can specifically *only* have their address taken,
                         // not any number of other borrows such as borrowing fields, reading
@@ -931,15 +932,15 @@ fn borrow(&mut self,
                     }
                     break;
                 }
-                mc::cat_deref(ref cmt, _, _) |
-                mc::cat_downcast(ref cmt, _) |
-                mc::cat_interior(ref cmt, _) => {
+                Categorization::Deref(ref cmt, _, _) |
+                Categorization::Downcast(ref cmt, _) |
+                Categorization::Interior(ref cmt, _) => {
                     is_interior = true;
                     cur = cmt;
                 }
 
-                mc::cat_upvar(..) |
-                mc::cat_local(..) => break
+                Categorization::Upvar(..) |
+                Categorization::Local(..) => break
             }
         }
     }