Uh oh!
There was an error while loading. Please reload this page.
Suggest removing #![feature] for library features that have been stabilized - #89012
Conversation
rust-highfive
commented
Sep 16, 2021
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthewjasper (or someone else) soon. Please see the contribution instructions for more information. |
#![feature] for library features that have been stabilized
jyn514
left a comment
There was a problem hiding this comment.
Isn't the point to suggest removing the feature? This looks like you've just duplicated the check later into the compiler.
There was a problem hiding this comment.
What is this check doing? It should never be hit since there will always be some features built-in, but it also doesn't seem to have anything to do with the rest of the code.
There was a problem hiding this comment.
The lang_features vector contains the declared_lang_features in the session. So only the ones which have been enabled show up here.
I've added this check to skip emitting an error if only lib_features have been enabled and no lang_features
There was a problem hiding this comment.
Ok. That still seems like the wrong check, though - if there's one language and one library feature, it should still suggest removing the stable library feature.
There was a problem hiding this comment.
How will that be possible since the suggestion can be generated only after TyCtxt is generated? And we will be throwing an error at the parsing stage if a lang feature has been enabled, the compiler will abort and won't go to the next stage
There was a problem hiding this comment.
And we will be throwing an error at the parsing stage if a lang feature has been enabled, the compiler will abort and won't go to the next stage
Oh hmm, good point. Ok, this seems fine then - if the language feature wasn't stable removing the library feature wouldn't have helped anyway.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
vishadGoyal
commented
Sep 16, 2021
Uh oh!
There was an error while loading. Please reload this page.
Ah! That's perfect then :) can you add that as a test case? It would go somewhere in src/test/ui - anywhere other than issues/ is probably fine. |
a1ca7e6 to
745a1c0CompareUh oh!
There was an error while loading. Please reload this page.
vishadGoyal
commented
Sep 16, 2021
@jyn514 Is there a way to specify which channel the test should be run on? I'm adding a sample code to reproduce this situation and adding the expected stderr output. However, this will be different for different channels (beta, nightly, etc.) |
jyn514
commented
Sep 16, 2021
No, unfortunately, I forgot about that. If you do a manual test and post the output that's good enough. |
vishadGoyal
commented
Sep 16, 2021
Is this good enough? @jyn514 |
@vishadGoyal how does it behave when there's both a library feature and at least one language feature (e.g. |
vishadGoyal
commented
Sep 16, 2021
I guess that's functional but not exactly what I had in mind. |
jyn514
commented
Sep 16, 2021
@bors r+ squash Thanks! |
bors
commented
Sep 16, 2021
📌 Commit b53c0eb242065377b989d77dba6a113926eb9ef5 has been approved by |
If #![feature] is used outside the nightly channel for only lib features, the check will be delayed to the stability pass after parsing. This is done so that appropriate help messages can be shown if the #![feature] has been used needlessly
b53c0eb to
9f7e281CompareMark-Simulacrum
commented
Sep 16, 2021
@bors r=jyn514 squash- Squashed the commits locally -- I don't think we've fixed that to behave well in bors just yet. |
bors
commented
Sep 16, 2021
📌 Commit 9f7e281 has been approved by |
…laumeGomez Rollup of 10 pull requests Successful merges: - rust-lang#86422 (Emit clearer diagnostics for parens around `for` loop heads) - rust-lang#87460 (Point to closure when emitting 'cannot move out' for captured variable) - rust-lang#87566 (Recover invalid assoc type bounds using `==`) - rust-lang#88666 (Improve build command for compiler docs) - rust-lang#88899 (Do not issue E0071 if a type error has already been reported) - rust-lang#88949 (Fix handling of `hir::GenericArg::Infer` in `wrong_number_of_generic_args.rs`) - rust-lang#88953 (Add chown functions to std::os::unix::fs to change the owner and group of files) - rust-lang#88954 (Allow `panic!("{}", computed_str)` in const fn.) - rust-lang#88964 (Add rustdoc version into the help popup) - rust-lang#89012 (Suggest removing `#![feature]` for library features that have been stabilized) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup



Issue: #88802
Delayed the check if #![feature] has been used to enable lib features in a non-nightly build to occur after TyCtxt has been constructed.