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] when possible. #47122

Closed
wants to merge 2 commits into from

Conversation

clarfonthey
Copy link
Contributor

This gets rid of the future_atomic_orderings and io_error_internals
feature gates, as they are no longer needed.

@rust-highfive
Copy link
Collaborator

r? @BurntSushi

(rust_highfive has picked a reviewer for you, use r? to override)

@clarfonthey
Copy link
Contributor Author

CC #44109 and @davidtwco, who implemented the RFC

This gets rid of the `future_atomic_orderings` and `io_error_internals`
feature gates, as they are no longer needed.
pub struct LexError {
_inner: (),
}
#[non_exhaustive]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[00:07:40] error: non exhaustive is an experimental feature (see issue #44109)
[00:07:40]   --> /checkout/src/libproc_macro/diagnostic.rs:18:1
[00:07:40]    |
[00:07:40] 18 | #[non_exhaustive]
[00:07:40]    | ^^^^^^^^^^^^^^^^^
[00:07:40]    |
[00:07:40]    = help: add #![feature(non_exhaustive)] to the crate attributes to enable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally thought I added this but I guess not.

_force_singleton: (),
}
#[non_exhaustive]
pub struct ExchangeHeapSingleton { }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to use the braced form for non_exhaustive structs, more usual pub struct ExchangeHeapSingleton; can be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done; I mostly did this because I wasn't sure if this had been implemented yet. Although in honesty, the goal should be to make sure this feature works by first testing it in the standard library.

@kennytm kennytm added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 2, 2018
@bors
Copy link
Contributor

bors commented Jan 3, 2018

☔ The latest upstream changes (presumably #47088) made this pull request unmergeable. Please resolve the merge conflicts.

@BurntSushi BurntSushi assigned alexcrichton and unassigned BurntSushi Jan 3, 2018
@alexcrichton
Copy link
Member

Thanks! I'd personally prefer to hold off on this though for libstd until this feature stabilizes. These are all done specifically for backwards compatibility and "good documentation" of libstd and I'd just want to make sure that we have all the bugs fleshed out of this attribute before using it in the standard library (where a mistake can be very costly)

@carols10cents
Copy link
Member

@alexcrichton Which feature is this PR blocked on? How long until that feature is likely to stabilize? That is, should we leave this PR open with S-blocked (for a short amount of time) or close it (if it's going to be a long time)?

@alexcrichton
Copy link
Member

@clarcharr what do you think about blocking this on the #[non_exhaustive] feature stabilizing? Do you think it should be brought up with the libs team before that?

@carols10cents I don't know personally, I'm not following the feature. I'd prefer to close if we don't want to merge this in the meantime.

@kennytm kennytm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jan 17, 2018
@kennytm
Copy link
Member

kennytm commented Jan 17, 2018

Hi @clarcharr, what do you think about @alexcrichton's comment in #47122 (comment)?

@clarfonthey
Copy link
Contributor Author

I think that while we shouldn't have to wait until that's stabilised, I think that we should wait until some of the bugs listed in the tracking issue are ironed out. I don't think that the issue should be closed yet though.

@carols10cents
Copy link
Member

Ok, sounds like the issue should be left open but this PR should be closed. If I've misunderstood, please reopen!

@clarfonthey clarfonthey deleted the non_exhaustive_std branch January 29, 2022 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants