-
Notifications
You must be signed in to change notification settings - Fork 516
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
Add #[non_exhaustive] option to enum codegen options #43
Comments
Is the plan to just add It would be nice to use enums directly but the RFC says things that imply that it wouldn't be safe to do so: "Outside the crate that defines the enum, users should be required to add a wildcard arm to ensure forward-compatibility, like so: [match expression with default arm] And it should not be marked as dead code, even if the compiler does mark it as dead and remove it." |
I think I just found the answer to my own question in rust-lang/rust#36927 (comment) : even with |
#[non_exhaustive] is stabilized. Can we switch back to enum's now, please? |
To be clear, this issue is not about changing the representation of enum message fields. The current strategy of using |
Builds are failing on unrelated pull requests (e.g., tokio-rs#326) because the `curl` crate has pushed a new version that depends on Rust 1.40, while our CI tests against 1.39. We could probably bump to require 1.40 as well, especially since we want to use the same `#[non_exhaustive]` attribute, per tokio-rs#43. But a minimal change to unblock development and keep the current minimum stable Rust version is to just pin `curl < 0.4.34`. Test Plan: Running `cargo +1.39.0 test --workspace --all-targets` passes on my Linux machine. wchargin-branch: deps-curl-pre-0.4.34 wchargin-source: c2910530bd49190605176c9f69f3aff1863443c2
Builds are failing on unrelated pull requests (e.g., #326) because the `curl` crate has pushed a new version that depends on Rust 1.40, while our CI tests against 1.39. We could probably bump to require 1.40 as well, especially since we want to use the same `#[non_exhaustive]` attribute, per #43. But a minimal change to unblock development and keep the current minimum stable Rust version is to just pin `curl < 0.4.34`. Test Plan: Running `cargo +1.39.0 test --workspace --all-targets` passes on my Linux machine. wchargin-branch: deps-curl-pre-0.4.34 wchargin-source: c2910530bd49190605176c9f69f3aff1863443c2
It would be nice to be able to have a way to tag generated enums with
#[non_exhaustive]
. The feature is still in development, but once it's implemented and unstable,prost
can in theory take advantage of it without requiring nightly.The text was updated successfully, but these errors were encountered: