Skip to content

inconsistent lint flag args between normal and post-rustfix compiles in UI tests #50926

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
zackmdavis opened this issue May 20, 2018 · 1 comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@zackmdavis
Copy link
Member

UI tests run with-A unused, but UI tests with the run-rustfix directive go on to apply suggestions and then check that there are no warnings, without passing any lint flags. The inconsistency is a papercut–footgun for UI test authors. We should do exactly one of—

  • Pass -A unused for the rustfix-succeeded check, too; or
  • Stop passing -A unused for UI tests.
    • The present author gave an argument for this in reconsider magic -A unused for UI tests? #43896, but the reception seemed unfavorable (one 👎 react and one negatively-disposed comment). If it turned out that there was support for this after all, we would want someone to edit existing tests to not produce spurious unused warnings, which would be a very large PR.
zackmdavis added a commit to zackmdavis/rust that referenced this issue May 20, 2018
Consider this a down payment on rust-lang#50723. To recap, an `Applicability`
enum was recently (rust-lang#50204) added, to convey to Rustfix and other tools
whether we think it's OK for them to blindly apply the suggestion, or
whether to prompt a human for guidance (because the suggestion might
contain placeholders that we can't infer, or because we think it has a
sufficiently high probability of being wrong even though it's—
presumably—right often enough to be worth emitting in the first place).

When a suggestion is marked as `MaybeIncorrect`, we try to use comments
to indicate precisely why (although there are a few places where we just
say `// speculative` because the present author's subjective judgement
balked at the idea that the suggestion has no false positives).

The `run-rustfix` directive is opporunistically set on some relevant UI
tests (and a couple tests that were in the `test/ui/suggestions`
directory, even if the suggestions didn't originate in librustc or
libsyntax). This is less trivial than it sounds, because a surprising
number of test files aren't equipped to be tested as fixed even when
they contain successfully fixable errors, because, e.g., there are more,
not-directly-related errors after fixing. Some test files need an
attribute or underscore to avoid unused warnings tripping up the "fixed
code is still producing diagnostics" check despite the fixes being
correct; this is an interesting contrast-to/inconsistency-with the
behavior of UI tests (which secretly pass `-A unused`), a behavior which
we probably ought to resolve one way or the other (filed issue rust-lang#50926).

A few suggestion labels are reworded (e.g., to avoid phrasing it as a
question, which which is discouraged by the style guidelines listed in
`.span_suggestion`'s doc-comment).
@zackmdavis zackmdavis added the A-testsuite Area: The testsuite used to check the correctness of rustc label Sep 12, 2018
@XAMPPRocky XAMPPRocky added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 2, 2018
@Mark-Simulacrum
Copy link
Member

It does seem like passing -A unused to rustfix would be a good change to make here, and at a cursory look at the code it seems like we do that today? But if I'm wrong then we can, of course, reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants