-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Fully qualify Result
in generated doctest code
#137807
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
intel-lab-lkp
pushed a commit
to intel-lab-lkp/linux
that referenced
this pull request
Feb 28, 2025
…e doctest handling. Thanks for the detailed answer! I added the missing "Signed-of-by" in the commit message. I added some more context in the commit message, hopefully I didn't miss anything. > We currently support versions 1.78+, so we will need to do these > things conditionally. I can help with that, so don't worry too much > about it for the moment (e.g. we have `rustc-option` and other helpers > to pick the right flags given a version etc.). I'll definitely need some help here. I'm not sure current stable already has this change so until then, we'll need a beta/nightly version to run these tests. > Hmm... I was hoping we could do something on the `rustdoc` side to > remove these hacks altogether since we are going to have a "proper > flag" for it, i.e. to avoid relying on the particular "format" of the > tests somehow. I opened rust-lang/rust#137807 to resolve this problem. > > + let doctest_code = doctest_code.replace( > > + "} _inner().unwrap() }", > > + "} let test_return_value = _inner(); assert!(test_return_value.is_ok()); }", > > ); > > + std::fs::write(path, doctest_code.as_bytes()).unwrap(); > > +} > > Same for this. For this one I'll need to check first if it can be done "safely" (ie, so unexpected side effect). > > + } else { > > + panic!("missing `format_version` field"); > > + } > > `expect` maybe? I don't think `expect` would work in any of the cases in this file. What I suggest is to add methods on `JsonValue` in a future patch which would allow to reduce code in this file (and call `expect` too). > These two bits could go in a first patch, I think, though it isn't a big deal. You're absolutely right, removing them and sending a separate patch. Here is the updated patch: The goal of this patch is to remove the use of 2 unstable rustdoc features (`--no-run` and `--test-builder`) and replace it with a stable feature: `--output-format=doctest`, which was added in rust-lang/rust#134531. Before this patch, the code was using very hacky methods in order to retrieve doctests, modify them as needed and then concatenate all of them in one file. Now, with this new flag, it instead asks rustdoc to provide the doctests code with their associated information such as file path and line number. Signed-off-by: Guillaume Gomez <[email protected]>
@bors r+ rollup |
92 tasks
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Mar 1, 2025
…ult, r=notriddle Fully qualify `Result` in generated doctest code As discussed in https://lore.kernel.org/rust-for-linux/[email protected]/T/#u, it would require less code for RfL to be able to reach the same result (pun unintended). cc `@ojeda` r? `@notriddle`
This was referenced Mar 1, 2025
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 1, 2025
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#137804 (rename BackendRepr::Vector → SimdVector) - rust-lang#137807 (Fully qualify `Result` in generated doctest code) - rust-lang#137809 (Use correct error message casing for `io::const_error`s) - rust-lang#137818 (tests: adapt for LLVM 21 changes) - rust-lang#137822 (Update query normalizer docs to not position it as the greatest pioneer in the space of normalization) - rust-lang#137824 (Tweak invalid RTN errors) - rust-lang#137828 (Fix inaccurate `std::intrinsics::simd` documentation) - rust-lang#137830 (Fix link failure on AVR (incompatible ISA error)) - rust-lang#137837 (Update `const_conditions` and `explicit_implied_const_bounds` docs) - rust-lang#137840 (triagebot: only ping me for constck) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 2, 2025
…iaskrgr Rollup of 10 pull requests Successful merges: - rust-lang#137804 (rename BackendRepr::Vector → SimdVector) - rust-lang#137807 (Fully qualify `Result` in generated doctest code) - rust-lang#137809 (Use correct error message casing for `io::const_error`s) - rust-lang#137818 (tests: adapt for LLVM 21 changes) - rust-lang#137822 (Update query normalizer docs to not position it as the greatest pioneer in the space of normalization) - rust-lang#137824 (Tweak invalid RTN errors) - rust-lang#137828 (Fix inaccurate `std::intrinsics::simd` documentation) - rust-lang#137830 (Fix link failure on AVR (incompatible ISA error)) - rust-lang#137837 (Update `const_conditions` and `explicit_implied_const_bounds` docs) - rust-lang#137840 (triagebot: only ping me for constck) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 2, 2025
Rollup merge of rust-lang#137807 - GuillaumeGomez:doctest-qualify-result, r=notriddle Fully qualify `Result` in generated doctest code As discussed in https://lore.kernel.org/rust-for-linux/[email protected]/T/#u, it would require less code for RfL to be able to reach the same result (pun unintended). cc ``@ojeda`` r? ``@notriddle``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in https://lore.kernel.org/rust-for-linux/[email protected]/T/#u, it would require less code for RfL to be able to reach the same result (pun unintended).
cc @ojeda
r? @notriddle