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

Doc block not allowed for the last element of an enum #17411

Closed
Geal opened this issue Sep 20, 2014 · 2 comments
Closed

Doc block not allowed for the last element of an enum #17411

Geal opened this issue Sep 20, 2014 · 2 comments

Comments

@Geal
Copy link
Contributor

Geal commented Sep 20, 2014

enum a { 
  B = 0, /** hello */
  C, /** world */
  D /** ! */
}

fn main() {
}
$ rustc enum.rs 
enum.rs:4:5: 4:13 error: expected `}`, found `/** ! */`
enum.rs:4   D /** ! */
              ^~~~~~~~

Not a big issue, but still a bit annoying. If I remove the last code blocks, it compiles fine.

@ben0x539
Copy link
Contributor

The doc blocks have to go before the enum variants, not after them.

enum a {
  /** hello */
  B = 0,
  /** world */
  C,
  /** ! */
  D
}

@steveklabnik
Copy link
Member

Yes, this is currently expected behavior.

lnicola pushed a commit to lnicola/rust that referenced this issue Jul 11, 2024
fix: Improve hover text in unlinked file diagnostics

Use full sentences, and mention how to disable the diagnostic if users are intentionally working on unowned files.

![Screenshot 2024-06-12 at 5 55 48 PM](https://github.com/rust-lang/rust-analyzer/assets/70800/c91ee1ed-1c72-495a-9ee3-9e360a5c6977)

(Full disclosure: I've tested a rust-analyzer build in VS Code, but the pop-up logic is currently disabled due to rust-lang#17062, so I haven't tested that.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants