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

Use #[non_exhaustive] after updating MSRV to 1.40.0 #1182

Closed
asomers opened this issue Feb 2, 2020 · 1 comment · Fixed by #1474
Closed

Use #[non_exhaustive] after updating MSRV to 1.40.0 #1182

asomers opened this issue Feb 2, 2020 · 1 comment · Fixed by #1474
Assignees

Comments

@asomers
Copy link
Member

asomers commented Feb 2, 2020

The #[non_exhaustive] attribute, introduced by Rust 1.40.0, should be used for most enums that come from C, since new values could be added by any release. This attribute isn't valuable enough to justify a MSRV bump by itself. But we should still make use of it whenever we update the MSRV for any other reason.

@asomers asomers self-assigned this Feb 2, 2020
@lucab
Copy link
Contributor

lucab commented Jul 19, 2021

For reference, as of nix 0.8.0 the current MSRV is already at 1.41.0 since #1440.

bors bot added a commit that referenced this issue Jul 29, 2021
1473: sys/stat: add a safe wrapper for mknodat(2) r=asomers a=lucab

This introduces a new `mknodat` helper.

Ref: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html

1474: Mark most C-derived enums as non_exhaustive r=asomers a=asomers

Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.

Fixes #1182

1476: Constify many functions r=asomers a=asomers

Constify most functions that can be constified.  The exceptions are
mostly accessors for structs that have no const constructor.

Co-authored-by: Luca BRUNO <luca.bruno@coreos.com>
Co-authored-by: Alan Somers <asomers@gmail.com>
@bors bors bot closed this as completed in 358adaf Jul 29, 2021
LMJW pushed a commit to LMJW/nix that referenced this issue Jul 31, 2021
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.

Fixes nix-rust#1182
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 a pull request may close this issue.

2 participants