Skip to content

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

Open
@olegnn

Description

@olegnn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.D-papercutDiagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions