@@ -194,6 +194,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
194
194
Attribute :: Parsed ( AttributeKind :: TrackCaller ( attr_span) ) => {
195
195
self . check_track_caller ( hir_id, * attr_span, attrs, span, target)
196
196
}
197
+ Attribute :: Parsed ( AttributeKind :: NonExhaustive ( attr_span) ) => {
198
+ self . check_non_exhaustive ( hir_id, * attr_span, span, target, item)
199
+ }
197
200
Attribute :: Parsed (
198
201
AttributeKind :: RustcLayoutScalarValidRangeStart ( _num, attr_span)
199
202
| AttributeKind :: RustcLayoutScalarValidRangeEnd ( _num, attr_span) ,
@@ -237,7 +240,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
237
240
[ sym:: no_sanitize, ..] => {
238
241
self . check_no_sanitize ( attr, span, target)
239
242
}
240
- [ sym:: non_exhaustive, ..] => self . check_non_exhaustive ( hir_id, attr, span, target, item) ,
241
243
[ sym:: marker, ..] => self . check_marker ( hir_id, attr, span, target) ,
242
244
[ sym:: thread_local, ..] => self . check_thread_local ( attr, span, target) ,
243
245
[ sym:: doc, ..] => self . check_doc_attrs (
@@ -779,7 +781,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
779
781
fn check_non_exhaustive (
780
782
& self ,
781
783
hir_id : HirId ,
782
- attr : & Attribute ,
784
+ attr_span : Span ,
783
785
span : Span ,
784
786
target : Target ,
785
787
item : Option < ItemLike < ' _ > > ,
@@ -794,7 +796,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
794
796
&& fields. iter ( ) . any ( |f| f. default . is_some ( ) )
795
797
{
796
798
self . dcx ( ) . emit_err ( errors:: NonExhaustiveWithDefaultFieldValues {
797
- attr_span : attr . span ( ) ,
799
+ attr_span,
798
800
defn_span : span,
799
801
} ) ;
800
802
}
@@ -805,13 +807,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
805
807
// erroneously allowed it and some crates used it accidentally, to be compatible
806
808
// with crates depending on them, we can't throw an error here.
807
809
Target :: Field | Target :: Arm | Target :: MacroDef => {
808
- self . inline_attr_str_error_with_macro_def ( hir_id, attr . span ( ) , "non_exhaustive" ) ;
810
+ self . inline_attr_str_error_with_macro_def ( hir_id, attr_span , "non_exhaustive" ) ;
809
811
}
810
812
_ => {
811
- self . dcx ( ) . emit_err ( errors:: NonExhaustiveWrongLocation {
812
- attr_span : attr. span ( ) ,
813
- defn_span : span,
814
- } ) ;
813
+ self . dcx ( )
814
+ . emit_err ( errors:: NonExhaustiveWrongLocation { attr_span, defn_span : span } ) ;
815
815
}
816
816
}
817
817
}
0 commit comments