args: Vec::new(),
ret_ty: Self_,
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
cs_clone("Clone", c, s, sub)
})),
args: vec!(),
ret_ty: nil_ty(),
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
cs_total_eq_assert(a, b, c)
}))
args: vec!(borrowed_self()),
ret_ty: Literal(path_std!(cx, core::cmp::Ordering)),
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
cs_cmp(a, b, c)
})),
args: vec!(borrowed_self()),
ret_ty: Literal(path_local!(bool)),
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
$f(a, b, c)
}))
args: vec!(borrowed_self()),
ret_ty: Literal(path_local!(bool)),
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|cx, span, substr| {
cs_op($op, $equal, cx, span, substr)
}))
args: vec![borrowed_self()],
ret_ty: ret_ty,
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|cx, span, substr| {
cs_partial_cmp(cx, span, substr)
}))
true
)),
attributes: Vec::new(),
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
decodable_substructure(a, b, c, krate)
})),
args: Vec::new(),
ret_ty: Self_,
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
default_substructure(a, b, c)
}))
true
)),
attributes: Vec::new(),
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
encodable_substructure(a, b, c)
})),
pub attributes: Vec<ast::Attribute>,
+ // Is it an `unsafe fn`?
+ pub is_unsafe: bool,
+
pub combine_substructure: RefCell<CombineSubstructureFunc<'a>>,
}
let fn_decl = cx.fn_decl(args, ret_type);
let body_block = cx.block_expr(body);
+ let unsafety = if self.is_unsafe {
+ ast::Unsafety::Unsafe
+ } else {
+ ast::Unsafety::Normal
+ };
+
// Create the method.
P(ast::ImplItem {
id: ast::DUMMY_NODE_ID,
generics: fn_generics,
abi: abi,
explicit_self: explicit_self,
- unsafety: ast::Unsafety::Normal,
+ unsafety: unsafety,
decl: fn_decl
}, body_block)
})
args: vec!(Ptr(Box::new(Literal(arg)), Borrowed(None, MutMutable))),
ret_ty: nil_ty(),
attributes: vec![],
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
hash_substructure(a, b, c)
}))
true)),
// #[inline] liable to cause code-bloat
attributes: attrs.clone(),
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
cs_from("i64", c, s, sub)
})),
true)),
// #[inline] liable to cause code-bloat
attributes: attrs,
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|c, s, sub| {
cs_from("u64", c, s, sub)
})),
args: vec!(fmtr),
ret_ty: Literal(path_std!(cx, core::fmt::Result)),
attributes: Vec::new(),
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(|a, b, c| {
show_substructure(a, b, c)
}))
args: vec![],
ret_ty: Literal(Path::new_local("isize")),
attributes: vec![],
+ is_unsafe: false,
combine_substructure: combine_substructure(box |cx, span, substr| {
let zero = cx.expr_isize(span, 0);
cs_fold(false,
args: vec![],
ret_ty: Literal(Path::new_local("isize")),
attributes: vec![],
+ is_unsafe: false,
combine_substructure: combine_substructure(Box::new(totalsum_substructure)),
},
],