@@ -356,7 +356,7 @@ impl mem_categorization_ctxt {
356
356
// Convert a bare fn to a closure by adding NULL env.
357
357
// Result is an rvalue.
358
358
let expr_ty = ty:: expr_ty_adjusted ( self . tcx , expr) ;
359
- self . cat_rvalue_node ( expr, expr_ty)
359
+ self . cat_rvalue_node ( expr. id ( ) , expr . span ( ) , expr_ty)
360
360
}
361
361
362
362
ty:: AutoDerefRef ( ty:: AutoDerefRef {
@@ -365,7 +365,7 @@ impl mem_categorization_ctxt {
365
365
// Equivalent to &*expr or something similar.
366
366
// Result is an rvalue.
367
367
let expr_ty = ty:: expr_ty_adjusted ( self . tcx , expr) ;
368
- self . cat_rvalue_node ( expr, expr_ty)
368
+ self . cat_rvalue_node ( expr. id ( ) , expr . span ( ) , expr_ty)
369
369
}
370
370
371
371
ty:: AutoDerefRef ( ty:: AutoDerefRef {
@@ -398,7 +398,7 @@ impl mem_categorization_ctxt {
398
398
ast:: ExprUnary ( _, ast:: UnDeref , e_base) => {
399
399
let method_map = self . method_map . borrow ( ) ;
400
400
if method_map. get ( ) . contains_key ( & expr. id ) {
401
- return self . cat_rvalue_node ( expr, expr_ty) ;
401
+ return self . cat_rvalue_node ( expr. id ( ) , expr . span ( ) , expr_ty) ;
402
402
}
403
403
404
404
let base_cmt = self . cat_expr ( e_base) ;
@@ -418,7 +418,7 @@ impl mem_categorization_ctxt {
418
418
ast:: ExprIndex ( _, base, _) => {
419
419
let method_map = self . method_map . borrow ( ) ;
420
420
if method_map. get ( ) . contains_key ( & expr. id ) {
421
- return self . cat_rvalue_node ( expr, expr_ty) ;
421
+ return self . cat_rvalue_node ( expr. id ( ) , expr . span ( ) , expr_ty) ;
422
422
}
423
423
424
424
let base_cmt = self . cat_expr ( base) ;
@@ -444,7 +444,7 @@ impl mem_categorization_ctxt {
444
444
ast:: ExprLit ( ..) | ast:: ExprBreak ( ..) | ast:: ExprMac ( ..) |
445
445
ast:: ExprAgain ( ..) | ast:: ExprStruct ( ..) | ast:: ExprRepeat ( ..) |
446
446
ast:: ExprInlineAsm ( ..) | ast:: ExprBox ( ..) => {
447
- return self . cat_rvalue_node ( expr, expr_ty) ;
447
+ return self . cat_rvalue_node ( expr. id ( ) , expr . span ( ) , expr_ty) ;
448
448
}
449
449
450
450
ast:: ExprForLoop ( ..) => fail ! ( "non-desugared expr_for_loop" )
@@ -457,13 +457,18 @@ impl mem_categorization_ctxt {
457
457
expr_ty : ty:: t ,
458
458
def : ast:: Def )
459
459
-> cmt {
460
+ debug ! ( "cat_def: id={} expr={}" ,
461
+ id, ty_to_str( self . tcx, expr_ty) ) ;
462
+
463
+
460
464
match def {
465
+ ast:: DefStruct ( ..) | ast:: DefVariant ( ..) => {
466
+ self . cat_rvalue_node ( id, span, expr_ty)
467
+ }
461
468
ast:: DefFn ( ..) | ast:: DefStaticMethod ( ..) | ast:: DefMod ( _) |
462
469
ast:: DefForeignMod ( _) | ast:: DefStatic ( _, false ) |
463
- ast:: DefUse ( _) | ast:: DefVariant ( ..) |
464
- ast:: DefTrait ( _) | ast:: DefTy ( _) | ast:: DefPrimTy ( _) |
465
- ast:: DefTyParam ( ..) | ast:: DefStruct ( ..) |
466
- ast:: DefTyParamBinder ( ..) | ast:: DefRegion ( _) |
470
+ ast:: DefUse ( _) | ast:: DefTrait ( _) | ast:: DefTy ( _) | ast:: DefPrimTy ( _) |
471
+ ast:: DefTyParam ( ..) | ast:: DefTyParamBinder ( ..) | ast:: DefRegion ( _) |
467
472
ast:: DefLabel ( _) | ast:: DefSelfTy ( ..) | ast:: DefMethod ( ..) => {
468
473
@cmt_ {
469
474
id : id,
@@ -571,16 +576,13 @@ impl mem_categorization_ctxt {
571
576
}
572
577
}
573
578
574
- pub fn cat_rvalue_node < N : ast_node > ( & self ,
575
- node : & N ,
576
- expr_ty : ty:: t ) -> cmt {
577
- match self . tcx . region_maps . temporary_scope ( node. id ( ) ) {
579
+ pub fn cat_rvalue_node ( & self , id : ast:: NodeId , span : Span , expr_ty : ty:: t ) -> cmt {
580
+ match self . tcx . region_maps . temporary_scope ( id) {
578
581
Some ( scope) => {
579
- self . cat_rvalue ( node. id ( ) , node. span ( ) ,
580
- ty:: ReScope ( scope) , expr_ty)
582
+ self . cat_rvalue ( id, span, ty:: ReScope ( scope) , expr_ty)
581
583
}
582
584
None => {
583
- self . cat_rvalue ( node . id ( ) , node . span ( ) , ty:: ReStatic , expr_ty)
585
+ self . cat_rvalue ( id , span, ty:: ReStatic , expr_ty)
584
586
}
585
587
}
586
588
}
@@ -986,7 +988,7 @@ impl mem_categorization_ctxt {
986
988
}
987
989
for & slice_pat in slice. iter ( ) {
988
990
let slice_ty = self . pat_ty ( slice_pat) ;
989
- let slice_cmt = self . cat_rvalue_node ( pat, slice_ty) ;
991
+ let slice_cmt = self . cat_rvalue_node ( pat. id ( ) , pat . span ( ) , slice_ty) ;
990
992
self . cat_pattern ( slice_cmt, slice_pat, |x, y| op ( x, y) ) ;
991
993
}
992
994
for & after_pat in after. iter ( ) {
0 commit comments