Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

box, true and false are not renamed #156

Open
skade opened this issue Jul 4, 2017 · 2 comments
Open

box, true and false are not renamed #156

skade opened this issue Jul 4, 2017 · 2 comments

Comments

@skade
Copy link

skade commented Jul 4, 2017

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);
}
@willmurphyscode
Copy link

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`

phase added a commit to phase/corrode that referenced this issue Dec 26, 2017
@phase
Copy link

phase commented Dec 26, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants