Skip to content

rustdoc: Use source snippet to render include_* literals - #166414

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
clubby789:include-snippet
Nov 25, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
clubby789:include-snippet

Conversation

@clubby789

@clubby789 clubby789 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Related: #65818

A substantial portion of the slowness from include_bytes! on large blobs comes from escaping these blobs and encoding that rendered string into the rlib. For include macros, rendering a source snippet is much more performant and IMO clearer.

r? rustdoc (as this is only consumed by rustdoc)

@rustbot rustbot added 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. labels Nov 23, 2026
@clubby789 clubby789 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Nov 23, 2026
@clubby789

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 23, 2026
rustdoc: Use source snippet to render `include_*` literals
@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Nov 23, 2026
@rust-bors

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: d4b2558 (d4b2558f65c0afb8ae9ba390e84683b72533de39)
Base parent: 2772402 (277240238554297f93fa9ee3c7643dfa03ccbbb4)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (d4b2558): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=iffy rustc-perf
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.9% [0.9%, 0.9%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-74.0% [-76.8%, -71.2%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.4%, secondary -24.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.4% [-2.7%, -0.6%] 4
Improvements ✅
(secondary)
-24.9% [-38.4%, -0.8%] 3
All ❌✅ (primary) -1.4% [-2.7%, -0.6%] 4

Cycles

Results (primary 2.7%, secondary -12.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.4%, 2.9%] 2
Regressions ❌
(secondary)
1.0% [0.7%, 1.3%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-27.8% [-70.2%, -0.4%] 5
All ❌✅ (primary) 2.7% [2.4%, 2.9%] 2

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 462.881s -> 461.502s (-0.30%)
Artifact size: 405.81 MiB -> 405.82 MiB (0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 23, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

It's quite nice, thanks!

@bors r+ rollup=iffy

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ec40b86 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 Nov 24, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
…aumeGomez

rustdoc: Use source snippet to render `include_*` literals

Related: rust-lang#65818

A substantial portion of the slowness from `include_bytes!` on large blobs comes from escaping these blobs and encoding that rendered string into the rlib. For `include` macros, rendering a source snippet is much more performant and IMO clearer.

r? rustdoc (as this is only consumed by rustdoc)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
…aumeGomez

rustdoc: Use source snippet to render `include_*` literals

Related: rust-lang#65818

A substantial portion of the slowness from `include_bytes!` on large blobs comes from escaping these blobs and encoding that rendered string into the rlib. For `include` macros, rendering a source snippet is much more performant and IMO clearer.

r? rustdoc (as this is only consumed by rustdoc)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
…aumeGomez

rustdoc: Use source snippet to render `include_*` literals

Related: rust-lang#65818

A substantial portion of the slowness from `include_bytes!` on large blobs comes from escaping these blobs and encoding that rendered string into the rlib. For `include` macros, rendering a source snippet is much more performant and IMO clearer.

r? rustdoc (as this is only consumed by rustdoc)
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #165847 (Skip fulfillment when normalization produces no obligations)
 - #166147 (Lower to `hir::Param`s for required trait functions)
 - #166414 (rustdoc: Use source snippet to render `include_*` literals)
 - #166497 (Integrate doc comment target checking on parameters & where bounds)
 - #166500 (Fix float zero patterns after a failed guard)
 - #165791 (Sync tier 3 addition policy with Forge)
 - #166400 (Revert "stabilize {Arc,Rc}::is_unique")
 - #166417 (Correctly specify that the head cannot be >= capacity)
 - #166448 (triagebot: Send "in progress" message when nomination is in progress)
 - #166494 (rustc_target: catch up with LLVM 24 movement on ppc64 openbsd data layout)
 - #166498 (Update the Platform Support page for the *-espidf targets)
 - #166502 ([rustdoc] Fix rustc_private items being marked as unstable in the search results)
 - #166511 (Documentation: clarify Termination::report doc)
 - #166514 (coroutine: unify the word choice)
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #165847 (Skip fulfillment when normalization produces no obligations)
 - #166147 (Lower to `hir::Param`s for required trait functions)
 - #166414 (rustdoc: Use source snippet to render `include_*` literals)
 - #166497 (Integrate doc comment target checking on parameters & where bounds)
 - #166500 (Fix float zero patterns after a failed guard)
 - #165791 (Sync tier 3 addition policy with Forge)
 - #166400 (Revert "stabilize {Arc,Rc}::is_unique")
 - #166417 (Correctly specify that the head cannot be >= capacity)
 - #166448 (triagebot: Send "in progress" message when nomination is in progress)
 - #166494 (rustc_target: catch up with LLVM 24 movement on ppc64 openbsd data layout)
 - #166498 (Update the Platform Support page for the *-espidf targets)
 - #166502 ([rustdoc] Fix rustc_private items being marked as unstable in the search results)
 - #166511 (Documentation: clarify Termination::report doc)
 - #166514 (coroutine: unify the word choice)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
…aumeGomez

rustdoc: Use source snippet to render `include_*` literals

Related: rust-lang#65818

A substantial portion of the slowness from `include_bytes!` on large blobs comes from escaping these blobs and encoding that rendered string into the rlib. For `include` macros, rendering a source snippet is much more performant and IMO clearer.

r? rustdoc (as this is only consumed by rustdoc)
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #166429 (1.100.1 relnotes)
 - #165847 (Skip fulfillment when normalization produces no obligations)
 - #166147 (Lower to `hir::Param`s for required trait functions)
 - #166414 (rustdoc: Use source snippet to render `include_*` literals)
 - #166497 (Integrate doc comment target checking on parameters & where bounds)
 - #166500 (Fix float zero patterns after a failed guard)
 - #165791 (Sync tier 3 addition policy with Forge)
 - #166400 (Revert "stabilize {Arc,Rc}::is_unique")
 - #166417 (Correctly specify that the head cannot be >= capacity)
 - #166448 (triagebot: Send "in progress" message when nomination is in progress)
 - #166494 (rustc_target: catch up with LLVM 24 movement on ppc64 openbsd data layout)
 - #166498 (Update the Platform Support page for the *-espidf targets)
 - #166502 ([rustdoc] Fix rustc_private items being marked as unstable in the search results)
 - #166511 (Documentation: clarify Termination::report doc)
 - #166514 (coroutine: unify the word choice)
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #166429 (1.100.1 relnotes)
 - #165847 (Skip fulfillment when normalization produces no obligations)
 - #166147 (Lower to `hir::Param`s for required trait functions)
 - #166414 (rustdoc: Use source snippet to render `include_*` literals)
 - #166497 (Integrate doc comment target checking on parameters & where bounds)
 - #166500 (Fix float zero patterns after a failed guard)
 - #165791 (Sync tier 3 addition policy with Forge)
 - #166400 (Revert "stabilize {Arc,Rc}::is_unique")
 - #166417 (Correctly specify that the head cannot be >= capacity)
 - #166448 (triagebot: Send "in progress" message when nomination is in progress)
 - #166494 (rustc_target: catch up with LLVM 24 movement on ppc64 openbsd data layout)
 - #166498 (Update the Platform Support page for the *-espidf targets)
 - #166502 ([rustdoc] Fix rustc_private items being marked as unstable in the search results)
 - #166511 (Documentation: clarify Termination::report doc)
 - #166514 (coroutine: unify the word choice)
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
Rollup of 15 pull requests

Successful merges:

 - #165847 (Skip fulfillment when normalization produces no obligations)
 - #166147 (Lower to `hir::Param`s for required trait functions)
 - #166414 (rustdoc: Use source snippet to render `include_*` literals)
 - #166497 (Integrate doc comment target checking on parameters & where bounds)
 - #166500 (Fix float zero patterns after a failed guard)
 - #165791 (Sync tier 3 addition policy with Forge)
 - #166417 (Correctly specify that the head cannot be >= capacity)
 - #166429 (1.100.1 relnotes)
 - #166448 (triagebot: Send "in progress" message when nomination is in progress)
 - #166494 (rustc_target: catch up with LLVM 24 movement on ppc64 openbsd data layout)
 - #166498 (Update the Platform Support page for the *-espidf targets)
 - #166502 ([rustdoc] Fix rustc_private items being marked as unstable in the search results)
 - #166511 (Documentation: clarify Termination::report doc)
 - #166514 (coroutine: unify the word choice)
 - #166521 (Not-so-pointless change to hashbrown subtree)
@rust-bors
rust-bors Bot merged commit f33604d into rust-lang:main Nov 25, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 25, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 25, 2026
Rollup merge of #166414 - clubby789:include-snippet, r=GuillaumeGomez

rustdoc: Use source snippet to render `include_*` literals

Related: #65818

A substantial portion of the slowness from `include_bytes!` on large blobs comes from escaping these blobs and encoding that rendered string into the rlib. For `include` macros, rendering a source snippet is much more performant and IMO clearer.

r? rustdoc (as this is only consumed by rustdoc)
clarfonthey pushed a commit to clarfonthey/hashbrown that referenced this pull request Nov 25, 2026
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#165847 (Skip fulfillment when normalization produces no obligations)
 - rust-lang/rust#166147 (Lower to `hir::Param`s for required trait functions)
 - rust-lang/rust#166414 (rustdoc: Use source snippet to render `include_*` literals)
 - rust-lang/rust#166497 (Integrate doc comment target checking on parameters & where bounds)
 - rust-lang/rust#166500 (Fix float zero patterns after a failed guard)
 - rust-lang/rust#165791 (Sync tier 3 addition policy with Forge)
 - rust-lang/rust#166417 (Correctly specify that the head cannot be >= capacity)
 - rust-lang/rust#166429 (1.100.1 relnotes)
 - rust-lang/rust#166448 (triagebot: Send "in progress" message when nomination is in progress)
 - rust-lang/rust#166494 (rustc_target: catch up with LLVM 24 movement on ppc64 openbsd data layout)
 - rust-lang/rust#166498 (Update the Platform Support page for the *-espidf targets)
 - rust-lang/rust#166502 ([rustdoc] Fix rustc_private items being marked as unstable in the search results)
 - rust-lang/rust#166511 (Documentation: clarify Termination::report doc)
 - rust-lang/rust#166514 (coroutine: unify the word choice)
 - rust-lang/rust#166521 (Not-so-pointless change to hashbrown subtree)
@rust-timer

Copy link
Copy Markdown

Note

This PR was benchmarked as part of triage of its containing rollup: triage URL.

Finished benchmarking commit (8c8d1c4): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were not yet notified of this PR).

@rustbot label: +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.6%, 0.6%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-73.8% [-76.6%, -71.0%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -37.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-37.2% [-38.7%, -35.7%] 2
All ❌✅ (primary) - - 0

Cycles

Results (secondary -44.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.5% [1.5%, 1.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-66.7% [-68.9%, -64.5%] 2
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Artifact size: 405.64 MiB -> 405.63 MiB (-0.00%)

@Zalathar

Copy link
Copy Markdown
Member

flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Nov 26, 2026
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#165847 (Skip fulfillment when normalization produces no obligations)
 - rust-lang/rust#166147 (Lower to `hir::Param`s for required trait functions)
 - rust-lang/rust#166414 (rustdoc: Use source snippet to render `include_*` literals)
 - rust-lang/rust#166497 (Integrate doc comment target checking on parameters & where bounds)
 - rust-lang/rust#166500 (Fix float zero patterns after a failed guard)
 - rust-lang/rust#165791 (Sync tier 3 addition policy with Forge)
 - rust-lang/rust#166417 (Correctly specify that the head cannot be >= capacity)
 - rust-lang/rust#166429 (1.100.1 relnotes)
 - rust-lang/rust#166448 (triagebot: Send "in progress" message when nomination is in progress)
 - rust-lang/rust#166494 (rustc_target: catch up with LLVM 24 movement on ppc64 openbsd data layout)
 - rust-lang/rust#166498 (Update the Platform Support page for the *-espidf targets)
 - rust-lang/rust#166502 ([rustdoc] Fix rustc_private items being marked as unstable in the search results)
 - rust-lang/rust#166511 (Documentation: clarify Termination::report doc)
 - rust-lang/rust#166514 (coroutine: unify the word choice)
 - rust-lang/rust#166521 (Not-so-pointless change to hashbrown subtree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-clippy Relevant to the Clippy team. 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.

7 participants