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

Don't traverse through special-cased <stdint.h> types. #2287

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

goffrie
Copy link
Contributor

@goffrie goffrie commented Sep 27, 2022

Fixes #1663.

Not sure if this is too special-casey, but there's already a bunch of this stuff strewn about. Seems like it would be cleanest to add a new TypeKind for stdint types populated in from_clang_ty but that seemed like a ton of work for relatively little gain.

@pvdrz
Copy link
Contributor

pvdrz commented Sep 28, 2022

Thanks for your PR!

I tried to do a mini test about this using b5ec18e and found that:

typedef unsigned long long uint64_t;

uint64_t foo();

emits the following rust code:

/* automatically generated by rust-bindgen 0.60.1 */

extern "C" {
    pub fn foo() -> u64;
}

Do you have an extra example showing how your changes affect this behavior so we can add it as a test?

@goffrie
Copy link
Contributor Author

goffrie commented Sep 28, 2022

I added a test that demonstrates the issue. The key is to have a two-layer typedef: typedef unsigned long long __uint64_t; typedef __uint64_t uint64_t;
Without this PR, an extraneous type __uint64_t = ::std::os::raw::c_ulonglong; is emitted.

@pvdrz pvdrz merged commit e68b8c0 into rust-lang:master Sep 29, 2022
@pvdrz
Copy link
Contributor

pvdrz commented Sep 29, 2022

Looks good to me! Thanks!

@bors-servo bors-servo mentioned this pull request Sep 29, 2022
2 tasks
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

Successfully merging this pull request may close these issues.

Replacing native C types (Windows & Mac vs Linux)
2 participants