You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normally a lexer (rightfully) excludes non-doc comments but I have a particular usecase where having the opt-in ability to lex normal comments would be appreciated.
In a safety-critical project I'd like to write a lint pass whereby all instances of unsafe {} blocks are commented with a // SAFETY comment explaining the use of the unsafe block in order to enforce this documentation. It's a convention in the codebase already but it's something I'd like to make sure is enforceable via CI.
I could fork proc-macro2 to add this of course but I wanted to see if this was something upstream would be interested in having, or at least to see if there was maybe a better way of going about doing this - especially since having the feature enabled would break syn parsing unless it was patched to ignore comment tokens.
Would the better approach just be to allow the "useless doc comment" lint and instead enforce that statements with unsafe blocks have a #[doc] attribute?
Thanks for any info!
The text was updated successfully, but these errors were encountered:
Definitely an interesting idea in my opinion. I'd love to see proc-macro2 and syn both updated to support regular comments. This would open up some nice use cases with pretty-print as well.
Normally a lexer (rightfully) excludes non-doc comments but I have a particular usecase where having the opt-in ability to lex normal comments would be appreciated.
In a safety-critical project I'd like to write a lint pass whereby all instances of
unsafe {}
blocks are commented with a// SAFETY
comment explaining the use of the unsafe block in order to enforce this documentation. It's a convention in the codebase already but it's something I'd like to make sure is enforceable via CI.I could fork proc-macro2 to add this of course but I wanted to see if this was something upstream would be interested in having, or at least to see if there was maybe a better way of going about doing this - especially since having the feature enabled would break
syn
parsing unless it was patched to ignore comment tokens.Would the better approach just be to allow the "useless doc comment" lint and instead enforce that statements with unsafe blocks have a
#[doc]
attribute?Thanks for any info!
The text was updated successfully, but these errors were encountered: