@@ -138,29 +138,25 @@ impl<'a,'tcx> Builder<'a,'tcx> {
138138 -> BlockAnd < Vec < ArgDecl < ' tcx > > >
139139 {
140140 self . in_scope ( argument_extent, block, |this| {
141- let arg_decls = {
142- let num_implicit_args = implicit_arguments. len ( ) ;
143- let implicit_arg_decls = implicit_arguments. into_iter ( )
144- . map ( |ty| ArgDecl { ty : ty } ) ;
145-
146- // to start, translate the argument patterns and collect the
147- // argument types.
148- let explicit_arg_decls =
149- explicit_arguments
150- . into_iter ( )
151- . enumerate ( )
152- . map ( |( index, ( ty, pattern) ) | {
153- let lvalue = Lvalue :: Arg ( ( num_implicit_args + index) as u32 ) ;
141+ // to start, translate the argument patterns and collect the argument types.
142+ let implicits = implicit_arguments. into_iter ( ) . map ( |ty| ( ty, None ) ) ;
143+ let explicits = explicit_arguments. into_iter ( ) . map ( |( ty, pat) | ( ty, Some ( pat) ) ) ;
144+ let arg_decls =
145+ implicits
146+ . chain ( explicits)
147+ . enumerate ( )
148+ . map ( |( index, ( ty, pattern) ) | {
149+ if let Some ( pattern) = pattern {
150+ let lvalue = Lvalue :: Arg ( index as u32 ) ;
154151 let pattern = this. hir . irrefutable_pat ( pattern) ;
155152 unpack ! ( block = this. lvalue_into_pattern( block,
156153 argument_extent,
157154 pattern,
158155 & lvalue) ) ;
159- ArgDecl { ty : ty }
160- } ) ;
161-
162- implicit_arg_decls. chain ( explicit_arg_decls) . collect ( )
163- } ;
156+ }
157+ ArgDecl { ty : ty }
158+ } )
159+ . collect ( ) ;
164160
165161 // start the first basic block and translate the body
166162 unpack ! ( block = this. ast_block( & Lvalue :: ReturnPointer , block, ast_block) ) ;
0 commit comments