@@ -1683,21 +1683,20 @@ pub fn copy_args_to_allocas(fcx: fn_ctxt,
16831683
16841684 match fcx. llself {
16851685 Some ( slf) => {
1686- // We really should do this regardless of whether self is owned, but
1687- // it doesn't work right with default method impls yet. (FIXME: #2794)
1688- if slf. is_owned {
1689- let self_val = if datum:: appropriate_mode( slf. t) . is_by_value( ) {
1690- let tmp = BitCast ( bcx, slf. v, type_of( bcx. ccx( ) , slf. t) ) ;
1691- let alloc = alloc_ty( bcx, slf. t) ;
1692- Store ( bcx, tmp, alloc) ;
1693- alloc
1694- } else {
1695- PointerCast ( bcx, slf. v, type_of( bcx. ccx( ) , slf. t) . ptr_to( ) )
1696- } ;
1697-
1698- fcx. llself = Some ( ValSelfData { v: self_val, ..slf} ) ;
1699- add_clean( bcx, self_val, slf. t) ;
1700- }
1686+ let self_val = if slf. is_owned
1687+ && datum:: appropriate_mode( slf. t) . is_by_value( ) {
1688+ let tmp = BitCast ( bcx, slf. v, type_of( bcx. ccx( ) , slf. t) ) ;
1689+ let alloc = alloc_ty( bcx, slf. t) ;
1690+ Store ( bcx, tmp, alloc) ;
1691+ alloc
1692+ } else {
1693+ PointerCast ( bcx, slf. v, type_of( bcx. ccx( ) , slf. t) . ptr_to( ) )
1694+ } ;
1695+
1696+ fcx. llself = Some ( ValSelfData { v: self_val, ..slf} ) ;
1697+ if slf. is_owned {
1698+ add_clean( bcx, self_val, slf. t) ;
1699+ }
17011700 }
17021701 _ => { }
17031702 }
0 commit comments