@@ -18,7 +18,7 @@ use rustc_feature::BUILTIN_ATTRIBUTE_MAP;
1818use rustc_hir:: attrs:: diagnostic:: Directive ;
1919use rustc_hir:: attrs:: {
2020 AttributeKind , DocAttribute , DocInline , EiiDecl , EiiImpl , EiiImplResolution , InlineAttr ,
21- ReprAttr , SanitizerSet ,
21+ ReprAttr ,
2222} ;
2323use rustc_hir:: def:: DefKind ;
2424use rustc_hir:: def_id:: LocalModDefId ;
@@ -227,9 +227,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
227227 }
228228 & AttributeKind :: FfiPure ( attr_span) => self . check_ffi_pure ( attr_span, attrs) ,
229229 AttributeKind :: MayDangle ( attr_span) => self . check_may_dangle ( hir_id, * attr_span) ,
230- & AttributeKind :: Sanitize { on_set, off_set, rtsan : _, span : attr_span } => {
231- self . check_sanitize ( attr_span, on_set | off_set, span, target) ;
232- }
233230 AttributeKind :: Link ( _, attr_span) => self . check_link ( hir_id, * attr_span, target) ,
234231 AttributeKind :: MacroExport { span, .. } => {
235232 self . check_macro_export ( hir_id, * span, target)
@@ -401,6 +398,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
401398 AttributeKind :: RustcThenThisWouldNeed ( ..) => ( ) ,
402399 AttributeKind :: RustcTrivialFieldReads => ( ) ,
403400 AttributeKind :: RustcUnsafeSpecializationMarker => ( ) ,
401+ AttributeKind :: Sanitize { .. } => { }
404402 AttributeKind :: ShouldPanic { .. } => ( ) ,
405403 AttributeKind :: Stability { .. } => ( ) ,
406404 AttributeKind :: TestRunner ( ..) => ( ) ,
@@ -627,52 +625,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
627625 }
628626 }
629627
630- /// Checks that the `#[sanitize(..)]` attribute is applied to a
631- /// function/closure/method, or to an impl block or module.
632- fn check_sanitize (
633- & self ,
634- attr_span : Span ,
635- set : SanitizerSet ,
636- target_span : Span ,
637- target : Target ,
638- ) {
639- let mut not_fn_impl_mod = None ;
640- let mut no_body = None ;
641-
642- match target {
643- Target :: Fn
644- | Target :: Closure
645- | Target :: Method ( MethodKind :: Trait { body : true } | MethodKind :: Inherent )
646- | Target :: Impl { .. }
647- | Target :: Mod => return ,
648- Target :: Static
649- // if we mask out the address bits, i.e. *only* address was set,
650- // we allow it
651- if set & !( SanitizerSet :: ADDRESS | SanitizerSet :: KERNELADDRESS )
652- == SanitizerSet :: empty ( ) =>
653- {
654- return ;
655- }
656-
657- // These are "functions", but they aren't allowed because they don't
658- // have a body, so the usual explanation would be confusing.
659- Target :: Method ( MethodKind :: Trait { body : false } ) | Target :: ForeignFn => {
660- no_body = Some ( target_span) ;
661- }
662-
663- _ => {
664- not_fn_impl_mod = Some ( target_span) ;
665- }
666- }
667-
668- self . dcx ( ) . emit_err ( errors:: SanitizeAttributeNotAllowed {
669- attr_span,
670- not_fn_impl_mod,
671- no_body,
672- help : ( ) ,
673- } ) ;
674- }
675-
676628 /// Checks if `#[naked]` is applied to a function definition.
677629 fn check_naked ( & self , hir_id : HirId , target : Target ) {
678630 match target {
0 commit comments