dtolnay/cxx

Smarter handling of illegal names

Open

#110 创建于 2020年4月12日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Rust (4,472 star) (253 fork)batch import
help wanted

描述

We should sanitize where possible (function argument names) and produce diagnostics otherwise (function names, type names, field names).

mod ffi {
    extern "C" {
        // sanitize the variable name somehow instead of emitting invalid C++
        fn f(operator: usize);
    }

    extern "Rust" {
        // reject; ask the user to reimport the Rust fn under a different name
        fn operator();
    }
}

Currently the above all emit invalid C++ code, which is not nice.

贡献者指南