Implement suggestion for never type fallback lints by compiler-errors · Pull Request #132383 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation15 Commits6 Checks6 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

compiler-errors

r? @WaffleLapkin

Just opening this up for vibes; it's not done yet. I'd still like to make this suggestable in a few more cases before merge:

The only other case we may want to suggest is a missing turbofish, like f() -> f::<()>(). That may be possible, but seems overly annoying.

This partly addresses #132358; the other half of fixing that would be to make the error message a bit better, perhaps just special casing the ? operator 🤔 I don't think I'll do that part.

@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

Oct 31, 2024

compiler-errors

@compiler-errors

yippee this is ready i think

@compiler-errors

We could, perhaps, even reuse this suggestion to tell users to annotate their code with () even after edition 2024.

WaffleLapkin

Choose a reason for hiding this comment

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

I love the diagnostic changes, that all look very good!

I have a couple minor questions.

Comment on lines +607 to +618

// We can't turbofish consts :(
&& args.iter().all(|arg matches!(arg.unpack(), ty::GenericArgKind::Type(_)

Choose a reason for hiding this comment

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

I'm not sure I understand? this checks that there are no const genetics, but you can turbofish those?

Choose a reason for hiding this comment

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

I wanted to limit the complexity of the suggestion so it would just either have _ for all the non fallback args, but consts cant use _

Choose a reason for hiding this comment

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

Ah, ic

}
/// Try to collect a useful suggestion to preserve fallback to `()`.
struct VidVisitor<'a, 'tcx> {

Choose a reason for hiding this comment

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

maybe name it daunting else? I'm not sure what tho, but something that highlights that it finds possible suggestion places...

Choose a reason for hiding this comment

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

Ya i can name it better and give it a pass for more comments

Choose a reason for hiding this comment

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

r=me after that then

@compiler-errors

@bors

📌 Commit b4248ae has been approved by WaffleLapkin

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Nov 1, 2024

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Nov 1, 2024

@matthiaskrgr

…k-sugg, r=WaffleLapkin

Implement suggestion for never type fallback lints

r? @WaffleLapkin

Just opening this up for vibes; it's not done yet. I'd still like to make this suggestable in a few more cases before merge:

The only other case we may want to suggest is a missing turbofish, like f() -> f::<()>(). That may be possible, but seems overly annoying.

This partly addresses rust-lang#132358; the other half of fixing that would be to make the error message a bit better, perhaps just special casing the ? operator 🤔 I don't think I'll do that part.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Nov 1, 2024

@bors

…iaskrgr

Rollup of 6 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

jieyouxu added a commit to jieyouxu/rust that referenced this pull request

Nov 1, 2024

@jieyouxu

…k-sugg, r=WaffleLapkin

Implement suggestion for never type fallback lints

r? @WaffleLapkin

Just opening this up for vibes; it's not done yet. I'd still like to make this suggestable in a few more cases before merge:

The only other case we may want to suggest is a missing turbofish, like f() -> f::<()>(). That may be possible, but seems overly annoying.

This partly addresses rust-lang#132358; the other half of fixing that would be to make the error message a bit better, perhaps just special casing the ? operator 🤔 I don't think I'll do that part.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Nov 1, 2024

@bors

Rollup of 13 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Nov 1, 2024

@bors

…llaumeGomez

Rollup of 14 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Nov 2, 2024

@rust-timer

Rollup merge of rust-lang#132383 - compiler-errors:never-type-fallback-sugg, r=WaffleLapkin

Implement suggestion for never type fallback lints

r? @WaffleLapkin

Just opening this up for vibes; it's not done yet. I'd still like to make this suggestable in a few more cases before merge:

The only other case we may want to suggest is a missing turbofish, like f() -> f::<()>(). That may be possible, but seems overly annoying.

This partly addresses rust-lang#132358; the other half of fixing that would be to make the error message a bit better, perhaps just special casing the ? operator 🤔 I don't think I'll do that part.

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.