Skip to content

"cycle detected" with impl Self {} #93952

Closed
@matthiaskrgr

Description

@matthiaskrgr

Given the following code:

impl Self {}

The current output is:

error[E0391]: cycle detected when computing type of `<impl at src/main.rs:1:1: 1:13>`
 --> src/main.rs:1:6
  |
1 | impl Self {}
  |      ^^^^
  |
  = note: ...which immediately requires computing type of `<impl at src/main.rs:1:1: 1:13>` again
note: cycle used when collecting item types in top-level module
 --> src/main.rs:1:1
  |
1 | impl Self {}
  | ^^^^^^^^^

For more information about this error, try `rustc --explain E0391`.

Ideally the output should look like:

Something more like

error[E0412]: cannot find type `Self` in this scope
 --> src/main.rs:1:6
  |
1 | impl Self {}
  |      ^^^^ not found in this scope

Or even a better message explaining that there should be an actual type there instead of just "Self" ..?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-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