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

Make inline suggestions no longer be the default #127282

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jul 3, 2024

Make the default suggestions show the full patch output instead of trying to render inline.

Before

error: almost complete ascii range
  --> tests/ui/almost_complete_range.rs:17:17
   |
LL |         let _ = ('a') ..'z';
   |                 ^^^^^^--^^^
   |                       |
   |                       help: use an inclusive range: `..=`
   |
   = note: `-D clippy::almost-complete-range` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]`

After

error: almost complete ascii range
  --> tests/ui/almost_complete_range.rs:17:17
   |
LL |         let _ = ('a') ..'z';
   |                 ^^^^^^^^^^^
   |
   = note: `-D clippy::almost-complete-range` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]`
help: use an inclusive range
   |
LL |         let _ = ('a') ..='z';
   |                       ~~~

The inline suggestions output has worse readability than the "verbose" output, and it also (as evidenced in the diff of this PR) tends to hide when the suggestion span is slightly off. Backing off of the inline suggestions will also make it easier to migrate to annotate-snippets, as it will be one fewer special case to handle.

@rustbot
Copy link
Collaborator

rustbot commented Jul 3, 2024

r? @fmease

rustbot has assigned @fmease.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 3, 2024
@estebank estebank changed the title Experiment with not using inline suggestions Make inline suggestions no longer be the default Jul 3, 2024
@estebank estebank force-pushed the experiment-for-annotate-snippets branch 2 times, most recently from 8ef3d49 to 1791206 Compare July 3, 2024 19:18
@estebank estebank marked this pull request as ready for review July 3, 2024 19:19
@rustbot
Copy link
Collaborator

rustbot commented Jul 3, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rust-log-analyzer

This comment has been minimized.

@estebank estebank force-pushed the experiment-for-annotate-snippets branch from 1791206 to ba252ed Compare July 3, 2024 19:52
@estebank
Copy link
Contributor Author

estebank commented Jul 3, 2024

I noticed a bunch of mistakes in current suggestions thanks to the new output, but all of those can go on other PRs.

Comment on lines +210 to +213
help: use an inclusive range
|
LL | 'a'...'z' => 1,
| ~~~
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This clippy suggestions are just plain wrong, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the old pattern syntax for when MSRV is set to the ancient times

#[clippy::msrv = "1.25"]
fn _under_msrv() {
let _ = match 'a' {
'a'..'z' => 1,
'A'..'Z' => 2,
'0'..'9' => 3,
_ => 4,
};
}

Comment on lines +100 to +101
LL | CustomFutureType.await
|
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, we're missing an underline here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this happen, because we're replacing the entire line? The clippy suggestion probably doesn't add the .await, but suggests to remove the CustomFutureType and add CustomFutureType.await.

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map(|o| o + 1)`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clippyy needs to have better messages for these suggestions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

bors commented Jul 4, 2024

☔ The latest upstream changes (presumably #127326) made this pull request unmergeable. Please resolve the merge conflicts.

Before

```
error: almost complete ascii range
  --> tests/ui/almost_complete_range.rs:17:17
   |
LL |         let _ = ('a') ..'z';
   |                 ^^^^^^--^^^
   |                       |
   |                       help: use an inclusive range: `..=`
   |
   = note: `-D clippy::almost-complete-range` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]`
```

After

```
error: almost complete ascii range
  --> tests/ui/almost_complete_range.rs:17:17
   |
LL |         let _ = ('a') ..'z';
   |                 ^^^^^^^^^^^
   |
   = note: `-D clippy::almost-complete-range` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::almost_complete_range)]`
help: use an inclusive range
   |
LL |         let _ = ('a') ..='z';
   |                       ~~~
```
@estebank estebank force-pushed the experiment-for-annotate-snippets branch from 20bf5b1 to eb6c593 Compare July 5, 2024 00:27
@rustbot
Copy link
Collaborator

rustbot commented Jul 5, 2024

HIR ty lowering was modified

cc @fmease

Some changes occurred in const_evaluatable.rs

cc @BoxyUwU

Some changes occurred in tests/ui/check-cfg

cc @Urgau

Some changes occurred in tests/ui/sanitizer

cc @rust-lang/project-exploit-mitigations, @rcvalle

rustc_macros::diagnostics was changed

cc @davidtwco, @compiler-errors, @TaKO8Ki

Some changes occurred in match checking

cc @Nadrieril

@estebank
Copy link
Contributor Author

estebank commented Jul 5, 2024

This PR is too big as is, but the diff helps identify specific suggestions that are currently not-perfect, or flat-out wrong. I'll try to fix those things one at a time in separate PRs, making this PR smaller and smaller over time.

@bors
Copy link
Contributor

bors commented Jul 5, 2024

☔ The latest upstream changes (presumably #127008) made this pull request unmergeable. Please resolve the merge conflicts.

@estebank estebank marked this pull request as draft July 12, 2024 18:47
@fmease fmease added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants