@@ -1775,7 +1775,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
17751775 _attributes : & [ ast:: Attribute ] ,
17761776 output_type : ty:: FnOutput < ' tcx > ,
17771777 abi : Abi ,
1778- closure_env : closure:: ClosureEnv < ' b , ' tcx > ) {
1778+ closure_env : closure:: ClosureEnv < ' b > ) {
17791779 ccx. stats ( ) . n_closures . set ( ccx. stats ( ) . n_closures . get ( ) + 1 ) ;
17801780
17811781 let _icx = push_ctxt ( "trans_closure" ) ;
@@ -1784,12 +1784,17 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
17841784 debug ! ( "trans_closure(..., param_substs={})" ,
17851785 param_substs. repr( ccx. tcx( ) ) ) ;
17861786
1787+ let has_env = match closure_env {
1788+ closure:: ClosureEnv :: Closure ( _) => true ,
1789+ closure:: ClosureEnv :: NotClosure => false ,
1790+ } ;
1791+
17871792 let ( arena, fcx) : ( TypedArena < _ > , FunctionContext ) ;
17881793 arena = TypedArena :: new ( ) ;
17891794 fcx = new_fn_ctxt ( ccx,
17901795 llfndecl,
17911796 fn_ast_id,
1792- closure_env . kind != closure :: ClosureKind :: NotClosure ,
1797+ has_env ,
17931798 output_type,
17941799 param_substs,
17951800 Some ( body. span ) ,
@@ -1808,13 +1813,13 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
18081813 decl. inputs . iter ( )
18091814 . map ( |arg| node_id_type ( bcx, arg. id ) )
18101815 . collect :: < Vec < _ > > ( ) ;
1811- let monomorphized_arg_types = match closure_env. kind {
1812- closure:: ClosureKind :: NotClosure => {
1816+ let monomorphized_arg_types = match closure_env {
1817+ closure:: ClosureEnv :: NotClosure => {
18131818 monomorphized_arg_types
18141819 }
18151820
18161821 // Tuple up closure argument types for the "rust-call" ABI.
1817- closure:: ClosureKind :: Closure => {
1822+ closure:: ClosureEnv :: Closure ( _ ) => {
18181823 vec ! [ ty:: mk_tup( ccx. tcx( ) , monomorphized_arg_types) ]
18191824 }
18201825 } ;
@@ -1835,14 +1840,14 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
18351840 & monomorphized_arg_types[ ] )
18361841 } ;
18371842
1838- bcx = match closure_env. kind {
1839- closure:: ClosureKind :: NotClosure => {
1843+ bcx = match closure_env {
1844+ closure:: ClosureEnv :: NotClosure => {
18401845 copy_args_to_allocas ( bcx,
18411846 arg_scope,
18421847 & decl. inputs [ ] ,
18431848 arg_datums)
18441849 }
1845- closure:: ClosureKind :: Closure => {
1850+ closure:: ClosureEnv :: Closure ( _ ) => {
18461851 copy_closure_args_to_allocas (
18471852 bcx,
18481853 arg_scope,
@@ -1932,7 +1937,7 @@ pub fn trans_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
19321937 attrs,
19331938 output_type,
19341939 abi,
1935- closure:: ClosureEnv :: new ( & [ ] , closure :: ClosureKind :: NotClosure ) ) ;
1940+ closure:: ClosureEnv :: NotClosure ) ;
19361941}
19371942
19381943pub fn trans_enum_variant < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
0 commit comments