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

r# stripped from raw idents in lint and type annotations needed error #69052

Open
olegnn opened this issue Feb 11, 2020 · 7 comments
Open

r# stripped from raw idents in lint and type annotations needed error #69052

olegnn opened this issue Feb 11, 2020 · 7 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. D-papercut Diagnostics: An error or lint that needs small tweaks. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@olegnn
Copy link
Contributor

olegnn commented Feb 11, 2020

This code

fn r<r#trait>() {}

fn main() {
    r();
}

(Playground)

Gives incorrect warning and error for type declared using raw identifiers:

warning: type parameter `trait` should have an upper camel case name
 --> src/main.rs:1:6
  |
1 | fn r<r#trait>() {}
  |      ^^^^^^^ help: convert the identifier to upper camel case: `Trait`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

error[E0282]: type annotations needed
 --> src/main.rs:4:5
  |
4 |     r();
  |     ^ cannot infer type for type parameter `trait`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.
error: could not compile `playground`.

NOTE: This is about the diagnostics not including the r# in each case.

@jonas-schievink

This comment has been minimized.

@Centril

This comment has been minimized.

@Centril Centril closed this as completed Feb 11, 2020
@olegnn

This comment has been minimized.

@olegnn

This comment has been minimized.

@Centril Centril reopened this Feb 11, 2020
@Centril

This comment has been minimized.

@Centril Centril added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. labels Feb 11, 2020
@olegnn

This comment has been minimized.

@Centril Centril changed the title Incorrect warning and type annotations needed error for types defined using raw identifiers r# stripped from raw idents in lint and type annotations needed error Feb 11, 2020
@estebank estebank added the D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. label Jun 29, 2023
@estebank
Copy link
Contributor

Current output:

error[[E0282]](https://doc.rust-lang.org/nightly/error_codes/E0282.html): type annotations needed
 --> src/main.rs:4:5
  |
4 |     r();
  |     ^ cannot infer type of the type parameter `fn` declared on the function `r`
  |
help: consider specifying the generic argument
  |
4 |     r::<fn>();
  |      ++++++

We'll need another repro case for a message not including r# in the token name (I think there are other tickets about it).

@estebank estebank added D-papercut Diagnostics: An error or lint that needs small tweaks. and removed D-invalid-suggestion Diagnostics: A structured suggestion resulting in incorrect code. labels Aug 14, 2023
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 C-bug Category: This is a bug. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. D-papercut Diagnostics: An error or lint that needs small tweaks. 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

4 participants