-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
fn main
in a comment in rustdoc breaks tests
#21299
Comments
A more painful example is
Which of course gives the same error. |
Looks like it's just doing a .contains on the string looking for fn main. I'll add some tests and start on this. |
Traige: still an error |
Triage: no change. |
For anyone that wants to tackle this, the offending line is right here. Changing that |
This is in the matter of rust-lang#21299.
…aks_tests, r=QuietMisdreavus don't let rustdoc get confused by text "fn main" in a line comment ~~~Resolves~~~ (edited) partially addresses #21299. ![rustdoc_fn_main](https://user-images.githubusercontent.com/1076988/30630993-9aeecc4a-9d97-11e7-8e56-2b973f23f683.png) r? @QuietMisdreavus
Current status: Thanks to #44713 the exact example in the OP now doesn't break! But we'd like to make a "more complete" fix, likely by using libsyntax to properly parse tests and looking for a parsed function called "main" that way. It's probably not that cumbersome to set up if you can get a Parser rolling, but... i haven't worked with it myself, so i can't mentor that without tinkering on it myself. |
I'd like to take a stab at a proper fix for this, if that's okay! |
@rep-nop Feel free! If you have any questions, don't be afraid to post them here or find us on IRC or Discord (there are |
Per http://doc.rust-lang.org/rustdoc.html, "Given a code block, if it does not contain fn main, it is wrapped in fn main() { your_code }"
Can it not be "does not contain 'fn main (' outside of a comment"?
The text was updated successfully, but these errors were encountered: