-
Notifications
You must be signed in to change notification settings - Fork 694
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
bindgen 0.70 uses offset_of on Rust 1.76 #2960
Comments
(I think you mean bindgen 0.70 and not 1.70.) In the PR you linked, I think #2787 (comment) might be helpful:
|
Whoops :)
How do I set the target when bindgen runs in the build script of a dependency I don’t control? |
that's on your dependency's yard. If they want to produce bindings for a lower msrv then they have to do it themselves. |
I think at least the CHANGELOG should be updated to mention that 0.70 contains an on-by-default MSRV bump for generated code. I know that in the end it was my dependency’s fault for bumping bindgen in a minor release so that a simple cargo update suddenly broke my build. But it still feels like a call-out in the CHANGELOG might have prevented this. |
@juntyr I understand your point, definitely we could include such comments in the future. However, they might be rather confusing as there are 3 different MSRVs: One to compile That being said, if someone maintains a library with an MSRV guarantee and you're bumping dependencies without checking if your MSRV guarantees hold, it is as you said, their fault. Specially since you can use builder.rust_target(RustTarget::Stable_1_73) to be sure that if there's a MSRV guarantee breakage is actually a bug in bindgen. |
The |
no: $ cargo +1.70.0 build -p bindgen
Compiling proc-macro2 v1.0.60
Compiling glob v0.3.1
Compiling memchr v2.5.0
Compiling quote v1.0.28
Compiling unicode-ident v1.0.6
Compiling prettyplease v0.2.7
Compiling libc v0.2.159
Compiling cfg-if v1.0.0
Compiling log v0.4.17
Compiling minimal-lexical v0.2.1
Compiling either v1.8.1
Compiling regex-syntax v0.6.28
Compiling libloading v0.7.4
Compiling bindgen v0.70.1 (/home/christian/Workspace/bindgen/bindgen)
Compiling itertools v0.13.0
Compiling bitflags v2.2.1
Compiling shlex v1.3.0
Compiling rustc-hash v1.1.0
Compiling clang-sys v1.4.0
Compiling nom v7.1.3
Compiling regex v1.7.1
Compiling syn v2.0.18
Compiling cexpr v0.6.0
Finished dev [unoptimized + debuginfo] target(s) in 6.47s |
@pvdrz You dont get the error when compiling, but the generated code of bindgen uses the |
Please @barakugav read the thread carefully before writing comments like these
yes, this is true. This doesn't mean that bindgen requires Rust 1.77 to compile. If you want to control the target Rust version of the generated bindings you must use the rust_target method to guarantee that your bindings compile for the right Rust version. You can use bindgen with Rust 1.70 and generate bindings that should be guaranteed to work on any Rust version from 1.33 to the latest stable and nightly, |
My weekly CI on my MSRV 1.76 started failing because a dependency bumped bindgen to 1.70, which now includes
offset_of!
in the bindings despite being still unstable. It looks like #2787 introduced the extra checks, though at a quick glance that PR looks fine.The text was updated successfully, but these errors were encountered: