Skip to content

Awesome "help" message suggesting turbofish doesn't always appear #40396

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jorendorff opened this issue Mar 9, 2017 · 0 comments
Closed

Awesome "help" message suggesting turbofish doesn't always appear #40396

jorendorff opened this issue Mar 9, 2017 · 0 comments
Labels
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.

Comments

@jorendorff
Copy link
Contributor

Actual behavior: When you compile this program,

fn main() {
    println!("{:?}", (0..13).collect<Vec<i32>>());
}

this is the error message:

error: chained comparison operators require parentheses
 --> collect_err.rs:2:37
  |
2 |     println!("{:?}", (0..13).collect<Vec<i32>>());
  |                                     ^^^^^^^^

Expected behavior: If you trigger this error in a slightly different way,

fn main() {
    println!("{:?}", Vec<i32>::new());
}

you get a lovely "help" message at the end:

error: chained comparison operators require parentheses
 --> collect_err.rs:2:25
  |
2 |     println!("{:?}", Vec<i32>::new());
  |                         ^^^^^^^
  |
  = help: use `::<...>` instead of `<...>` if you meant to specify type arguments

The bug is that the first program does not trigger this help message.

@TimNN TimNN added the A-diagnostics Area: Messages for errors, warnings, and lints label Mar 9, 2017
@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 15, 2017
Point out correct turbofish usage on `Foo<Bar<Baz>>`

Whenever we parse a chain of binary operations, as long as the first
operation is `<` and the subsequent operations are either `>` or `<`,
present the following diagnostic help:

    use `::<...>` instead of `<...>` if you meant to specify type arguments

This will lead to spurious recommendations on situations like
`2 < 3 < 4` but should be clear from context that the help doesn't apply
in that case.

Fixes rust-lang#40396.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 17, 2017
Point out correct turbofish usage on `Foo<Bar<Baz>>`

Whenever we parse a chain of binary operations, as long as the first
operation is `<` and the subsequent operations are either `>` or `<`,
present the following diagnostic help:

    use `::<...>` instead of `<...>` if you meant to specify type arguments

This will lead to spurious recommendations on situations like
`2 < 3 < 4` but should be clear from context that the help doesn't apply
in that case.

Fixes rust-lang#40396.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 17, 2017
Point out correct turbofish usage on `Foo<Bar<Baz>>`

Whenever we parse a chain of binary operations, as long as the first
operation is `<` and the subsequent operations are either `>` or `<`,
present the following diagnostic help:

    use `::<...>` instead of `<...>` if you meant to specify type arguments

This will lead to spurious recommendations on situations like
`2 < 3 < 4` but should be clear from context that the help doesn't apply
in that case.

Fixes rust-lang#40396.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 17, 2017
Point out correct turbofish usage on `Foo<Bar<Baz>>`

Whenever we parse a chain of binary operations, as long as the first
operation is `<` and the subsequent operations are either `>` or `<`,
present the following diagnostic help:

    use `::<...>` instead of `<...>` if you meant to specify type arguments

This will lead to spurious recommendations on situations like
`2 < 3 < 4` but should be clear from context that the help doesn't apply
in that case.

Fixes rust-lang#40396.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 17, 2017
Point out correct turbofish usage on `Foo<Bar<Baz>>`

Whenever we parse a chain of binary operations, as long as the first
operation is `<` and the subsequent operations are either `>` or `<`,
present the following diagnostic help:

    use `::<...>` instead of `<...>` if you meant to specify type arguments

This will lead to spurious recommendations on situations like
`2 < 3 < 4` but should be clear from context that the help doesn't apply
in that case.

Fixes rust-lang#40396.
frewsxcv added a commit to frewsxcv/rust that referenced this issue Mar 17, 2017
Point out correct turbofish usage on `Foo<Bar<Baz>>`

Whenever we parse a chain of binary operations, as long as the first
operation is `<` and the subsequent operations are either `>` or `<`,
present the following diagnostic help:

    use `::<...>` instead of `<...>` if you meant to specify type arguments

This will lead to spurious recommendations on situations like
`2 < 3 < 4` but should be clear from context that the help doesn't apply
in that case.

Fixes rust-lang#40396.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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.
Projects
None yet
Development

No branches or pull requests

3 participants