summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/lints.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_mir_build/src/lints.rs')
-rw-r--r--compiler/rustc_mir_build/src/lints.rs24
1 files changed, 14 insertions, 10 deletions
diff --git a/compiler/rustc_mir_build/src/lints.rs b/compiler/rustc_mir_build/src/lints.rs
index 54d549fd66c..b21f30efce8 100644
--- a/compiler/rustc_mir_build/src/lints.rs
+++ b/compiler/rustc_mir_build/src/lints.rs
@@ -36,16 +36,20 @@ pub(crate) fn check<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
 
         let sp = tcx.def_span(def_id);
         let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
-        tcx.struct_span_lint_hir(UNCONDITIONAL_RECURSION, hir_id, sp, |lint| {
-            let mut db = lint.build("function cannot return without recursing");
-            db.span_label(sp, "cannot return without recursing");
-            // offer some help to the programmer.
-            for call_span in vis.reachable_recursive_calls {
-                db.span_label(call_span, "recursive call site");
-            }
-            db.help("a `loop` may express intention better if this is on purpose");
-            db.emit();
-        });
+        tcx.struct_span_lint_hir(
+            UNCONDITIONAL_RECURSION,
+            hir_id,
+            sp,
+            "function cannot return without recursing",
+            |lint| {
+                lint.span_label(sp, "cannot return without recursing");
+                // offer some help to the programmer.
+                for call_span in vis.reachable_recursive_calls {
+                    lint.span_label(call_span, "recursive call site");
+                }
+                lint.help("a `loop` may express intention better if this is on purpose")
+            },
+        );
     }
 }