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

Poor diagnostic for impl for T #56031

Closed
Ravenslofty opened this issue Nov 17, 2018 · 1 comment
Closed

Poor diagnostic for impl for T #56031

Ravenslofty opened this issue Nov 17, 2018 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@Ravenslofty
Copy link

I accidentally typed impl for T instead of impl T, and the diagnostic (playground) wasn't very helpful:

  |
3 | impl for T {}
  |          ^ expected `<` here

This appears to be because of this syntax:

impl for<'a> T

However it makes no sense in this case. Perhaps better diagnostics would look something like this:

  |
3 | impl for T {}
  |     ^ expected type
@troiganto
Copy link

Maybe relatedly, this code compiles on stable 1.30.0:

trait Trait {}

impl for<'a> Trait {}

fn main() {}

(Playground link)

@oli-obk oli-obk added the A-diagnostics Area: Messages for errors, warnings, and lints label Nov 18, 2018
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…rochenkov

Adds help message in error for invalid `impl for T` syntax

Fixes rust-lang#56031.
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…rochenkov

Adds help message in error for invalid `impl for T` syntax

Fixes rust-lang#56031.
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…rochenkov

Adds help message in error for invalid `impl for T` syntax

Fixes rust-lang#56031.
Centril added a commit to Centril/rust that referenced this issue Mar 10, 2019
…rochenkov

Adds help message in error for invalid `impl for T` syntax

Fixes rust-lang#56031.
Centril added a commit to Centril/rust that referenced this issue Mar 11, 2019
…rochenkov

Adds help message in error for invalid `impl for T` syntax

Fixes rust-lang#56031.
bors added a commit that referenced this issue Mar 18, 2019
Adds help message in error for invalid `impl for T` syntax

Fixes #56031.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

3 participants