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

Add note that struct declaration within a struct is not allowed #101540

Closed
Rageking8 opened this issue Sep 7, 2022 · 2 comments · Fixed by #102143
Closed

Add note that struct declaration within a struct is not allowed #101540

Rageking8 opened this issue Sep 7, 2022 · 2 comments · Fixed by #102143
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Rageking8
Copy link
Contributor

Rageking8 commented Sep 7, 2022

Given the following code: link

struct S1 {
    struct S2 {

    }
}

fn main() {

}

The current output is:

   Compiling playground v0.0.1 (/playground)
error: expected identifier, found keyword `struct`
 --> src/main.rs:2:5
  |
2 |     struct S2 {
  |     ^^^^^^ expected identifier, found keyword

error: could not compile `playground` due to previous error

Ideally the output should include a note informing the user that the declaration of another struct within a struct is not allowed and they should use separate declarations. (Wording might need a bit of tweaking).

@Rageking8 Rageking8 added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 7, 2022
@BGR360
Copy link
Contributor

BGR360 commented Sep 12, 2022

@rustbot label D-terse

@rustbot rustbot added the D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. label Sep 12, 2022
@Rageking8
Copy link
Contributor Author

@rustbot claim

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 D-terse Diagnostics: An error or lint that doesn't give enough information about the problem at hand. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants