-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[rustdoc] Give more information into extracted doctest information #141399
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
Conversation
This comment has been minimized.
This comment has been minimized.
cd34db0
to
4e95830
Compare
Fixed |
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.
Core logic looks correct (mostly just exposing existing variables), just have a few nits about naming to hopefully increase readability.
4e95830
to
9888eb4
Compare
Updated. |
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.
Looks pretty good, I've just got a few more notes about naming, most of which are extrapolations of previous suggested changes.
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 also needs changes to the docs for this feature, which are in the rustdoc book.
7447a70
to
d7877b0
Compare
This comment has been minimized.
This comment has been minimized.
d7877b0
to
38947d8
Compare
Applied suggestions! |
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 don't think we should be putting the test stdout directly into the docs, at least not unmodified
ec02beb
to
d3bf6d5
Compare
I fixed the book example. |
d3bf6d5
to
e361171
Compare
e361171
to
d3bf6d5
Compare
d3bf6d5
to
0d048d5
Compare
☔ The latest upstream changes (presumably #142181) made this pull request unmergeable. Please resolve the merge conflicts. |
0d048d5
to
b82dd91
Compare
Setting @aDotInTheVoid as reviewer since they already reviewed it and it's another JSON output. :) r? aDotInTheVoid |
Requested reviewer is already assigned to this pull request. Please choose another assignee. |
This comment has been minimized.
This comment has been minimized.
3bd04d1
to
051776c
Compare
Added explanations in the rustdoc book about the new JSON fields. |
051776c
to
c681e47
Compare
Added an inner attribute to better show the difference between |
c681e47
to
f1ceb07
Compare
It's now ready for review. :) |
@bors r+ |
…r=aDotInTheVoid [rustdoc] Give more information into extracted doctest information Follow-up of rust-lang#134531. This update fragment the doctest code into its sub-parts to give more control to the end users on how they want to use it. The new JSON looks like this: ```json { "format_version":2, "doctests":[ { "file":"$DIR/extract-doctests-result.rs", "line":8, "doctest_attributes":{ "original":"", "should_panic":false, "no_run":false, "ignore":"None", "rust":true, "test_harness":false, "compile_fail":false, "standalone_crate":false, "error_codes":[], "edition":null, "added_css_classes":[], "unknown":[] }, "original_code":"let x = 12;\nOk(())", "doctest_code":{ "crate_level":"#![allow(unused)]\n", "code":"let x = 12;\nOk(())", "wrapper":{ "before":"fn main() { fn _inner() -> core::result::Result<(), impl core::fmt::Debug> {\n", "after":"\n} _inner().unwrap() }", "returns_result":true } }, "name":"$DIR/extract-doctests-result.rs - (line 8)" } ] } ``` for this doctest: ```rust let x = 12; Ok(()) ``` With this, I think it matches what you need `@ojeda?` If so, once merged I'll update the patch I sent to RfL. r? `@aDotInTheVoid`
Rollup of 9 pull requests Successful merges: - #140593 (Temporary lifetime extension through tuple struct and tuple variant constructors) - #141399 ([rustdoc] Give more information into extracted doctest information) - #141493 (Delegate `<SocketAddr as Debug>` to `ByteStr`) - #141811 (Unimplement unsized_locals) - #142243 (float tests: deduplicate min, max, and rounding tests) - #142464 (variadic functions: remove list of supported ABIs from error) - #142477 (Fix incorrect suggestion when calling an associated type with a type anchor) - #142484 (Remove unneeded lifetime bound from signature of BTreeSet::extract_if) - #142489 (Update the `compiler-builtins` subtree) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #141399 - GuillaumeGomez:extracted-doctest, r=aDotInTheVoid [rustdoc] Give more information into extracted doctest information Follow-up of #134531. This update fragment the doctest code into its sub-parts to give more control to the end users on how they want to use it. The new JSON looks like this: ```json { "format_version":2, "doctests":[ { "file":"$DIR/extract-doctests-result.rs", "line":8, "doctest_attributes":{ "original":"", "should_panic":false, "no_run":false, "ignore":"None", "rust":true, "test_harness":false, "compile_fail":false, "standalone_crate":false, "error_codes":[], "edition":null, "added_css_classes":[], "unknown":[] }, "original_code":"let x = 12;\nOk(())", "doctest_code":{ "crate_level":"#![allow(unused)]\n", "code":"let x = 12;\nOk(())", "wrapper":{ "before":"fn main() { fn _inner() -> core::result::Result<(), impl core::fmt::Debug> {\n", "after":"\n} _inner().unwrap() }", "returns_result":true } }, "name":"$DIR/extract-doctests-result.rs - (line 8)" } ] } ``` for this doctest: ```rust let x = 12; Ok(()) ``` With this, I think it matches what you need ``@ojeda?`` If so, once merged I'll update the patch I sent to RfL. r? ``@aDotInTheVoid``
Follow-up of #134531.
This update fragment the doctest code into its sub-parts to give more control to the end users on how they want to use it.
The new JSON looks like this:
for this doctest:
With this, I think it matches what you need @ojeda? If so, once merged I'll update the patch I sent to RfL.
r? @aDotInTheVoid