Update track_caller logic/lint after rebase
This commit is contained in:
parent
e28a07a0a1
commit
2d060034f0
5 changed files with 52 additions and 37 deletions
|
@ -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
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue