-
Notifications
You must be signed in to change notification settings - Fork 700
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
const field inside class is not handled correctly on Windows #271
Comments
I don't think this would reproduce if i.e., I can't reproduce if I instead: typedef unsigned size_t; // Or define it in some other way.
class A {
const size_t count;
}; |
It doesn't matter. typedef unsigned long long size_t;
class A {
const size_t count;
}; still gives me #[repr(C)]
#[derive(Debug, Copy)]
pub struct A {
pub count: A_size_t,
} FWIW, I can only reproduce this on Windows. It works fine on my macOS. I have no idea why... |
Gah, github-debugging time again :). Can you use |
The bindgen logs will also help, I guess. |
This is the log with |
Can you use |
This is log.txt from |
So it's again an MSVC backend bug, where they report no USR for the typedef declaration, so we don't find it and assume that "const size_t" is a type declared inside of |
@upsuper, does the following patch make it work for you? diff --git a/libbindgen/src/ir/context.rs b/libbindgen/src/ir/context.rs
index a1ec8c7..bda3e3c 100644
--- a/libbindgen/src/ir/context.rs
+++ b/libbindgen/src/ir/context.rs
@@ -222,7 +222,7 @@ impl<'ctx> BindgenContext<'ctx> {
error!("Valid declaration with no USR: {:?}, {:?}",
declaration,
location);
- return;
+ TypeKey::Declaration(declaration)
};
let old = self.types.insert(key, id); |
Yes, it seems to work. Thanks. |
I added the fix in #260, should be merged soon. Thank you for reporting it :) |
Use build script to generate binding files <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings @Manishearth @emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14244) <!-- Reviewable:end -->
Use build script to generate binding files <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings @Manishearth @emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14244) <!-- Reviewable:end -->
Use build script to generate binding files <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings @Manishearth @emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14244) <!-- Reviewable:end -->
Use build script to generate binding files <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings @Manishearth @emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14244) <!-- Reviewable:end -->
Use build script to generate binding files <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings @Manishearth @emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14244) <!-- Reviewable:end -->
…m upsuper:buildtime-bindgen); r=emilio <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings @Manishearth @emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 872ec89a9c546eb05246b5047aabfc032d140eff
…m upsuper:buildtime-bindgen); r=emilio <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings Manishearth emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 872ec89a9c546eb05246b5047aabfc032d140eff UltraBlame original commit: 78635ebabfc9e63971829a549388d1b61a75a503
…m upsuper:buildtime-bindgen); r=emilio <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings Manishearth emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 872ec89a9c546eb05246b5047aabfc032d140eff UltraBlame original commit: 78635ebabfc9e63971829a549388d1b61a75a503
…m upsuper:buildtime-bindgen); r=emilio <!-- Please describe your changes on the following line: --> This is a WIP patch to make rust-bindgen a build time dependency of style component for stylo. This should make things more automatic. I convert majority of `regen.py` to `build_gecko.rs`. It currently doesn't work on Windows, because of rust-lang/rust-bindgen#271 (it works when I fix the generated file manually, though). I haven't tested other platforms. It would break servo's CI for geckolib, because: 1. it needs libclang (which is probably easy to solve) 2. it needs `MOZ_OBJDIR` to be passed in so that it can generate bindings Manishearth emilio Do you agree with this change? Do you have suggestion for the issues above? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 872ec89a9c546eb05246b5047aabfc032d140eff UltraBlame original commit: 78635ebabfc9e63971829a549388d1b61a75a503
Test code:
On Windows, it generates:
where
A_size_t
is never defined.The text was updated successfully, but these errors were encountered: