-
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
Strip impl if not re-exported and is doc(hidden) #113574
Strip impl if not re-exported and is doc(hidden) #113574
Conversation
…name, r=notriddle Allow to have `-` in rustdoc-json test file name I extracted this commit from rust-lang#113574. When I added the test, it kept saying that the JSON file couldn't be found. After investigating for a while, I discovered that we were expecting files to always use `_`, which is quite bad. So I added support for `-` in file names. r? `@notriddle`
tests/rustdoc-json/reexport/issue-112852-dangling-trait-impl-id.rs
Outdated
Show resolved
Hide resolved
tests/rustdoc-json/reexport/issue-112852-dangling-trait-impl-id.rs
Outdated
Show resolved
Hide resolved
What else is needed to close #112852? Just tests? |
Yes, more tests. |
a776cf2
to
7e50c9e
Compare
Applied comments. |
IDK why GitHub highlighted it differently, but I also suggested adding
Could they be added now? This code contains logic (that AFAIKT is right) for handling reexports, but if it's wrong, I'd like to know now, and not when doing a follow-up PR to add tests. |
Sure I don't mind. I just have no idea what tests to add. If you have ideas, please don't hesitate. :) |
7e50c9e
to
1380d21
Compare
…name, r=notriddle Allow to have `-` in rustdoc-json test file name I extracted this commit from rust-lang#113574. When I added the test, it kept saying that the JSON file couldn't be found. After investigating for a while, I discovered that we were expecting files to always use `_`, which is quite bad. So I added support for `-` in file names. r? ``@notriddle``
|
1380d21
to
1fd57ff
Compare
I added two more tests. To fix the |
This comment has been minimized.
This comment has been minimized.
1fd57ff
to
5a7ddc9
Compare
This comment has been minimized.
This comment has been minimized.
5a7ddc9
to
2861a56
Compare
Fixed the CI errors. |
Considering it got completely away from JSON (because of r? @notriddle |
The |
#![no_core] | ||
|
||
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]" | ||
// @!has "$.index[*][?(@.inner.impl)]" |
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.
!has
tests are fragile when the schema changes. The ideal way to write it would be a version that has two structs, and asserts that exactly one shows up.
// @count "$.index[*][?(@.inner.impl)]" 1
// @!has "$.index[*][?(@.name == 'HiddenPubStruct')]"
// @has "$.index[*][?(@.name == 'NotHiddenPubStruct')]"
// @has "$.index[*][?(@.name=='PubTrait')]"
pub trait PubTrait {}
#[doc(hidden)]
pub mod hidden {
pub struct HiddenPubStruct;
impl crate::PubTrait for HiddenPubStruct {}
}
pub mod not_hidden {
pub struct NotHiddenPubStruct;
impl crate::PubTrait for HiddenPubStruct {}
}
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.
That's still not ideal (I really don't like @!has
) but in JSON what you suggested is already much better. Going to update.
Updated! |
@bors r=aDotInTheVoid,notriddle |
☀️ Test successful - checks-actions |
Finished benchmarking commit (ec362f0): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 659.727s -> 657.921s (-0.27%) |
…ms-test, r=notriddle Add tests for `--document-hidden-items` option Since `--document-hidden-items` was greatly fixed/improved in rust-lang#113574, thought it might be worth adding some more tests for it to prevent new regressions. As for the first commit, it allows to go from: ``` Traceback (most recent call last): File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 706, in <module> check(sys.argv[1], get_commands(rust_test_path)) File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 689, in check for c in commands: File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 274, in get_commands args = shlex.split(args) File "/usr/lib/python3.10/shlex.py", line 315, in split return list(lex) File "/usr/lib/python3.10/shlex.py", line 300, in __next__ token = self.get_token() File "/usr/lib/python3.10/shlex.py", line 109, in get_token raw = self.read_token() File "/usr/lib/python3.10/shlex.py", line 191, in read_token raise ValueError("No closing quotation") ValueError: No closing quotation ``` to: ``` Traceback (most recent call last): File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 708, in <module> check(sys.argv[1], get_commands(rust_test_path)) File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 691, in check for c in commands: File "/home/imperio/rust/rust/src/etc/htmldocck.py", line 278, in get_commands raise Exception("line {}: {}".format(lineno + 1, exc)) from None Exception: line 57: No closing quotation ``` Having the line where the error occurred is quite useful. r? `@notriddle`
Part of #112852.
r? @aDotInTheVoid