dtolnay/cxx

Smarter handling of illegal names

Aperta

#110 aperta il 12 apr 2020

 (0 commenti) (0 reazioni) (0 assegnatari)Rust (253 fork)batch import
help wanted

Metriche repository

Star
 (4472 stelle)
Metriche merge PR
 (Merge medio 8m) (3 PR mergiate in 30 g)

Descrizione

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.

Guida contributor