@@ -76,7 +76,7 @@ use syntax::parse::token;
76
76
pub enum categorization {
77
77
cat_rvalue( ty:: Region ) , // temporary val, argument is its scope
78
78
cat_static_item,
79
- cat_copied_upvar( CopiedUpvar ) , // upvar copied into @fn or ~fn env
79
+ cat_copied_upvar( CopiedUpvar ) , // upvar copied into proc env
80
80
cat_upvar( ty:: UpvarId , ty:: UpvarBorrow ) , // by ref upvar from stack closure
81
81
cat_local( ast:: NodeId ) , // local variable
82
82
cat_arg( ast:: NodeId ) , // formal argument
@@ -172,7 +172,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
172
172
ty:: ty_trait( ~ty:: TyTrait { store : ty:: UniqTraitStore , .. } ) |
173
173
ty:: ty_vec( _, ty:: VstoreUniq ) |
174
174
ty:: ty_str( ty:: VstoreUniq ) |
175
- ty:: ty_closure( ~ty:: ClosureTy { sigil : ast :: OwnedSigil , ..} ) => {
175
+ ty:: ty_closure( ~ty:: ClosureTy { store : ty :: UniqTraitStore , ..} ) => {
176
176
Some ( deref_ptr ( OwnedPtr ) )
177
177
}
178
178
@@ -187,8 +187,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
187
187
}
188
188
189
189
ty:: ty_str( ty:: VstoreSlice ( r, ( ) ) ) |
190
- ty:: ty_closure( ~ty:: ClosureTy { sigil : ast:: BorrowedSigil ,
191
- region : r, ..} ) => {
190
+ ty:: ty_closure( ~ty:: ClosureTy { store : ty:: RegionTraitStore ( r, _) , ..} ) => {
192
191
Some ( deref_ptr ( BorrowedPtr ( ty:: ImmBorrow , r) ) )
193
192
}
194
193
@@ -540,15 +539,14 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
540
539
// Decide whether to use implicit reference or by copy/move
541
540
// capture for the upvar. This, combined with the onceness,
542
541
// determines whether the closure can move out of it.
543
- let var_is_refd = match ( closure_ty. sigil , closure_ty. onceness ) {
542
+ let var_is_refd = match ( closure_ty. store , closure_ty. onceness ) {
544
543
// Many-shot stack closures can never move out.
545
- ( ast :: BorrowedSigil , ast:: Many ) => true ,
544
+ ( ty :: RegionTraitStore ( .. ) , ast:: Many ) => true ,
546
545
// 1-shot stack closures can move out.
547
- ( ast :: BorrowedSigil , ast:: Once ) => false ,
546
+ ( ty :: RegionTraitStore ( .. ) , ast:: Once ) => false ,
548
547
// Heap closures always capture by copy/move, and can
549
548
// move out if they are once.
550
- ( ast:: OwnedSigil , _) |
551
- ( ast:: ManagedSigil , _) => false ,
549
+ ( ty:: UniqTraitStore , _) => false ,
552
550
553
551
} ;
554
552
if var_is_refd {
@@ -688,19 +686,8 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
688
686
}
689
687
}
690
688
691
- pub fn cat_deref_fn_or_obj < N : ast_node > ( & mut self ,
692
- node : & N ,
693
- base_cmt : cmt ,
694
- deref_cnt : uint )
695
- -> cmt {
696
- // Bit of a hack: the "dereference" of a function pointer like
697
- // `@fn()` is a mere logical concept. We interpret it as
698
- // dereferencing the environment pointer; of course, we don't
699
- // know what type lies at the other end, so we just call it
700
- // `()` (the empty tuple).
701
-
702
- let opaque_ty = ty:: mk_tup ( self . tcx ( ) , Vec :: new ( ) ) ;
703
- self . cat_deref_common ( node, base_cmt, deref_cnt, opaque_ty)
689
+ pub fn cat_deref_obj < N : ast_node > ( & mut self , node : & N , base_cmt : cmt ) -> cmt {
690
+ self . cat_deref_common ( node, base_cmt, 0 , ty:: mk_nil ( ) )
704
691
}
705
692
706
693
fn cat_deref < N : ast_node > ( & mut self ,
@@ -1105,7 +1092,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
1105
1092
~"static item"
1106
1093
}
1107
1094
cat_copied_upvar( _) => {
1108
- ~"captured outer variable in a heap closure "
1095
+ ~"captured outer variable in a proc "
1109
1096
}
1110
1097
cat_rvalue( ..) => {
1111
1098
~"non-lvalue"
0 commit comments