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

Compile error when there are field-level doccomments #41

Closed
nightkr opened this issue Dec 19, 2020 · 2 comments
Closed

Compile error when there are field-level doccomments #41

nightkr opened this issue Dec 19, 2020 · 2 comments
Labels
C-bug Category: related to a bug.

Comments

@nightkr
Copy link

nightkr commented Dec 19, 2020

use pin_project_lite::pin_project;

pin_project! {
    struct Foo {
        /// asdf
        bar: String,
    }
}

fails to compile, with the error message:

error: no rules expected the token `[`
 --> src/foo.rs:3:1
  |
3 | / pin_project! {
4 | |     struct Foo {
5 | |         /// asdf
6 | |         bar: String,
7 | |     }
8 | | }
  | |_^ no rules expected this token in macro call
  |
  = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

This version (without the doccomment) compiles just fine:

use pin_project_lite::pin_project;

pin_project! {
    struct Foo {
        bar: String,
    }
}
@taiki-e
Copy link
Owner

taiki-e commented Dec 19, 2020

This is a known limitation (#3, due to doc comment will be passed as #[doc] to macro), see #3 (comment) for the workaround.

@taiki-e taiki-e added the C-bug Category: related to a bug. label Dec 19, 2020
@nightkr
Copy link
Author

nightkr commented Dec 19, 2020

Ah, managed to miss that. Oh well. Guess I should close this since it doesn't really add anything new.

@nightkr nightkr closed this as completed Dec 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants