@@ -7,6 +7,7 @@ use clippy_utils::{
7
7
get_path_from_caller_to_method_type, is_adjusted, is_no_std_crate, path_to_local, path_to_local_id,
8
8
} ;
9
9
use rustc_abi:: ExternAbi ;
10
+ use rustc_attr_data_structures:: { AttributeKind , find_attr} ;
10
11
use rustc_errors:: Applicability ;
11
12
use rustc_hir:: { BindingMode , Expr , ExprKind , FnRetTy , GenericArgs , Param , PatKind , QPath , Safety , TyKind } ;
12
13
use rustc_infer:: infer:: TyCtxtInferExt ;
@@ -155,7 +156,7 @@ fn check_closure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tcx
155
156
let sig = match callee_ty_adjusted. kind ( ) {
156
157
ty:: FnDef ( def, _) => {
157
158
// Rewriting `x(|| f())` to `x(f)` where f is marked `#[track_caller]` moves the `Location`
158
- if cx. tcx . has_attr ( * def, sym :: track_caller ) {
159
+ if find_attr ! ( cx. tcx. get_all_attrs ( * def) , AttributeKind :: TrackCaller ( .. ) ) {
159
160
return ;
160
161
}
161
162
@@ -236,7 +237,7 @@ fn check_closure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tcx
236
237
} ,
237
238
ExprKind :: MethodCall ( path, self_, args, _) if check_inputs ( typeck, body. params , Some ( self_) , args) => {
238
239
if let Some ( method_def_id) = typeck. type_dependent_def_id ( body. value . hir_id )
239
- && !cx. tcx . has_attr ( method_def_id, sym :: track_caller )
240
+ && !find_attr ! ( cx. tcx. get_all_attrs ( method_def_id) , AttributeKind :: TrackCaller ( .. ) )
240
241
&& check_sig ( closure_sig, cx. tcx . fn_sig ( method_def_id) . skip_binder ( ) . skip_binder ( ) )
241
242
{
242
243
let mut app = Applicability :: MachineApplicable ;
0 commit comments