Skip to content

Incorrect error for type already defined in scope using raw identifiers #69054

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

Closed
olegnn opened this issue Feb 11, 2020 · 1 comment
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. 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

trait T<r#fn> {
    fn f<r#fn>() {}
}

fn main() {}

(Playground)

Gives incorrect error for type declared using raw identifiers:

error[E0403]: the name `fn` is already used for a generic parameter in this item's generic parameters
 --> src/main.rs:2:10
  |
1 | trait T<r#fn> {
  |         ---- first use of `fn`
2 |     fn f<r#fn>() {}
  |          ^^^^ already used

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

warning: type parameter `fn` should have an upper camel case name
 --> src/main.rs:2:10
  |
2 |     fn f<r#fn>() {}
  |          ^^^^ help: convert the identifier to upper camel case: `Fn`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0403`.
error: could not compile `playground`.
@Elinvynia Elinvynia added A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. labels May 21, 2020
@crlf0710 crlf0710 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 11, 2020
@estebank
Copy link
Contributor

Current output:

error[E0403]: the name `r#fn` is already used for a generic parameter in this item's generic parameters
 --> src/main.rs:2:10
  |
1 | trait T<r#fn> {
  |         ---- first use of `r#fn`
2 |     fn f<r#fn>() {}
  |          ^^^^ already used

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

warning: type parameter `fn` should have an upper camel case name
 --> src/main.rs:2:10
  |
2 |     fn f<r#fn>() {}
  |          ^^^^ help: convert the identifier to upper camel case: `Fn`

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. 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