@@ -146,7 +146,7 @@ impl CheckAttrVisitor<'tcx> {
146
146
} else if attr. check_name ( sym:: target_feature) {
147
147
self . check_target_feature ( attr, span, target)
148
148
} else if attr. check_name ( sym:: track_caller) {
149
- self . check_track_caller ( attr, & item , target)
149
+ self . check_track_caller ( & attr. span , attrs , span , target)
150
150
} else {
151
151
true
152
152
} ;
@@ -190,21 +190,27 @@ impl CheckAttrVisitor<'tcx> {
190
190
}
191
191
192
192
/// Checks if a `#[track_caller]` is applied to a non-naked function. Returns `true` if valid.
193
- fn check_track_caller ( & self , attr : & hir:: Attribute , item : & hir:: Item , target : Target ) -> bool {
193
+ fn check_track_caller (
194
+ & self ,
195
+ attr_span : & Span ,
196
+ attrs : & HirVec < Attribute > ,
197
+ span : & Span ,
198
+ target : Target ,
199
+ ) -> bool {
194
200
if target != Target :: Fn {
195
201
struct_span_err ! (
196
202
self . tcx. sess,
197
- attr . span ,
203
+ * attr_span ,
198
204
E0739 ,
199
205
"attribute should be applied to function"
200
206
)
201
- . span_label ( item . span , "not a function" )
207
+ . span_label ( * span, "not a function" )
202
208
. emit ( ) ;
203
209
false
204
- } else if attr:: contains_name ( & item . attrs , sym:: naked) {
210
+ } else if attr:: contains_name ( attrs, sym:: naked) {
205
211
struct_span_err ! (
206
212
self . tcx. sess,
207
- attr . span ,
213
+ * attr_span ,
208
214
E0736 ,
209
215
"cannot use `#[track_caller]` with `#[naked]`" ,
210
216
)
0 commit comments