rustdoc: correct doctest span for trailing semicolon after item#157740
Merged
rust-bors[bot] merged 2 commits intoJun 13, 2026
Conversation
This comment has been minimized.
This comment has been minimized.
5b22838 to
de7573b
Compare
This comment has been minimized.
This comment has been minimized.
de7573b to
a9cf06b
Compare
Collaborator
|
rustbot has assigned @lolbinarycat. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
|
Please add the case from the issue as a new test, as currently there are no testcase covering the previous worst case (diagnostic span pointing completely outside the doctest) does not appear to have a regression test. |
Contributor
|
Thanks! @bors r+ rollup |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jun 13, 2026
…span, r=lolbinarycat rustdoc: correct doctest span for trailing semicolon after item Fixes rust-lang#157371. When a doctest contains a trailing semicolon after an item, rustdoc can map the resulting warning to unrelated source following the documentation block rather than to the semicolon inside the doctest. Changes only diagnostic span reporting.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 13, 2026
Rollup of 7 pull requests Successful merges: - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Jun 13, 2026
…span, r=lolbinarycat rustdoc: correct doctest span for trailing semicolon after item Fixes rust-lang#157371. When a doctest contains a trailing semicolon after an item, rustdoc can map the resulting warning to unrelated source following the documentation block rather than to the semicolon inside the doctest. Changes only diagnostic span reporting.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 13, 2026
Rollup of 9 pull requests Successful merges: - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157514 ([tiny] Use multipart suggestion for finding ident when literal was expected in attr) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 13, 2026
Rollup of 10 pull requests Successful merges: - #157714 (Improve polymorphization of raw pointer formatting) - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157594 (note which target a missing target_feature belongs to) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jun 13, 2026
Rollup of 10 pull requests Successful merges: - #157714 (Improve polymorphization of raw pointer formatting) - #157653 (remove AliasTerm::def_id()) - #157773 (Remove AnonConstKind::GCA and reject generic anon consts) - #157846 (Avoid ICE in unconstrained generic parameter suggestion for enums) - #157594 (note which target a missing target_feature belongs to) - #157740 (rustdoc: correct doctest span for trailing semicolon after item) - #157782 (Added `PhantomPinned` diagnostic item and prevented dead field warning on `PhantomPinned`) - #157802 (Ensure that optimize attributes on closures are inherited by the shim.) - #157812 (rustc_public: implement `ty::Alias` conversion) - #157833 (Update wasm-component-ld to 0.5.25)
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 #157371.
When a doctest contains a trailing semicolon after an item, rustdoc can map the
resulting warning to unrelated source following the documentation block rather
than to the semicolon inside the doctest.
Changes only diagnostic span reporting.