-
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
Tracking issue for future-incompatibility lint missing_fragment_specifier
#40107
Comments
missing_fragment_specifiers
future-compatibility warningsmissing_fragment_specifier
future-compatibility warnings
Bump `clap` to fix the build on new versions of `rustc` (see [rust-lang/rust#42894](rust-lang/rust#42894) and [rust-lang/rust#40107](rust-lang/rust#40107) for details)
As far as I can tell a macro rule which triggers this warning is not actually usable; is there any reason not to make this an error right now? See Edit: it seems in nightly the lint default was changed to |
Transition some C-future-compatibility lints to {ERROR, DENY} Closes #40107 (ERROR). Closes #39207 (ERROR). Closes #37872 (ERROR). Closes #36887 (ERROR). Closes #36247 (ERROR. Closes #42238 (ERROR). Transitions #59014 (DENY). Transitions #57571 (DENY). Closes #60210 (ERROR). Transitions #35203 (DENY). r? @petrochenkov
Triage: this is still deny by default. |
…_specifier_hard_error, r=Mark-Simulacrum Revert missing fragment specifier hard error Closes rust-lang#76605 Reopens rust-lang#40107 r? ``@Mark-Simulacrum``
…_specifier_hard_error, r=Mark-Simulacrum Revert missing fragment specifier hard error Closes rust-lang#76605 Reopens rust-lang#40107 r? ```@Mark-Simulacrum```
…pecifier_hard_error, r=Mark-Simulacrum Revert missing fragment specifier hard error Closes rust-lang#76605 Reopens rust-lang#40107 r? `@Mark-Simulacrum`
Given the story behind this I think that a possible course of action would be to promote this to a hard error only on 2021 edition. This would neatly sidestep the breakage observed in the ecosystem. cc @rust-lang/compiler @rust-lang/lang |
I don't think an edition-specific hard error buys us much over the current situation. I think we should make the lint an error on all editions, but affected by cap-lints - essentially a forbid-by-default lint. That should remove the global state that @matklad wanted to remove and avoid too much complexity, while essentially avoiding any of the known cases where there's breakage. I suspect that we could also just make it a hard error in the new edition (no cap-lints) but it's not really necessary IMO, just complicates things. |
I think this would be a good fit for |
I am a fan of promoting lints to hard errors on edition boundaries, despite the implementation burden. It gives us a remarkably powerful tool for language evolution (once we have determined that is the right decision). |
I'm doing a lot of typos today thanks to rust-analyzer not working; found this issue through me typing:
or
I can't remember ever seeing these kinds of macros this warning issue is for live but it does sound like the parser begins reading another parameter on |
rust-lang/cargo#8825 has been merged, so this (among many other issues tagged C-future-incompatibility) could be a candidate for becoming a hard error in a future edition. |
I'm sorry, I'm not clear on what your comment is asking. The two examples you wrote look like buggy code to me, and so I think the lint is correctly firing on them. Can you explain what you think should be happening instead? |
@pnkfelix Note that this lint (along with all of the other future-incompat lints) is not included in the future-incompat report by default. That is, the lint will continue to be completely hidden when the crate is compiled as a dependency. The only lints that show up in the cargo report are ones marked |
`missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout. Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`. Fixes <rust-lang#40107>
`missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout. Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`. Fixes <rust-lang#40107>
…r-e2024, r=petrochenkov Make `missing_fragment_specifier` an error in edition 2024 `missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout. Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`. Fixes <rust-lang#40107> --- It is rather late for the edition but since this change is relatively small, it seems worth at least bringing up. This follows a brief [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/.60.20DBD.20-.3E.20hard.20error) (cc `@tmandry).` Making this an edition-dependent lint has come up before but there was not a strong motivation. I am proposing it at this time because this would simplify the [named macro capture groups](rust-lang/rfcs#3649) RFC, which has had mildly positive response, and makes use of new `$` syntax in the matcher. The proposed syntax currently parses as metavariables without a fragment specifier; this warning is raised, but there are no errors. It is obviously not known that this specific RFC will eventually be accepted, but forbidding `missing_fragment_specifier` should make it easier to support any new syntax in the future that makes use of `$` in different ways. The syntax conflict is also not impossible to overcome, but making it clear that unnamed metavariables are rejected makes things more straightforward and should allow for better diagnostics. `@Mark-Simulacrum` suggested making this forbid-by-default instead of an error at rust-lang#40107 (comment), but I don't think this would allow the same level of syntax flexibility. It is also possible to reconsider making this an unconditional error since four years have elapsed since the previous attempt, but this seems likely to hit the same pitfalls. (Possibly worth a crater run?) Tracking: - rust-lang#128143
…e2024, r=petrochenkov Make `missing_fragment_specifier` an error in edition 2024 `missing_fragment_specifier` has been a future compatibility warning since 2017. Uplifting it to an unconditional hard error was attempted in 2020, but eventually reverted due to fallout. Make it an error only in edition >= 2024, leaving the lint for older editions. This change will make it easier to support more macro syntax that relies on usage of `$`. Fixes <rust-lang#40107> --- It is rather late for the edition but since this change is relatively small, it seems worth at least bringing up. This follows a brief [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/.60.20DBD.20-.3E.20hard.20error) (cc `@tmandry).` Making this an edition-dependent lint has come up before but there was not a strong motivation. I am proposing it at this time because this would simplify the [named macro capture groups](rust-lang/rfcs#3649) RFC, which has had mildly positive response, and makes use of new `$` syntax in the matcher. The proposed syntax currently parses as metavariables without a fragment specifier; this warning is raised, but there are no errors. It is obviously not known that this specific RFC will eventually be accepted, but forbidding `missing_fragment_specifier` should make it easier to support any new syntax in the future that makes use of `$` in different ways. The syntax conflict is also not impossible to overcome, but making it clear that unnamed metavariables are rejected makes things more straightforward and should allow for better diagnostics. `@Mark-Simulacrum` suggested making this forbid-by-default instead of an error at rust-lang#40107 (comment), but I don't think this would allow the same level of syntax flexibility. It is also possible to reconsider making this an unconditional error since four years have elapsed since the previous attempt, but this seems likely to hit the same pitfalls. (Possibly worth a crater run?) Tracking: - rust-lang#128143
I'm going to reopen since I don't think this should have been closed. It is still a future-incompatible lint generating reports in dependencies. #128006 just changed it in the 2024 edition to be a hard error. Per #128006 (comment), it is still being considered to make this a hard-error in all editions. I think this issue would be as good as any for tracking that final step (and making a decision on it). |
There is a crater run queued for a hard error at #128425. |
missing_fragment_specifier
future-compatibility warningsmissing_fragment_specifier
This is the summary issue for the
missing_fragment_specifier
future-compatibility warning and other related errors. The goal of this page is describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made.What is the warning for?
The
missing_fragment_specifier
warning is issued when an unused pattern in amacro_rules!
macro definition has a meta-variable (e.g.$e
) that is not followed by a fragment specifier (e.g.:expr
).This warning can always be fixed by removing the unused pattern in the
macro_rules!
macro definition.When will this warning become a hard error?
At the beginning of each 6-week release cycle, the Rust compiler team will review the set of outstanding future compatibility warnings and nominate some of them for Final Comment Period. Toward the end of the cycle, we will review any comments and make a final determination whether to convert the warning into a hard error or remove it entirely.
Current status
TokenTree
and fixmacro_rules!
bugs #39419missing_fragment_specifier
lint as warn-by-defaultmissing_fragment_specifier
lint deny-by-defaultmissing_fragment_specifier
lint a hard errorThe text was updated successfully, but these errors were encountered: