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

there's no #[allow(shadowed_label_names)] #31745

Closed
durka opened this issue Feb 18, 2016 · 9 comments · Fixed by #96296
Closed

there's no #[allow(shadowed_label_names)] #31745

durka opened this issue Feb 18, 2016 · 9 comments · Fixed by #96296
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@durka
Copy link
Contributor

durka commented Feb 18, 2016

The warning about shadowed label names can't be turned off. Seems like it ought to have some name and be under the "future incompatible" lint group.

EDIT (ehuss):

Example:

// Doesn't matter where these are defined, as long as they are in the same function.
'a: loop { break 'a; }
'a: loop { break 'a; } // warning: loop name `'a` shadows a label name that is already in scope

Warning added in #24162, see also #21633 and https://internals.rust-lang.org/t/psa-rejecting-duplicate-loop-labels/1833.

@jonas-schievink
Copy link
Contributor

This might become a hard error later, so it doesn't seem like a good idea to turn the warning off

@durka
Copy link
Contributor Author

durka commented Feb 18, 2016

Seems like the same argument could be applied to the other future-incompatibility lints. What even is the plan for a feature that might make duplicate labels within a function a problem? goto 'a

Also, there are false positives of this warning (for example, a label name within a closure). I will file a separate bug, but false positives would be a motivation for locally turning off the warning.

@jonas-schievink
Copy link
Contributor

I think there was this idea of allowing nameable regions ('a: { /* stuff */ }), other than that, I don't know

@steveklabnik steveklabnik added the A-diagnostics Area: Messages for errors, warnings, and lints label Mar 11, 2016
@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. I-needs-decision Issue: In need of a decision. labels Jul 24, 2017
@steveklabnik
Copy link
Member

Triage: not aware of any changes

@durka
Copy link
Contributor Author

durka commented Nov 1, 2018

Is the compiler team planning to make the needed decision? ;) Otherwise we should just close.

@petrochenkov
Copy link
Contributor

Fun fact: I-needs-decision issues are not looked at during compiler team triage meetings.
cc @pnkfelix

@petrochenkov
Copy link
Contributor

This doesn't need decision, just implementation - with current state of hygiene false positives can just be fixed and everything else turned into hard errors (this stuff issued deprecation warnings for very long time).

I'll r+ a PR turning this into a deny-by-default lint as well.

@petrochenkov petrochenkov removed the I-needs-decision Issue: In need of a decision. label Nov 1, 2018
@estebank estebank added the A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. label May 29, 2019
@Centril
Copy link
Contributor

Centril commented Mar 26, 2020

Could someone add a reproducer to this issue?

@WiSaGaN
Copy link
Contributor

WiSaGaN commented Aug 23, 2021

Is there any reasonable possibility that we will actually implement the feature that has the future-imcompatibility issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants