@@ -146,7 +146,7 @@ impl CheckAttrVisitor<'tcx> {
146146 } else if attr. check_name ( sym:: target_feature) {
147147 self . check_target_feature ( attr, span, target)
148148 } 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)
150150 } else {
151151 true
152152 } ;
@@ -190,21 +190,27 @@ impl CheckAttrVisitor<'tcx> {
190190 }
191191
192192 /// 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 {
194200 if target != Target :: Fn {
195201 struct_span_err ! (
196202 self . tcx. sess,
197- attr . span ,
203+ * attr_span ,
198204 E0739 ,
199205 "attribute should be applied to function"
200206 )
201- . span_label ( item . span , "not a function" )
207+ . span_label ( * span, "not a function" )
202208 . emit ( ) ;
203209 false
204- } else if attr:: contains_name ( & item . attrs , sym:: naked) {
210+ } else if attr:: contains_name ( attrs, sym:: naked) {
205211 struct_span_err ! (
206212 self . tcx. sess,
207- attr . span ,
213+ * attr_span ,
208214 E0736 ,
209215 "cannot use `#[track_caller]` with `#[naked]`" ,
210216 )
0 commit comments