corrode
corrode copied to clipboard
box, true and false are not renamed
The following two programs are translated, but don't compile for the same reason: they use variable and variant names that are keywords in Rust.
void foo(int box) {
box++;
}
void bar() {
foo(1);
}
typedef enum
{
false,
true
} boolean;
void foo(boolean bar) {
}
void bar() {
foo(false);
}
It looks like as is also not renamed:
// example.c
int main() {
int as = 23;
return 0;
}
// example.rs
fn main() {
let ret = unsafe { _c_main() };
::std::process::exit(ret);
}
#[no_mangle]
pub unsafe extern fn _c_main() -> i32 {
let mut as : i32 = 23i32;
0i32
}
The rust snippet will not compile, fails with:
expected identifier, found keyword `as`
The patch I PR'd should work fine. I tested as_ and it was good to go, so I assume the rest of them would be too.