@@ -18,16 +18,15 @@ use syntax::abi::Abi;
1818use syntax:: ast:: { self , Name , NodeId } ;
1919use syntax:: attr;
2020use syntax:: parse:: token;
21- use syntax:: symbol:: { Symbol , InternedString } ;
21+ use syntax:: symbol:: InternedString ;
2222use syntax_pos:: { Span , NO_EXPANSION , COMMAND_LINE_EXPN , BytePos } ;
2323use syntax:: tokenstream;
2424use rustc:: hir;
2525use rustc:: hir:: * ;
2626use rustc:: hir:: def:: Def ;
2727use rustc:: hir:: def_id:: DefId ;
28- use rustc:: hir:: intravisit as visit;
28+ use rustc:: hir:: intravisit:: { self as visit, Visitor } ;
2929use rustc:: ty:: TyCtxt ;
30- use rustc_data_structures:: fnv;
3130use std:: hash:: { Hash , Hasher } ;
3231
3332use super :: def_path_hash:: DefPathHashes ;
@@ -559,7 +558,7 @@ macro_rules! hash_span {
559558 } ) ;
560559}
561560
562- impl < ' a , ' hash , ' tcx > visit :: Visitor < ' tcx > for StrictVersionHashVisitor < ' a , ' hash , ' tcx > {
561+ impl < ' a , ' hash , ' tcx > Visitor < ' tcx > for StrictVersionHashVisitor < ' a , ' hash , ' tcx > {
563562 fn nested_visit_map < ' this > ( & ' this mut self ) -> visit:: NestedVisitorMap < ' this , ' tcx > {
564563 if self . hash_bodies {
565564 visit:: NestedVisitorMap :: OnlyBodies ( & self . tcx . hir )
@@ -960,50 +959,24 @@ impl<'a, 'hash, 'tcx> StrictVersionHashVisitor<'a, 'hash, 'tcx> {
960959 }
961960 }
962961
963- fn hash_meta_item ( & mut self , meta_item : & ast:: MetaItem ) {
964- debug ! ( "hash_meta_item: st={:?}" , self . st) ;
965-
966- // ignoring span information, it doesn't matter here
967- self . hash_discriminant ( & meta_item. node ) ;
968- meta_item. name . as_str ( ) . len ( ) . hash ( self . st ) ;
969- meta_item. name . as_str ( ) . hash ( self . st ) ;
970-
971- match meta_item. node {
972- ast:: MetaItemKind :: Word => { }
973- ast:: MetaItemKind :: NameValue ( ref lit) => saw_lit ( lit) . hash ( self . st ) ,
974- ast:: MetaItemKind :: List ( ref items) => {
975- // Sort subitems so the hash does not depend on their order
976- let indices = self . indices_sorted_by ( & items, |p| {
977- ( p. name ( ) . map ( Symbol :: as_str) , fnv:: hash ( & p. literal ( ) . map ( saw_lit) ) )
978- } ) ;
979- items. len ( ) . hash ( self . st ) ;
980- for ( index, & item_index) in indices. iter ( ) . enumerate ( ) {
981- index. hash ( self . st ) ;
982- let nested_meta_item: & ast:: NestedMetaItemKind = & items[ item_index] . node ;
983- self . hash_discriminant ( nested_meta_item) ;
984- match * nested_meta_item {
985- ast:: NestedMetaItemKind :: MetaItem ( ref meta_item) => {
986- self . hash_meta_item ( meta_item) ;
987- }
988- ast:: NestedMetaItemKind :: Literal ( ref lit) => {
989- saw_lit ( lit) . hash ( self . st ) ;
990- }
991- }
992- }
993- }
994- }
995- }
996-
997962 pub fn hash_attributes ( & mut self , attributes : & [ ast:: Attribute ] ) {
998963 debug ! ( "hash_attributes: st={:?}" , self . st) ;
999964 let indices = self . indices_sorted_by ( attributes, |attr| attr. name ( ) ) ;
1000965
1001966 for i in indices {
1002967 let attr = & attributes[ i] ;
1003- if !attr. is_sugared_doc &&
1004- !IGNORED_ATTRIBUTES . contains ( & & * attr. value . name ( ) . as_str ( ) ) {
968+ match attr. name ( ) {
969+ Some ( name) if IGNORED_ATTRIBUTES . contains ( & & * name. as_str ( ) ) => continue ,
970+ _ => { }
971+ } ;
972+ if !attr. is_sugared_doc {
1005973 SawAttribute ( attr. style ) . hash ( self . st ) ;
1006- self . hash_meta_item ( & attr. value ) ;
974+ for segment in & attr. path . segments {
975+ SawIdent ( segment. identifier . name . as_str ( ) ) . hash ( self . st ) ;
976+ }
977+ for tt in attr. tokens . trees ( ) {
978+ self . hash_token_tree ( & tt) ;
979+ }
1007980 }
1008981 }
1009982 }
0 commit comments