Skip to content

Fix mis-constructed file_span when generating scraped examples#152664

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
Embers-of-the-Fire:fix-152601
Feb 17, 2026
Merged

Fix mis-constructed file_span when generating scraped examples#152664
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
Embers-of-the-Fire:fix-152601

Conversation

@Embers-of-the-Fire
Copy link
Contributor

@Embers-of-the-Fire Embers-of-the-Fire commented Feb 15, 2026

Fixes #152601. Seemingly relative with #147399 but I could not reproduce the original ICE.

This PR removes the file_span logic from scraped example generation. The original implementation did not read or write items using file_span; it only used it to locate a source file, context.href_from_span. However, the span was validated against the wrong file, which could trigger ICEs on inputs such as multibyte characters due to an incorrectly constructed span. Since scraped examples do not use the span and the url is already given, the safest and simplest fix is to remove it.

Tested against the crate and MCVE documented in the original issue.

P.S. there seems to be some bug when rendering call sites, but since fixing mis-behavior is a change rather than a bug-fix that would be implemented in another PR.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Feb 15, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2026

r? @camelid

rustbot has assigned @camelid.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 9 candidates
  • Random selection from GuillaumeGomez, camelid, fmease, lolbinarycat, notriddle

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez
Copy link
Member

Thanks!

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 16, 2026

📌 Commit d13828b has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 16, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 16, 2026
…uillaumeGomez

Fix mis-constructed `file_span` when generating scraped examples

Fixes rust-lang#152601. Seemingly relative with rust-lang#147399 but I could not reproduce the original ICE.

This PR removes the `file_span` logic from scraped example generation. The original implementation did not read or write items using `file_span`; it only used it to locate a source file, `context.href_from_span`. However, the span was validated against the wrong file, which could trigger ICEs on inputs such as multibyte characters due to an incorrectly constructed span. Since scraped examples do not use the span and the `url` is already given, the safest and simplest fix is to remove it.

Tested against the crate and MCVE documented in the original issue.

P.S. there seems to be some bug when rendering call sites, but since fixing mis-behavior is a change rather than a bug-fix that would be implemented in another PR.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 16, 2026
…uillaumeGomez

Fix mis-constructed `file_span` when generating scraped examples

Fixes rust-lang#152601. Seemingly relative with rust-lang#147399 but I could not reproduce the original ICE.

This PR removes the `file_span` logic from scraped example generation. The original implementation did not read or write items using `file_span`; it only used it to locate a source file, `context.href_from_span`. However, the span was validated against the wrong file, which could trigger ICEs on inputs such as multibyte characters due to an incorrectly constructed span. Since scraped examples do not use the span and the `url` is already given, the safest and simplest fix is to remove it.

Tested against the crate and MCVE documented in the original issue.

P.S. there seems to be some bug when rendering call sites, but since fixing mis-behavior is a change rather than a bug-fix that would be implemented in another PR.
rust-bors bot pushed a commit that referenced this pull request Feb 16, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #152700 (miri subtree update)
 - #152715 (`rust-analyzer` subtree update)
 - #152609 (Install LLVM DLL in the right place on Windows)
 - #152206 (misc doc improvements)
 - #152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - #152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
rust-bors bot pushed a commit that referenced this pull request Feb 16, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #152700 (miri subtree update)
 - #152715 (`rust-analyzer` subtree update)
 - #152609 (Install LLVM DLL in the right place on Windows)
 - #152206 (misc doc improvements)
 - #152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - #152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
rust-bors bot pushed a commit that referenced this pull request Feb 17, 2026
Rollup of 11 pull requests

Successful merges:

 - #152700 (miri subtree update)
 - #152715 (`rust-analyzer` subtree update)
 - #151783 (Implement RFC 3678: Final trait methods)
 - #152512 (core: Implement feature `float_exact_integer_constants`)
 - #152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver)
 - #152703 (Remove `rustc_query_system`)
 - #152206 (misc doc improvements)
 - #152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - #152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
 - #152727 (`probe_op` silence ambiguity errors if tainted)
 - #152728 (Port #![default_lib_allocator] to the new attribute parser)
@rust-bors rust-bors bot merged commit 7ab22cd into rust-lang:main Feb 17, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 17, 2026
rust-timer added a commit that referenced this pull request Feb 17, 2026
Rollup merge of #152664 - Embers-of-the-Fire:fix-152601, r=GuillaumeGomez

Fix mis-constructed `file_span` when generating scraped examples

Fixes #152601. Seemingly relative with #147399 but I could not reproduce the original ICE.

This PR removes the `file_span` logic from scraped example generation. The original implementation did not read or write items using `file_span`; it only used it to locate a source file, `context.href_from_span`. However, the span was validated against the wrong file, which could trigger ICEs on inputs such as multibyte characters due to an incorrectly constructed span. Since scraped examples do not use the span and the `url` is already given, the safest and simplest fix is to remove it.

Tested against the crate and MCVE documented in the original issue.

P.S. there seems to be some bug when rendering call sites, but since fixing mis-behavior is a change rather than a bug-fix that would be implemented in another PR.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 18, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#152700 (miri subtree update)
 - rust-lang/rust#152715 (`rust-analyzer` subtree update)
 - rust-lang/rust#151783 (Implement RFC 3678: Final trait methods)
 - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
 - rust-lang/rust#152661 (Avoid ICE in From/TryFrom diagnostic under -Znext-solver)
 - rust-lang/rust#152703 (Remove `rustc_query_system`)
 - rust-lang/rust#152206 (misc doc improvements)
 - rust-lang/rust#152664 (Fix mis-constructed `file_span` when generating scraped examples)
 - rust-lang/rust#152698 (Suppress unstable-trait notes under `-Zforce-unstable-if-unmarked`)
 - rust-lang/rust#152727 (`probe_op` silence ambiguity errors if tainted)
 - rust-lang/rust#152728 (Port #![default_lib_allocator] to the new attribute parser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: cargo doc panicked

5 participants