about summary refs log tree commit diff
path: root/compiler/rustc_lint
diff options
context:
space:
mode:
authorBryan Garza <1396101+bryangarza@users.noreply.github.com>2022-12-07 20:13:22 +0000
committerBryan Garza <1396101+bryangarza@users.noreply.github.com>2022-12-21 03:39:33 +0000
commit2d060034f0fd5f5780c7fd41046901b8e0cdf7e8 (patch)
tree7c28ab790c359723d2c401232c50c7f08de1031d /compiler/rustc_lint
parente28a07a0a157b63dc11e9f590484d5332866623a (diff)
downloadrust-2d060034f0fd5f5780c7fd41046901b8e0cdf7e8.tar.gz
rust-2d060034f0fd5f5780c7fd41046901b8e0cdf7e8.zip
Update track_caller logic/lint after rebase
Diffstat (limited to 'compiler/rustc_lint')
-rw-r--r--compiler/rustc_lint/src/builtin.rs16
-rw-r--r--compiler/rustc_lint/src/lib.rs1
2 files changed, 13 insertions, 4 deletions
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index c353f742516..6d3e33f2b62 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -1397,7 +1397,7 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
         span: Span,
         hir_id: HirId,
     ) {
-        if let HirFnKind::ItemFn(_, _, _) = fn_kind && fn_kind.asyncness() == IsAsync::Async && !cx.tcx.features().closure_track_caller {
+        if fn_kind.asyncness() == IsAsync::Async && !cx.tcx.features().closure_track_caller {
             // Now, check if the function has the `#[track_caller]` attribute
             let attrs = cx.tcx.hir().attrs(hir_id);
             let maybe_track_caller = attrs.iter().find(|attr| attr.has_name(sym::track_caller));
@@ -1407,12 +1407,20 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
                     attr.span,
                     fluent::lint_ungated_async_fn_track_caller,
                     |lint| {
-                        lint.span_label(span, "this function will not propagate the caller location");
+                        lint.span_label(
+                            span,
+                            "this function will not propagate the caller location",
+                        );
                         if cx.tcx.sess.is_nightly_build() {
-                            lint.span_suggestion(attr.span, fluent::suggestion, "closure_track_caller", Applicability::MachineApplicable);
+                            lint.span_suggestion(
+                                attr.span,
+                                fluent::suggestion,
+                                "closure_track_caller",
+                                Applicability::MachineApplicable,
+                            );
                         }
                         lint
-                    }
+                    },
                 );
             }
         }
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 11022eb80ea..1275d6f223c 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -219,6 +219,7 @@ late_lint_methods!(
             // May Depend on constants elsewhere
             UnusedBrokenConst: UnusedBrokenConst,
             UnstableFeatures: UnstableFeatures,
+            UngatedAsyncFnTrackCaller: UngatedAsyncFnTrackCaller,
             ArrayIntoIter: ArrayIntoIter::default(),
             DropTraitConstraints: DropTraitConstraints,
             TemporaryCStringAsPtr: TemporaryCStringAsPtr,