-
Notifications
You must be signed in to change notification settings - Fork 293
Open
Labels
Description
C code:
void ck_assert_failed(const char *filename, unsigned int line, const char *msg);
// ...
ck_assert_failed("foo", 100, "bar");c2rust-transpile output (with manual edits to the implementation of ck_assert_failed):
pub unsafe extern "C" fn ck_assert_failed(
mut filename: *const libc::c_char,
mut line: libc::c_uint,
mut msg: *const libc::c_char,
) -> ! {
panic!();
}
ck_assert_failed(
b"foo" as *const u8 as *const libc::c_char,
100 as libc::c_int as libc::c_uint,
b"bar" as *const u8 as *const libc::c_char,
);c2rust-analyze output:
pub unsafe extern "C" fn ck_assert_failed<'h0,'h1>(
mut filename: &'h0 (libc::c_char),
mut line: libc::c_uint,
mut msg: &'h1 (libc::c_char),
) -> ! {
panic!();
}
ck_assert_failed(
&*(b"foo\0") as *const u8 as *const libc::c_char,
100 as libc::c_int as libc::c_uint,
&*(b"bar\0") as *const u8 as *const libc::c_char,
);This has type errors on the first and third arguments passed to ck_assert_failed. These arguments should instead be parenthesized like &*((b"foo\0") as *const u8 as *const libc::c_char).
Reactions are currently unavailable