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

Chained comparison error doesn't distinguish between < and > #79161

Closed
varkor opened this issue Nov 18, 2020 · 2 comments · Fixed by #106606
Closed

Chained comparison error doesn't distinguish between < and > #79161

varkor opened this issue Nov 18, 2020 · 2 comments · Fixed by #106606
Labels
A-const-generics Area: const generics (parameters and arguments) A-diagnostics Area: Messages for errors, warnings, and lints D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@varkor
Copy link
Member

varkor commented Nov 18, 2020

fn main() {
    foo<<S as T>::V>();
}

produces the help message:

help: use `::<...>` instead of `<...>` to specify type or const arguments
   |
16 |     foo<<S as T::>::V>();
   |                ^^

This is clearly invalid: we should be distinguishing between < and > when making this suggestion.

@varkor varkor added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-const-generics Area: const generics (parameters and arguments) D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. labels Nov 18, 2020
@estebank
Copy link
Contributor

the <S as T> confuses the parser as it doesn't account for as for recovery, I think it is being parsed as (foo << S) as <TYPE HERE>.

@pierwill
Copy link
Member

Possibly related to #59828.

compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 9, 2023
…ompiler-errors

Do not emit structured suggestion for turbofish with wrong span

Fix rust-lang#79161.
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 9, 2023
…ompiler-errors

Do not emit structured suggestion for turbofish with wrong span

Fix rust-lang#79161.
@bors bors closed this as completed in 6fdb54d Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) A-diagnostics Area: Messages for errors, warnings, and lints D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. 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.

3 participants