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

Edition 2024: Identifiers named gen should be renamed to raw r#gen #3093

Open
liss-h opened this issue Jan 17, 2025 · 1 comment
Open

Edition 2024: Identifiers named gen should be renamed to raw r#gen #3093

liss-h opened this issue Jan 17, 2025 · 1 comment

Comments

@liss-h
Copy link

liss-h commented Jan 17, 2025

Hi, I understand that edition 2024 is not stable yet, but I wanted to notify you in advance of its stabilization (which will be in the next stable rust release as far as I understood).

Currently, bindgen cannot generate correct bindings for edition 2024, because it does not take the new reserved gen keyword into consideration, i.e. it incorrectly does not generate a raw identifier (r#gen).

Versions

  • rustc 1.86.0-nightly (in edition 2024 mode)
  • bindgen 0.71.1 (library)

Example

C Function:

void f(int gen);

Generated:

unsafe extern "C" {
    pub fn f(gen: i32);
}

Expected:

unsafe extern "C" {
    pub fn f(r#gen: i32);
}
@loftyinclination
Copy link
Contributor

Mangling identifiers is done in rust_mangle. This wouldn't result in the format that you've suggested (r#gen), instead it suffixes the identifier with an underscore (gen_), but that's the behaviour for all other keywords 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

2 participants