-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Make issue
field optional in #[unstable]
to avoid issue = "0"
#60860
Make issue
field optional in #[unstable]
to avoid issue = "0"
#60860
Conversation
…2` to `issue: Option<i32>` rust-lang#41260
…asic ui test. It turned out that issue fields were already Option<i32> in most places. Added some temporary errors to find all the `#[unstable(... , issue = "0")]`
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @varkor (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
This makes things worse, it's now much easier to forget the issue field. If tidy check is wanted, it can ignore the test subdirectory. |
Maybe we could explicitly declare issueless features (e.g. |
@@ -515,7 +515,7 @@ pub enum EvalResult { | |||
Deny { | |||
feature: Symbol, | |||
reason: Option<Symbol>, | |||
issue: u32, | |||
issue: Option<u32>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using a Option<NonZeroU32>>
instead? There's no valid issue #0, which means that we can try to save some space here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can't be done in this PR though, because the stage 0 compiler expects the old syntax and therefore the issue = "0"
in stdlib and stdcore must remain until the changes made here get into stage 0.
(To be precise, x.py check
emits errors and AFAIK Travis checks that.)
Also, there are other places where issues are represented as Option<u32>
and even Some(0)
@@ -432,7 +432,7 @@ register_diagnostics! { | |||
E0544, // multiple stability levels | |||
E0545, // incorrect 'issue' | |||
E0546, // missing 'feature' | |||
E0547, // missing 'issue' | |||
E0547, // missing 'issue' //TODO I reused this one for the warning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that a good idea? :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it's not, but I don't know how to properly do it. Can someone help me here?
Implementing
With @petrochenkov 's concern in mind, making the field optional actually seems worse. This change was suggested in #49985. @estebank and @GuillaumeGomez had opinions there. |
Personally, I'm not too concerned about whether we use However, I do think using If there's not general consensus about the issue syntax, it'd be better to leave as-is, but change how it's represented. That way, we can move forward with this change. @Julian-Wollersberger: sorry for not having figured out all the details before you made the changes! |
☔ The latest upstream changes (presumably #61741) made this pull request unmergeable. Please resolve the merge conflicts. |
I will then only change the internal representation and parse an I'm sorry that this is taking me so long. I had exams last week and furthermore forgot my development laptop there. I hope I can continue next week. |
Ping from Triage. Hi @Julian-Wollersberger are there any updates for this PR? Thanks! |
Closing this due to inactivity |
…-0, r=varkor support issue = "none" in unstable attributes This works towards fixing rust-lang#41260. This PR allows the use of `issue = "none"` in unstable attributes and makes changes to internally store the issue number as an `Option<NonZeroU32>`. For example: ```rust #[unstable(feature = "unstable_test_feature", issue = "none")] fn unstable_issue_none() {} ``` It was not made optional because feedback seen here rust-lang#60860 suggested that people might forget the issue field if it was optional. I could not remove the current uses of `issue = "0"` (of which there are a lot) because the stage 0 compiler expects the old syntax. Once this is available in the stage 0 compiler we can replace all uses of `"0"` with `"none"` and no longer allow `"0"`. This is my first time contributing, so I'm not sure what the protocol is with two-part things like this, so some guidance would be appreciated. r? @varkor
Fixes #41260
r? @varkor
As requested, I made the
issue
field in#[unstable]
optional.Removing all the
issue = "0"
in libstd and libcore wasn't possible though, because the stage 0 compiler emits an error for the missing issue fields.What's the best solution to do the cleanup? Maybe merging this PR, waiting for the next master to beta promotion and doing the cleanup in a follow-up PR?
The UI tests are cleaned up though.
I also wanted to emit a warning for
issue = "0"
but ran into the same stage 0 problem.And how do you choose or omit the error number in a
struct_span_warn!()
?Thank you for the mentoring, @varkor!