@@ -76,7 +76,7 @@ use syntax::parse::token;
7676pub enum categorization {
7777 cat_rvalue( ty:: Region ) , // temporary val, argument is its scope
7878 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
8080 cat_upvar( ty:: UpvarId , ty:: UpvarBorrow ) , // by ref upvar from stack closure
8181 cat_local( ast:: NodeId ) , // local variable
8282 cat_arg( ast:: NodeId ) , // formal argument
@@ -172,7 +172,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
172172 ty:: ty_trait( ~ty:: TyTrait { store : ty:: UniqTraitStore , .. } ) |
173173 ty:: ty_vec( _, ty:: VstoreUniq ) |
174174 ty:: ty_str( ty:: VstoreUniq ) |
175- ty:: ty_closure( ~ty:: ClosureTy { sigil : ast :: OwnedSigil , ..} ) => {
175+ ty:: ty_closure( ~ty:: ClosureTy { store : ty :: UniqTraitStore , ..} ) => {
176176 Some ( deref_ptr ( OwnedPtr ) )
177177 }
178178
@@ -187,8 +187,7 @@ pub fn opt_deref_kind(t: ty::t) -> Option<deref_kind> {
187187 }
188188
189189 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, _) , ..} ) => {
192191 Some ( deref_ptr ( BorrowedPtr ( ty:: ImmBorrow , r) ) )
193192 }
194193
@@ -540,15 +539,14 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
540539 // Decide whether to use implicit reference or by copy/move
541540 // capture for the upvar. This, combined with the onceness,
542541 // 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 ) {
544543 // Many-shot stack closures can never move out.
545- ( ast :: BorrowedSigil , ast:: Many ) => true ,
544+ ( ty :: RegionTraitStore ( .. ) , ast:: Many ) => true ,
546545 // 1-shot stack closures can move out.
547- ( ast :: BorrowedSigil , ast:: Once ) => false ,
546+ ( ty :: RegionTraitStore ( .. ) , ast:: Once ) => false ,
548547 // Heap closures always capture by copy/move, and can
549548 // move out if they are once.
550- ( ast:: OwnedSigil , _) |
551- ( ast:: ManagedSigil , _) => false ,
549+ ( ty:: UniqTraitStore , _) => false ,
552550
553551 } ;
554552 if var_is_refd {
@@ -688,19 +686,8 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
688686 }
689687 }
690688
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 ( ) )
704691 }
705692
706693 fn cat_deref < N : ast_node > ( & mut self ,
@@ -1105,7 +1092,7 @@ impl<TYPER:Typer> MemCategorizationContext<TYPER> {
11051092 ~"static item"
11061093 }
11071094 cat_copied_upvar( _) => {
1108- ~"captured outer variable in a heap closure "
1095+ ~"captured outer variable in a proc "
11091096 }
11101097 cat_rvalue( ..) => {
11111098 ~"non-lvalue"
0 commit comments