Correctly handle comments in attributes in doctests source code#134260
Merged
bors merged 4 commits intorust-lang:masterfrom Dec 16, 2024
Merged
Correctly handle comments in attributes in doctests source code#134260bors merged 4 commits intorust-lang:masterfrom
bors merged 4 commits intorust-lang:masterfrom
Conversation
This comment has been minimized.
This comment has been minimized.
700aac4 to
f16ac84
Compare
Member
Author
|
Forgot to set only one test thread to prevent having fuzzy sorting... |
This comment has been minimized.
This comment has been minimized.
f16ac84 to
a0b4038
Compare
Member
Author
|
And to replace stdout for time too... |
This comment has been minimized.
This comment has been minimized.
Contributor
|
Does this also fix that //! ```rust
//! #![
//! ```
is incorrectly treated as a sucessful test? |
a0b4038 to
2383985
Compare
Member
Author
|
Now it does. :) |
Member
Author
|
Ready for review. |
notriddle
reviewed
Dec 16, 2024
src/librustdoc/doctest/make.rs
Outdated
Comment on lines
540
to
541
| } else if mod_attr_pending.ends_with('\\') { | ||
| mod_attr_pending.push('n'); |
Contributor
There was a problem hiding this comment.
If I understand this correctly, these lines aren't really needed any more. They would have turned
#[doc="first\
second"]into
#[doc="first\nsecond"]
But that only works with double-quoted strings, not raw strings, and is unnecessary now that newlines are preserved here.
Suggested change
| } else if mod_attr_pending.ends_with('\\') { | |
| mod_attr_pending.push('n'); |
Member
Author
There was a problem hiding this comment.
Adding a test just in case.
Member
Author
|
Removed the backline handling and also added a regression test for it. |
Contributor
|
@bors r+ rollup |
Collaborator
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Dec 16, 2024
…triddle Correctly handle comments in attributes in doctests source code Fixes rust-lang#134221. The problem was that attributes are "inlined" (backlines are stripped), then when there is an inline comment inside it, the attribute is never considered valid (since unclosed). Fix was to simply put back backlines in case it's a multiline attribute. r? `@notriddle`
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Dec 16, 2024
…triddle Correctly handle comments in attributes in doctests source code Fixes rust-lang#134221. The problem was that attributes are "inlined" (backlines are stripped), then when there is an inline comment inside it, the attribute is never considered valid (since unclosed). Fix was to simply put back backlines in case it's a multiline attribute. r? ``@notriddle``
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Dec 16, 2024
…triddle Correctly handle comments in attributes in doctests source code Fixes rust-lang#134221. The problem was that attributes are "inlined" (backlines are stripped), then when there is an inline comment inside it, the attribute is never considered valid (since unclosed). Fix was to simply put back backlines in case it's a multiline attribute. r? ```@notriddle```
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 16, 2024
…llaumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#132056 (Stabilize `#[diagnostic::do_not_recommend]`) - rust-lang#134124 (CI: use free runners for x86_64-gnu-llvm jobs) - rust-lang#134197 (rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed') - rust-lang#134260 (Correctly handle comments in attributes in doctests source code) - rust-lang#134277 (rustdoc-search: handle `impl Into<X>` better) - rust-lang#134284 (Keep track of patterns that could have introduced a binding, but didn't) - rust-lang#134337 (reject unsound toggling of RISCV target features) - rust-lang#134385 (tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore) - rust-lang#134386 (Some trait method vs impl method signature difference diagnostic cleanups) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 16, 2024
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#134124 (CI: use free runners for x86_64-gnu-llvm jobs) - rust-lang#134197 (rustc_mir_build: Clarify that 'mirrored' does not mean 'flipped' or 'reversed') - rust-lang#134260 (Correctly handle comments in attributes in doctests source code) - rust-lang#134277 (rustdoc-search: handle `impl Into<X>` better) - rust-lang#134284 (Keep track of patterns that could have introduced a binding, but didn't) - rust-lang#134337 (reject unsound toggling of RISCV target features) - rust-lang#134371 (Check for array lengths that aren't actually `usize`) - rust-lang#134385 (tests/ui/asm: Remove uses of rustc_attrs, lang_items, and decl_macro features by using minicore) - rust-lang#134386 (Some trait method vs impl method signature difference diagnostic cleanups) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 16, 2024
Rollup merge of rust-lang#134260 - GuillaumeGomez:doctest-attrs, r=notriddle Correctly handle comments in attributes in doctests source code Fixes rust-lang#134221. The problem was that attributes are "inlined" (backlines are stripped), then when there is an inline comment inside it, the attribute is never considered valid (since unclosed). Fix was to simply put back backlines in case it's a multiline attribute. r? ``@notriddle``
Member
Author
|
Nominating it for beta backporting. |
Merged
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 3, 2025
[beta] backports - Do not call `extern_crate` on current trait on crate mismatch errors rust-lang#133585 - Correctly handle comments in attributes in doctests source code rust-lang#134260 - Correctly document CTFE behavior of is_null and methods that call is_null. rust-lang#134325 - Make sure we handle `backwards_incompatible_lint` drops appropriately in drop elaboration rust-lang#134486 - Bump compiler `cc` to 1.2.5 rust-lang#134505 - Handle `DropKind::ForLint` in coroutines correctly rust-lang#134575 - docs: inline `std::ffi::c_str` types to `std::ffi` rust-lang#134791 - docs: inline `alloc::ffi::c_str` types to `alloc::ffi` rust-lang#134851 r? cuviper
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #134221.
The problem was that attributes are "inlined" (backlines are stripped), then when there is an inline comment inside it, the attribute is never considered valid (since unclosed). Fix was to simply put back backlines in case it's a multiline attribute.
r? @notriddle