@@ -5,7 +5,7 @@ use std::io::{Read, Seek, Write};
55use std:: path:: { Path , PathBuf } ;
66use std:: sync:: Arc ;
77
8- use rustc_ast :: attr :: AttributeExt ;
8+ use rustc_attr_data_structures :: EncodeCrossCrate ;
99use rustc_data_structures:: fx:: { FxIndexMap , FxIndexSet } ;
1010use rustc_data_structures:: memmap:: { Mmap , MmapMut } ;
1111use rustc_data_structures:: sync:: { join, par_for_each_in} ;
@@ -839,9 +839,13 @@ struct AnalyzeAttrState<'a> {
839839/// visibility: this is a piece of data that can be computed once per defid, and not once per
840840/// attribute. Some attributes would only be usable downstream if they are public.
841841#[ inline]
842- fn analyze_attr ( attr : & impl AttributeExt , state : & mut AnalyzeAttrState < ' _ > ) -> bool {
842+ fn analyze_attr ( attr : & hir :: Attribute , state : & mut AnalyzeAttrState < ' _ > ) -> bool {
843843 let mut should_encode = false ;
844- if let Some ( name) = attr. name ( )
844+ if let hir:: Attribute :: Parsed ( p) = attr
845+ && p. encode_cross_crate ( ) == EncodeCrossCrate :: No
846+ {
847+ // Attributes not marked encode-cross-crate don't need to be encoded for downstream crates.
848+ } else if let Some ( name) = attr. name ( )
845849 && !rustc_feature:: encode_cross_crate ( name)
846850 {
847851 // Attributes not marked encode-cross-crate don't need to be encoded for downstream crates.
0 commit comments