@@ -182,7 +182,6 @@ mod svh_visitor {
182
182
SawMod ,
183
183
SawForeignItem ,
184
184
SawItem ,
185
- SawDecl ,
186
185
SawTy ,
187
186
SawGenerics ,
188
187
SawFn ,
@@ -285,24 +284,13 @@ mod svh_visitor {
285
284
/// SawStmtComponent is analogous to SawExprComponent, but for statements.
286
285
#[ derive( Hash ) ]
287
286
pub enum SawStmtComponent {
288
- SawStmtDecl ,
289
287
SawStmtExpr ,
290
288
SawStmtSemi ,
291
289
}
292
290
293
- fn saw_stmt ( node : & Stmt_ ) -> SawStmtComponent {
294
- match * node {
295
- StmtDecl ( ..) => SawStmtDecl ,
296
- StmtExpr ( ..) => SawStmtExpr ,
297
- StmtSemi ( ..) => SawStmtSemi ,
298
- }
299
- }
300
-
301
291
impl < ' a , ' tcx > Visitor < ' a > for StrictVersionHashVisitor < ' a , ' tcx > {
302
- fn visit_nested_item ( & mut self , item : ItemId ) {
303
- let def_path = self . tcx . map . def_path_from_id ( item. id ) . unwrap ( ) ;
304
- debug ! ( "visit_nested_item: def_path={:?} st={:?}" , def_path, self . st) ;
305
- self . hash_def_path ( & def_path) ;
292
+ fn visit_nested_item ( & mut self , _: ItemId ) {
293
+ // Each item is hashed independently; ignore nested items.
306
294
}
307
295
308
296
fn visit_variant_data ( & mut self , s : & ' a VariantData , name : Name ,
@@ -362,7 +350,20 @@ mod svh_visitor {
362
350
363
351
fn visit_stmt ( & mut self , s : & ' a Stmt ) {
364
352
debug ! ( "visit_stmt: st={:?}" , self . st) ;
365
- SawStmt ( saw_stmt ( & s. node ) ) . hash ( self . st ) ; visit:: walk_stmt ( self , s)
353
+
354
+ // We don't want to modify the hash for decls, because
355
+ // they might be item decls (if they are local decls,
356
+ // we'll hash that fact in visit_local); but we do want to
357
+ // remember if this was a StmtExpr or StmtSemi (the later
358
+ // had an explicit semi-colon; this affects the typing
359
+ // rules).
360
+ match s. node {
361
+ StmtDecl ( ..) => ( ) ,
362
+ StmtExpr ( ..) => SawStmt ( SawStmtExpr ) . hash ( self . st ) ,
363
+ StmtSemi ( ..) => SawStmt ( SawStmtSemi ) . hash ( self . st ) ,
364
+ }
365
+
366
+ visit:: walk_stmt ( self , s)
366
367
}
367
368
368
369
fn visit_foreign_item ( & mut self , i : & ' a ForeignItem ) {
@@ -390,11 +391,6 @@ mod svh_visitor {
390
391
SawMod . hash ( self . st ) ; visit:: walk_mod ( self , m, n)
391
392
}
392
393
393
- fn visit_decl ( & mut self , d : & ' a Decl ) {
394
- debug ! ( "visit_decl: st={:?}" , self . st) ;
395
- SawDecl . hash ( self . st ) ; visit:: walk_decl ( self , d)
396
- }
397
-
398
394
fn visit_ty ( & mut self , t : & ' a Ty ) {
399
395
debug ! ( "visit_ty: st={:?}" , self . st) ;
400
396
SawTy . hash ( self . st ) ; visit:: walk_ty ( self , t)
0 commit comments