-
Notifications
You must be signed in to change notification settings - Fork 717
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
support having rust_target
track rust-toolchain.toml
#3049
Comments
I think it'd be great if we could always parse the right msrv from somewhere instead of having to set it up by hand. My only concern is that there are several places where you can set the msrv. For example, I think what you propose is of having a method that does the parsing is a good addition, specially because it doesn't work automagically and we might already add |
I was going to respond that I don’t think MSRV is the right thing, but on reflection I think it is. The general assumption is that if it works on rustc 1.n, it’ll work on 1.n+m. Not always true (as in my case), but it often holds, and so you want bindings.rs to not generate anything that wouldn’t compile with that minimum version.
I think of rust-toolchain.toml as complementary to MSRV. It’s more for reproducibility. If
Yeah, I’m not opposed to my original suggestion 😅, and I can especially see applications eschew And to reiterate: I’d be happy if just |
Rustup documents a number of possible ways to set the toolchain version, it does not look right to duplicate the logic anywhere. OTOH Cargo sets env variables, among which build.rs receives the path to the compiler as |
I recently ran into an issue on a repo that has rustc pinned to 1.81 with a rust-toolchain.toml file because of a regression in 1.82.
bindgen on that repo was generating bindings for 1.83, which included output that 1.81 doesn’t understand.
Adding
rust_target(RustTarget::stable(81, 0))
was easy enough once I discovered it, but once 1.85 (which fixes the regression) is stable, we’ll update rust-toolchain.toml to point at that release, at which point we’ll have to update build.rs withrust_target(RustTarget::stable(85, 0))
.It would be great if there were something like
RustTarget::toolchain_toml()
to indicate that it should extract the target version from that file. It feels like that should maybe even be the default (if such a file exists), but I’m happy either way.The text was updated successfully, but these errors were encountered: