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

Specify the minimum supported Rust version for capnp crate #356

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

punkeel
Copy link
Contributor

@punkeel punkeel commented Nov 23, 2022

The MSRV (minimum supported Rust version) is the earliest version capable of building a project. In the case of the capnp crate, the MSRV is 1.65.0, due to the use of GATs.

Having the MSRV in Cargo.toml helps display better error messages when the Rust version is too old to build a project. eg:

error: package capnp v0.15.0 (/Users/maxime/Code/capnproto-rust/capnp)
cannot be built because it requires rustc 1.65.0 or newer, while the
currently active rustc version is 1.64.0

Without it, the error messages are more confusing.

error[E0658]: generic associated types are unstable
--> capnp/src/traits.rs:73:5
|
73 | type Builder<'a>: FromStructBuilder<'a> + HasStructSize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #44265 rust-lang/rust#44265 for more information

Cargo.toml docs: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field


I'm only adding this to the capnp crate, as capnpc/capnp-rpc/capnp-futures all depend on it.

The MSRV (minimum supported Rust version) is the earliest version capable of
building a project. In the case of the capnp crate, the MSRV is 1.65.0, due to
the use of GATs.

Having the MSRV in Cargo.toml helps display better error messages when the Rust
version is too old to build a project. eg:
> error: package `capnp v0.15.0 (/Users/maxime/Code/capnproto-rust/capnp)`
> cannot be built because it requires rustc 1.65.0 or newer, while the
> currently active rustc version is 1.64.0

Without it, the error messages are more confusing.
> error[E0658]: generic associated types are unstable
>   --> capnp/src/traits.rs:73:5
>    |
> 73 |     type Builder<'a>: FromStructBuilder<'a> + HasStructSize;
>   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   |
>   = note: see issue #44265 <rust-lang/rust#44265> for more information

Cargo.toml docs: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
@dwrensha
Copy link
Member

Oh, cool. Looks like that field got added in rust-lang/cargo#9732.

@dwrensha dwrensha merged commit 2be9ac4 into capnproto:master Nov 23, 2022
@punkeel punkeel deleted the punkeel/msrv branch November 23, 2022 20:31
@punkeel
Copy link
Contributor Author

punkeel commented Nov 23, 2022

Thanks!

@dwrensha
Copy link
Member

Just noting for completeness here: we do have a CI job that makes sure we don't accidentally break support on older rust versions:

ErikMcClure pushed a commit to Fundament-Software/capstone-rs that referenced this pull request Mar 25, 2024
Specify the minimum supported Rust version for capnp crate
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.

2 participants