Skip to content

Fix invalid add of duplicated call locations for the rustdoc scraped examples feature#154017

Open
GuillaumeGomez wants to merge 2 commits intorust-lang:mainfrom
GuillaumeGomez:duplicated-locs-scraped
Open

Fix invalid add of duplicated call locations for the rustdoc scraped examples feature#154017
GuillaumeGomez wants to merge 2 commits intorust-lang:mainfrom
GuillaumeGomez:duplicated-locs-scraped

Conversation

@GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Mar 17, 2026

Fixes #153837.

The bug was visible in the highlighting of the scrape examples code samples: the same part of the code was marked as "highlight" (by the scraped examples feature) twice, eventually leading to a wrong state of the HTML DOM status.

To fix the bug, I added a set to not re-add a location if it's already present.

r? @Urgau

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 17, 2026
@rustbot

This comment has been minimized.

@@ -0,0 +1,16 @@
//! This test ensures that the call locations are not duplicated when generating scraped examples.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is sadly lacking: the only way to ensure it works is to check it didn't fail to generate docs with the feature... Would be better to look at the generated target/debug/deps/*.example file but that would involve to reparse it, including compiler crates, etc. And unless I missed something obvious, there is sadly no easy way to achieve that...

@GuillaumeGomez GuillaumeGomez force-pushed the duplicated-locs-scraped branch from c7e38a3 to 071fe64 Compare March 17, 2026 21:58
@rustbot

This comment has been minimized.

Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core logic change seems fine, thus I wondering if we can avoid using Cargo.

View changes since this review

@GuillaumeGomez GuillaumeGomez force-pushed the duplicated-locs-scraped branch from 071fe64 to c399464 Compare March 18, 2026 19:25
@rustbot

This comment was marked as resolved.

@GuillaumeGomez
Copy link
Member Author

Added the htmldocck checks.

Copy link
Member

@Urgau Urgau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. r=me when CI is green

View changes since this review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: exit_elem called on empty class stack parent

3 participants