Skip to content

improve error message when the content of loop is not a block #12213

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

Closed
arielb1 opened this issue Feb 12, 2014 · 0 comments
Closed

improve error message when the content of loop is not a block #12213

arielb1 opened this issue Feb 12, 2014 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@arielb1
Copy link
Contributor

arielb1 commented Feb 12, 2014

This useful-looking fragment

loop match x {
  a => {...}
  b => {...}
}

Gives the confusing error

... error: obsolete syntax: `loop` instead of `continue`
note: `loop` is now only used for loops and `continue` is used for skipping iterations

Which is totally unrelated to the solution - putting a block around loop

loop { match x {
  a => {...}
  b => {...}
}}

Either this kind of construct should be allowed or the error message should be improved.

@arielb1 arielb1 closed this as completed Feb 13, 2014
@arielb1 arielb1 reopened this Feb 13, 2014
@huonw huonw added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 10, 2014
@huonw huonw closed this as completed in 26282ac Nov 14, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
fix: Fix incorrect config patching for runBuildScripts
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 28, 2025
)

Some widely used crates, such as `pin-project-lite`, make use of a
`pub(crate)` construct in a private module inside a public macro. This
makes unrelated project trigger the lint.

There is also an unfortunate situation for Clippy itself: when a new
version of `pin-project-lite` or similar lint-trigerring crates is
released, those lints which can be found in hundreds of occurrences in
dependent crates will change, and appear as diffs in unrelated Clippy PR
because the base lintcheck run will be cached with the ancient release
of the crates. We currently have the situation
[here](https://github.com/rust-lang/rust-clippy/actions/runs/12635410895?pr=13851#user-content-redundant-pub-crate-removed),
which 219 lints removed and 219 lints added because of a
`pin-project-lite` version change between runs, and the fact that
`redundant_pub_crate` triggers on external macros.

Also:
- Fix rust-lang#10636
- Fix rust-lang#12213

changelog: [`redundant_pub_crate`]: do not trigger on external macros
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
Projects
None yet
Development

No branches or pull requests

2 participants