Uh oh!
There was an error while loading. Please reload this page.
rustdoc: include external files in documentation (RFC 1990) - #44781
Conversation
rust-highfive
commented
Sep 23, 2017
(rust_highfive has picked a reviewer for you, use r? to override) |
QuietMisdreavus
commented
Sep 23, 2017
Travis failure is because my test for 42760 failed |
QuietMisdreavus
commented
Sep 23, 2017
update: apparently |
QuietMisdreavus
commented
Sep 23, 2017
So i wound up modifying |
6f188ec to
b25e8bdCompareQuietMisdreavus
commented
Sep 23, 2017
Travis was green, so i'm declaring this Ready To Be Looked At. I updated one test to make sure combining included docs and inline docs worked and squashed the commits. The libsyntax change is still in its own commit, though, since it was only included to make the fix for #42760 work properly, and i'm still not sure whether it's the totally right thing to do. |
There was a problem hiding this comment.
Oh so you decided to put in the "real" line number instead of the one from the original file?
There was a problem hiding this comment.
Yeah. My thought was that if you're trying to trace a line number from the total markdown blob, then you could use that to get the doc fragment, since each attribute is joined with a line break anyway.
GuillaumeGomez
commented
Sep 23, 2017
It'd be nice to have some outputs (or even tests?) for the case of failing doc codes. |
QuietMisdreavus
commented
Sep 23, 2017
That's what i was forgetting! Give me a moment, i can make a quick run. |
b25e8bd to
7e482deCompareWith the following files: Details
#![feature(external_doc)]/// hey yo check out these docs, i can splice them in from another file////// ```rust/// panic!("oh no");/// ```///#[doc(include = "some-file.md")]pubstructSomeStruct;/// Item docs.///#[doc="Hello there!"]////// # Example////// ```rust/// // some code here/// panic!("oh no");/// ```pubstructOtherStruct;#[doc(include = "bad-docs.md")]#[doc(include = "no-docs.md")]pubstructAllTheStruct;
( Running This is with the latest force push. (I neglected to ask rustdoctest to combine doc fragments, so that's fixed now.) EDIT: The current line numbering refers to the line within the final markdown, not the line in the source file. So i guess to properly translate between this line number and the source line, you need to store both the "markdown line" and the "source line". This could get hairy to properly account for multiple |
GuillaumeGomez
commented
Sep 24, 2017
And a column as well for the "real" line number (so a |
QuietMisdreavus
commented
Sep 28, 2017
@GuillaumeGomez I added a |
GuillaumeGomez
commented
Sep 28, 2017
Please post a test failure output. :) |
QuietMisdreavus
commented
Sep 28, 2017
I haven't touched the failure reporting code, so it'll look the same as in #44781 (comment). Do you want me to make that part of this PR, or would you like to merge this as-is and take it up yourself afterward? |
GuillaumeGomez
commented
Sep 29, 2017
I don't mind merging as is. Just tell me what you prefer to do. |
QuietMisdreavus
commented
Sep 29, 2017
If i remember right, we discussed fixing up the error reporting in a separate PR, so that's what i was assuming we would do here (and my preference, just so we can get this in |
ollie27
commented
Sep 29, 2017
This doesn't work cross-crate. If you re-export an item that uses |
QuietMisdreavus
commented
Oct 4, 2017
@ollie27 Oh yikes, that's a good point. On the other hand, i don't really see a good way to reliably do it cross-crate without asking rustc to load the file in. In the RFC discussion we talked about making it an alias for |
SimonSapin
commented
Oct 5, 2017
Having a special case for doc include in rustc might be easier than supporting arbitrary macros in arbitrary attributes. (Or maybe not, I don’t know.) |
bors
commented
Oct 5, 2017
☔ The latest upstream changes (presumably #45046) made this pull request unmergeable. Please resolve the merge conflicts. |
aidanhs
commented
Oct 12, 2017
@QuietMisdreavus I've set this back as with author for the merge conflicts. After that, I'm also not clear after that if you're going to do more work or it's going back to review by @GuillaumeGomez? |
QuietMisdreavus
commented
Oct 12, 2017
@aidanhs I'm actually not sure either. I'm concerned it may need to be scrapped entirely in favor of the |
GuillaumeGomez
commented
Oct 13, 2017
Won't kill to add them in the loop. :) cc @rust-lang/compiler |
alexcrichton
commented
Oct 19, 2017
triage ping for @QuietMisdreavus, do you know what the next steps here are? |
There was a problem hiding this comment.
Shouldn't debug! be used instead? (Don't really know the good macro we're supposed to use in such cases...)
There was a problem hiding this comment.
Probably? I'm not that solid on what counts as what either, but i'll go ahead and switch it over.
Uh oh!
There was an error while loading. Please reload this page.
GuillaumeGomez
commented
Nov 21, 2017
All good for me from code reading. Just a few nits and it's good to go imo. |
Partial implementation of rust-lang/rfcs#1990 (needs error reporting work) cc rust-lang#44732
abc9aca to
52ee203CompareQuietMisdreavus
commented
Nov 21, 2017
I've force-pushed to address the review comments. |
GuillaumeGomez
commented
Nov 21, 2017
Then it's all good for me. r=me once CI is green. |
QuietMisdreavus
commented
Nov 21, 2017
@bors r=GuillaumeGomez |
bors
commented
Nov 21, 2017
📌 Commit 52ee203 has been approved by |
bors
commented
Nov 22, 2017
⌛ Testing commit 52ee203 with merge 0893ecc8955191f702513ff3a19d420f9650fae5... |
bors
commented
Nov 22, 2017
💔 Test failed - status-travis |
Failure... doesn't look legit? I'm not caught up on the known spurious failures. |
kennytm
commented
Nov 22, 2017
bors
commented
Nov 22, 2017
rustdoc: include external files in documentation (RFC 1990) Part of rust-lang/rfcs#1990 (needs work on the error reporting, which i'm deferring to after this initial PR) cc #44732 Also fixes#42760, because the prep work for the error reporting made it easy to fix that at the same time.
bors
commented
Nov 22, 2017
☀️ Test successful - status-appveyor, status-travis |

Part of rust-lang/rfcs#1990 (needs work on the error reporting, which i'm deferring to after this initial PR)
cc #44732
Also fixes#42760, because the prep work for the error reporting made it easy to fix that at the same time.