]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/lints.rs
Auto merge of #61587 - alexcrichton:distcheck-no-assertions, r=pietroalbini
[rust.git] / src / librustc_mir / lints.rs
index 572f7133cad84eb48190563dba2c3e491d97d006..e15c8a4b416643c1b807705fe60902e4cf4ee4df 100644 (file)
@@ -3,23 +3,23 @@
 use rustc::hir::intravisit::FnKind;
 use rustc::hir::map::blocks::FnLikeNode;
 use rustc::lint::builtin::UNCONDITIONAL_RECURSION;
-use rustc::mir::{self, Mir, TerminatorKind};
-use rustc::ty::{self, AssociatedItem, AssociatedItemContainer, Instance, TyCtxt};
+use rustc::mir::{self, Body, TerminatorKind};
+use rustc::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt};
 use rustc::ty::subst::InternalSubsts;
 
 pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-             mir: &Mir<'tcx>,
+             body: &Body<'tcx>,
              def_id: DefId) {
     let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
 
     if let Some(fn_like_node) = FnLikeNode::from_node(tcx.hir().get_by_hir_id(hir_id)) {
-        check_fn_for_unconditional_recursion(tcx, fn_like_node.kind(), mir, def_id);
+        check_fn_for_unconditional_recursion(tcx, fn_like_node.kind(), body, def_id);
     }
 }
 
 fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                         fn_kind: FnKind<'_>,
-                                        mir: &Mir<'tcx>,
+                                        body: &Body<'tcx>,
                                         def_id: DefId) {
     if let FnKind::Closure(_) = fn_kind {
         // closures can't recur, so they don't matter.
@@ -54,7 +54,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     // to have behaviour like the above, rather than
     // e.g., accidentally recursing after an assert.
 
-    let basic_blocks = mir.basic_blocks();
+    let basic_blocks = body.basic_blocks();
     let mut reachable_without_self_call_queue = vec![mir::START_BLOCK];
     let mut reached_exit_without_self_call = false;
     let mut self_call_locations = vec![];
@@ -63,8 +63,8 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let param_env = tcx.param_env(def_id);
     let trait_substs_count =
         match tcx.opt_associated_item(def_id) {
-            Some(AssociatedItem {
-                container: AssociatedItemContainer::TraitContainer(trait_def_id),
+            Some(AssocItem {
+                container: AssocItemContainer::TraitContainer(trait_def_id),
                 ..
             }) => tcx.generics_of(trait_def_id).count(),
             _ => 0
@@ -84,7 +84,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         if let Some(ref terminator) = block.terminator {
             match terminator.kind {
                 TerminatorKind::Call { ref func, .. } => {
-                    let func_ty = func.ty(mir, tcx);
+                    let func_ty = func.ty(body, tcx);
 
                     if let ty::FnDef(fn_def_id, substs) = func_ty.sty {
                         let (call_fn_id, call_substs) =