@@ -1775,7 +1775,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1775
1775
_attributes : & [ ast:: Attribute ] ,
1776
1776
output_type : ty:: FnOutput < ' tcx > ,
1777
1777
abi : Abi ,
1778
- closure_env : closure:: ClosureEnv < ' b , ' tcx > ) {
1778
+ closure_env : closure:: ClosureEnv < ' b > ) {
1779
1779
ccx. stats ( ) . n_closures . set ( ccx. stats ( ) . n_closures . get ( ) + 1 ) ;
1780
1780
1781
1781
let _icx = push_ctxt ( "trans_closure" ) ;
@@ -1784,12 +1784,17 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1784
1784
debug ! ( "trans_closure(..., param_substs={})" ,
1785
1785
param_substs. repr( ccx. tcx( ) ) ) ;
1786
1786
1787
+ let has_env = match closure_env {
1788
+ closure:: ClosureEnv :: Closure ( _) => true ,
1789
+ closure:: ClosureEnv :: NotClosure => false ,
1790
+ } ;
1791
+
1787
1792
let ( arena, fcx) : ( TypedArena < _ > , FunctionContext ) ;
1788
1793
arena = TypedArena :: new ( ) ;
1789
1794
fcx = new_fn_ctxt ( ccx,
1790
1795
llfndecl,
1791
1796
fn_ast_id,
1792
- closure_env . kind != closure :: ClosureKind :: NotClosure ,
1797
+ has_env ,
1793
1798
output_type,
1794
1799
param_substs,
1795
1800
Some ( body. span ) ,
@@ -1808,13 +1813,13 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1808
1813
decl. inputs . iter ( )
1809
1814
. map ( |arg| node_id_type ( bcx, arg. id ) )
1810
1815
. 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 => {
1813
1818
monomorphized_arg_types
1814
1819
}
1815
1820
1816
1821
// Tuple up closure argument types for the "rust-call" ABI.
1817
- closure:: ClosureKind :: Closure => {
1822
+ closure:: ClosureEnv :: Closure ( _ ) => {
1818
1823
vec ! [ ty:: mk_tup( ccx. tcx( ) , monomorphized_arg_types) ]
1819
1824
}
1820
1825
} ;
@@ -1835,14 +1840,14 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1835
1840
& monomorphized_arg_types[ ] )
1836
1841
} ;
1837
1842
1838
- bcx = match closure_env. kind {
1839
- closure:: ClosureKind :: NotClosure => {
1843
+ bcx = match closure_env {
1844
+ closure:: ClosureEnv :: NotClosure => {
1840
1845
copy_args_to_allocas ( bcx,
1841
1846
arg_scope,
1842
1847
& decl. inputs [ ] ,
1843
1848
arg_datums)
1844
1849
}
1845
- closure:: ClosureKind :: Closure => {
1850
+ closure:: ClosureEnv :: Closure ( _ ) => {
1846
1851
copy_closure_args_to_allocas (
1847
1852
bcx,
1848
1853
arg_scope,
@@ -1932,7 +1937,7 @@ pub fn trans_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1932
1937
attrs,
1933
1938
output_type,
1934
1939
abi,
1935
- closure:: ClosureEnv :: new ( & [ ] , closure :: ClosureKind :: NotClosure ) ) ;
1940
+ closure:: ClosureEnv :: NotClosure ) ;
1936
1941
}
1937
1942
1938
1943
pub fn trans_enum_variant < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > ,
0 commit comments