-
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
Correctly handle comments in attributes in doctests source code #134260
Conversation
This comment has been minimized.
This comment has been minimized.
700aac4
to
f16ac84
Compare
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
And to replace stdout for time too... |
This comment has been minimized.
This comment has been minimized.
Does this also fix that //! ```rust
//! #![
//! ```
is incorrectly treated as a sucessful test? |
a0b4038
to
2383985
Compare
Now it does. :) |
Ready for review. |
src/librustdoc/doctest/make.rs
Outdated
} else if mod_attr_pending.ends_with('\\') { | ||
mod_attr_pending.push('n'); |
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.
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.
} else if mod_attr_pending.ends_with('\\') { | |
mod_attr_pending.push('n'); |
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.
Adding a test just in case.
Removed the backline handling and also added a regression test for it. |
@bors r+ rollup |
…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`
…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``
…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```
…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
…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
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``
Nominating it for beta backporting. |
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