@@ -285,11 +285,6 @@ impl<'sess> AttributeParser<'sess> {
285285 mut emit_lint : impl FnMut ( LintId , MultiSpan , EmitAttribute ) ,
286286 ) -> Vec < Attribute > {
287287 let mut attributes = Vec :: new ( ) ;
288- // We store the attributes we intend to discard at the end of this function in order to
289- // check they are applied to the right target and error out if necessary. In practice, we
290- // end up dropping only derive attributes and derive helpers, both being fully processed
291- // at macro expansion.
292- let mut dropped_attributes = Vec :: new ( ) ;
293288 let mut attr_paths: Vec < RefPathParser < ' _ > > = Vec :: new ( ) ;
294289 let mut early_parsed_state = EarlyParsedState :: default ( ) ;
295290
@@ -437,20 +432,8 @@ impl<'sess> AttributeParser<'sess> {
437432 self . check_invalid_crate_level_attr_item ( & attr, n. item . span ( ) ) ;
438433 }
439434
440- let attr = Attribute :: Unparsed ( Box :: new ( attr) ) ;
441-
442- if self . tools . is_some_and ( |tools| {
443- tools. iter ( ) . any ( |tool| tool. name == parts[ 0 ] )
444- // FIXME: this can be removed once #152369 has been merged.
445- // https://github.com/rust-lang/rust/pull/152369
446- || [ sym:: allow, sym:: deny, sym:: expect, sym:: forbid, sym:: warn]
447- . contains ( & parts[ 0 ] )
448- } ) {
449- attributes. push ( attr) ;
450- } else {
451- dropped_attributes. push ( attr) ;
452- }
453- }
435+ attributes. push ( Attribute :: Unparsed ( Box :: new ( attr) ) ) ;
436+ } ;
454437 }
455438 }
456439 }
@@ -466,7 +449,7 @@ impl<'sess> AttributeParser<'sess> {
466449 }
467450
468451 if !matches ! ( self . should_emit, ShouldEmit :: Nothing ) && target == Target :: WherePredicate {
469- self . check_invalid_where_predicate_attrs ( attributes. iter ( ) . chain ( & dropped_attributes ) ) ;
452+ self . check_invalid_where_predicate_attrs ( attributes. iter ( ) ) ;
470453 }
471454
472455 attributes
0 commit comments