-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Rustdoc: JSON backend experimental impl, with new tests. #79539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also sure how many of these we need to do before landing on nightly, as it would be nice to get this in tree, so it isn't effected by churn like #79125, #79041, #79061
Most of it can wait until later I think (although it should be done before stabilization). The things I'd consider blockers are:
Fixing the test suite, which currently does nothing. This should be as simple as reverting a66a97a.I see you already did, thank you! ❤️- Anything changing rustdoc's normal behavior, such as https://github.com/rust-lang/rust/pull/75114/files/a66a97ac588f26350cab886904ddbe70ce17d339#r519470764. It doesn't necessarily have to be reverted, but if not there should be an explanation for why it changed. I understand you're not the one who changed it and it makes things more difficult - maybe revert it, run the tests, and see what breaks?
- Stripped items should not be included by default: JSON backend experimental impl #75114 (comment). This is totally against the stability guarantees of rust - the behavior around
--document-private-items
is a little unclear and we can have that discussion before stabilization, but including private items by default seems very wrong to me.
Other than that, I think this has been in limbo long enough and should get merged ASAP.
cc @tmandry, all is not lost 😆
src/test/rustdoc-json/compare.py
Outdated
if expected_type == str and actual.startswith(base_dir): | ||
if actual.replace(base_dir + "/", "") != expected: | ||
raise SubsetException( | ||
"expected `{}`, got: `{}`".format( | ||
expected, actual.replace(base_dir + "/", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack to get around the real output being "filename": "/home/nixon/upstreams/rust/rust/src/test/rustdoc-json/structs.rs"
, but the test is "filename": "structs.rs",
.
Long term, it's probably usefull to do something like $TEST_BUILD_DIR
, like the ui tests have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, can you leave those examples as a comment in the source? Feel free to change the absolute path to something else as long as it's still clear it's absolute and not relative.
Reverting it seems fine, so I've done that.
Done |
@rustbot modify labels: -S-waiting-on-author +S-waiting-on-review What do you want done with the git history |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you want done with the git history
It's such a mess by now I don't know if it's worth messing with more 😅 up to you if you want to squash or not.
This looks way better than before :) thanks so much for taking this on! I'm really excited to see what people will build with this.
6fcde34
to
97011eb
Compare
r=me unless @GuillaumeGomez or @tmandry want to take a look - I have more things I'd like to change, but I'd much rather get this on nightly so it's not stuck in limbo. |
Looks good to me as well, thanks a lot! @bors: r=jyn514,GuillaumeGomez |
📌 Commit 97011eb has been approved by |
…illaumeGomez Rustdoc: JSON backend experimental impl, with new tests. Based on rust-lang#75114 by `@P1n3appl3` The first commit is all of rust-lang#75114, but squased to 1 commit, as that was much easier to rebase onto master. The git history is a mess, but I think I'll edit it after review, so it's obvious whats new. ## Still to do - [ ] Update docs. - [ ] Add bless option to tests. - [ ] Add test option for multiple files in same crate. - [ ] Decide if the tests should check for json to be equal or subset. - [ ] Go through the rest of the review for the original pr. (This is open because the test system is done(ish), but stuff like [not using a hashmap](rust-lang#75114 (comment)) and [using `CRATE_DEF_INDEX` ](rust-lang#75114 (comment)) hasn't) I'm also sure how many of these we need to do before landing on nightly, as it would be nice to get this in tree, so it isn't effected by churn like rust-lang#79125, rust-lang#79041, rust-lang#79061 r? `@jyn514`
Respond to comments and start adding tests Fix re-exports and extern-crate Add expected output tests Add restricted paths Format Fix: associated methods missing in output Ignore stripped items Mark stripped items removing them creates dangling references Fix tests and update conversions Don't panic if JSON backend fails to create a file Fix attribute error in JSON testsuite Move rustdoc-json to rustdoc/ This way it doesn't have to build rustc twice. Eventually it should probably get its own suite, like rustdoc-js, but that can be fixed in a follow-up. Small cleanups Don't prettify json before printing This fully halves the size of the emitted JSON. Add comments [BREAKING CHANGE] rename version -> crate_version [BREAKING CHANGE] rename source -> span Use exhaustive matches Don't qualify imports for DefId Rename clean::{ItemEnum -> ItemKind}, clean::Item::{inner -> kind} Fix Visibility conversion clean::Visability was changed here: https://github.com/rust-lang/rust/pull/77820/files#diff-df9f90aae0b7769e1eb6ea6f1d73c1c3f649e1ac48a20e169662a8930eb427beL1467-R1509 More churn catchup Format
Move rustdoc/rustdoc-json to rustdoc-json Scaffold rustdoc-json test mode Implement run_rustdoc_json_test Fix up python Make tidy happy
Go back to CRATE_DEF_INDEX Minor niceness improvements Don't output hidden items Remove striped items from fields Add $TEST_BASE_DIR Small catch
@bors r=jyn514,GuillaumeGomez |
📌 Commit 6018200 has been approved by |
⌛ Testing commit 6018200 with merge 86c4e2f69b2692667f369170cb8a34a740ef16c9... |
💔 Test failed - checks-actions |
Windows path separator problem.
|
ae5e485
to
824d5ce
Compare
@bors r+ rollup=iffy |
📌 Commit 824d5ce57320cc4c1a5d0a343e44650211e7cd12 has been approved by |
824d5ce
to
d619271
Compare
@bors r+ rollup=iffy |
📌 Commit d619271 has been approved by |
☀️ Test successful - checks-actions |
@rustbot modify labels +A-rustdoc-json |
Based on #75114 by @P1n3appl3
The first commit is all of #75114, but squased to 1 commit, as that was much easier to rebase onto master.
The git history is a mess, but I think I'll edit it after review, so it's obvious whats new.
Still to do
CRATE_DEF_INDEX
hasn't)I'm also sure how many of these we need to do before landing on nightly, as it would be nice to get this in tree, so it isn't effected by churn like #79125, #79041, #79061
r? @jyn514