Skip to content

Commit f84b233

Browse files
committed
ast-builder: Fix/improve handling of closure expressions
1 parent 621fc16 commit f84b233

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

c2rust-ast-builder/src/builder.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,17 +2088,11 @@ impl Builder {
20882088
self,
20892089
capture: CaptureBy,
20902090
mov: Movability,
2091-
decl: FnDecl,
2091+
inputs: Vec<Pat>,
2092+
output: ReturnType,
20922093
body: Box<Expr>,
20932094
) -> Box<Expr> {
2094-
let (_name, inputs, _variadic, output) = decl;
2095-
let inputs = inputs
2096-
.into_iter()
2097-
.map(|e| match e {
2098-
FnArg::Receiver(_s) => panic!("found 'self' in closure arguments"),
2099-
FnArg::Typed(PatType { pat, .. }) => *pat,
2100-
})
2101-
.collect();
2095+
let inputs = inputs.into_iter().collect();
21022096
let capture = match capture {
21032097
CaptureBy::Ref => None,
21042098
CaptureBy::Value => Some(Default::default()),

c2rust-ast-builder/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
mod builder;
2-
pub use crate::builder::{mk, properties, Builder, Make};
2+
pub use crate::builder::{mk, properties, Builder, CaptureBy, Make};

0 commit comments

Comments
 (0)