]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/upvar.rs
Remove unused parts of ExprUseVisitor
[rust.git] / src / librustc_typeck / check / upvar.rs
index 155cabb27a92f0f1a94b873ffa1edae6aad90f5a..c0fdd743286dd156fa3c144519e98c21edbecc3a 100644 (file)
@@ -64,7 +64,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
     }
 
     fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
-        if let hir::ExprKind::Closure(cc, _, body_id, _, _) = expr.node {
+        if let hir::ExprKind::Closure(cc, _, body_id, _, _) = expr.kind {
             let body = self.fcx.tcx.hir().body(body_id);
             self.visit_body(body);
             self.fcx
@@ -95,7 +95,7 @@ fn analyze_closure(
 
         // Extract the type of the closure.
         let ty = self.node_ty(closure_hir_id);
-        let (closure_def_id, substs) = match ty.sty {
+        let (closure_def_id, substs) = match ty.kind {
             ty::Closure(def_id, substs) => (def_id, UpvarSubsts::Closure(substs)),
             ty::Generator(def_id, substs, _) => (def_id, UpvarSubsts::Generator(substs)),
             ty::Error => {
@@ -321,7 +321,7 @@ fn adjust_upvar_borrow_kind_for_consume(
             euv::Copy => {
                 return;
             }
-            euv::Move(_) => {}
+            euv::Move => {}
         }
 
         let tcx = self.fcx.tcx;
@@ -408,8 +408,8 @@ fn adjust_upvar_borrow_kind_for_mut(&mut self, cmt: &mc::cmt_<'tcx>) {
 
             Categorization::Deref(_, mc::UnsafePtr(..))
             | Categorization::StaticItem
-            | Categorization::ThreadLocal(..)
-            | Categorization::Rvalue(..)
+            | Categorization::ThreadLocal
+            | Categorization::Rvalue
             | Categorization::Local(_)
             | Categorization::Upvar(..) => {
                 return;
@@ -439,8 +439,8 @@ fn adjust_upvar_borrow_kind_for_unique(&mut self, cmt: &mc::cmt_<'tcx>) {
 
             Categorization::Deref(_, mc::UnsafePtr(..))
             | Categorization::StaticItem
-            | Categorization::ThreadLocal(..)
-            | Categorization::Rvalue(..)
+            | Categorization::ThreadLocal
+            | Categorization::Rvalue
             | Categorization::Local(_)
             | Categorization::Upvar(..) => {}
         }
@@ -582,48 +582,13 @@ fn adjust_closure_kind(
 }
 
 impl<'a, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'tcx> {
-    fn consume(
-        &mut self,
-        _consume_id: hir::HirId,
-        _consume_span: Span,
-        cmt: &mc::cmt_<'tcx>,
-        mode: euv::ConsumeMode,
-    ) {
+    fn consume(&mut self, cmt: &mc::cmt_<'tcx>,mode: euv::ConsumeMode) {
         debug!("consume(cmt={:?},mode={:?})", cmt, mode);
         self.adjust_upvar_borrow_kind_for_consume(cmt, mode);
     }
 
-    fn matched_pat(
-        &mut self,
-        _matched_pat: &hir::Pat,
-        _cmt: &mc::cmt_<'tcx>,
-        _mode: euv::MatchMode,
-    ) {
-    }
-
-    fn consume_pat(
-        &mut self,
-        _consume_pat: &hir::Pat,
-        cmt: &mc::cmt_<'tcx>,
-        mode: euv::ConsumeMode,
-    ) {
-        debug!("consume_pat(cmt={:?},mode={:?})", cmt, mode);
-        self.adjust_upvar_borrow_kind_for_consume(cmt, mode);
-    }
-
-    fn borrow(
-        &mut self,
-        borrow_id: hir::HirId,
-        _borrow_span: Span,
-        cmt: &mc::cmt_<'tcx>,
-        _loan_region: ty::Region<'tcx>,
-        bk: ty::BorrowKind,
-        _loan_cause: euv::LoanCause,
-    ) {
-        debug!(
-            "borrow(borrow_id={}, cmt={:?}, bk={:?})",
-            borrow_id, cmt, bk
-        );
+    fn borrow(&mut self, cmt: &mc::cmt_<'tcx>, bk: ty::BorrowKind) {
+        debug!("borrow(cmt={:?}, bk={:?})", cmt, bk);
 
         match bk {
             ty::ImmBorrow => {}
@@ -636,15 +601,7 @@ fn borrow(
         }
     }
 
-    fn decl_without_init(&mut self, _id: hir::HirId, _span: Span) {}
-
-    fn mutate(
-        &mut self,
-        _assignment_id: hir::HirId,
-        _assignment_span: Span,
-        assignee_cmt: &mc::cmt_<'tcx>,
-        _mode: euv::MutateMode,
-    ) {
+    fn mutate(&mut self, assignee_cmt: &mc::cmt_<'tcx>) {
         debug!("mutate(assignee_cmt={:?})", assignee_cmt);
 
         self.adjust_upvar_borrow_kind_for_mut(assignee_cmt);