Skip to content

--translate-fn-macros translates into wrong stuff #1141

@jrmuizel

Description

@jrmuizel
void error(const char *lit, int x) {
}

#define unreachable(a) error(a, 5)

void f() {
        unreachable("a");
}

Gets translated to:

#![allow(dead_code, mutable_transmutes, non_camel_case_types, non_snake_case, non_upper_case_globals, unused_assignments, unused_mut)]
#[no_mangle]
pub unsafe extern "C" fn error(mut lit: *const libc::c_char, mut x: libc::c_int) {}
#[no_mangle]
pub unsafe extern "C" fn f() {
    unreachable!("a")(b"a\0" as *const u8 as *const libc::c_char, unreachable!("a"));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions