Correctly handle comments in attributes in doctests source code by GuillaumeGomez · Pull Request #134260 · rust-lang/rust (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation14 Commits4 Checks6 Files changed
Conversation
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
[ Show hidden characters]({{ revealButtonHref }})
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
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the rustdoc team, which will review and decide on the PR/issue.
labels
This comment has been minimized.
Forgot to set only one test thread to prevent having fuzzy sorting...
This comment has been minimized.
And to replace stdout for time too...
This comment has been minimized.
Does this also fix that
//! rust //! #![ //!
is incorrectly treated as a sucessful test?
Comment on lines 540 to 541
} else if mod_attr_pending.ends_with('\\') { |
---|
mod_attr_pending.push('n'); |
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
into
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'); |
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.
📌 Commit c367cc3 has been approved by notriddle
It is now in the queue for this repository.
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request
…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
…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
…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
…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
…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
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.
bors added a commit to rust-lang-ci/rust that referenced this pull request
[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 tostd::ffi
rust-lang#134791 - docs: inline
alloc::ffi::c_str
types toalloc::ffi
rust-lang#134851
r? cuviper
Labels
Accepted for backporting to the compiler in the beta channel.
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Relevant to the rustdoc team, which will review and decide on the PR/issue.