rust/tests
Guillaume Gomez a8cc24a1ab
Rollup merge of #125779 - GuillaumeGomez:copy-code, r=rustdoc-team
[rustdoc] Add copy code feature

This PR adds a "copy code" to code blocks. Since this is a JS only feature, the HTML is generated with JS when the user hovers the code block to prevent generating DOM unless needed.

Two things to note:
 1. I voluntarily kept the current behaviour of the run button (only when hovering a code block with a mouse) so it doesn't do anything on mobile. I plan to send a follow-up where the buttons would "expandable" or something. Still need to think which approach would be the best.
 2. I used a picture and not text like the run button to remain consistent with the "copy path" button. I'd also prefer for the run button to use a picture (like what is used in mdbook) but again, that's something to be discussed later on.

The rendering looks like this:

![Screenshot from 2024-06-03 21-29-48](https://github.com/rust-lang/rust/assets/3050060/a0b18f9c-b3dd-4a65-89a7-5a7a303b5c2b)
![Screenshot from 2024-06-03 21-30-20](https://github.com/rust-lang/rust/assets/3050060/b3b084ff-2716-4160-820b-d4774681a961)

It can be tested [here](https://guillaume-gomez.fr/rustdoc/bar/struct.Bar.html) (without the run button) and [here](https://guillaume-gomez.fr/rustdoc/foo/struct.Bar.html) (with the run button).

Fixes #86851.

r? ``@notriddle``
2024-07-28 20:07:44 +02:00
..
assembly Auto merge of #128165 - saethlin:optimize-clone-shims, r=compiler-errors 2024-07-26 13:13:04 +00:00
auxiliary
codegen Rollup merge of #128262 - DianQK:remove-unused-tests, r=saethlin 2024-07-27 13:32:58 -04:00
codegen-units Avoid MIR bloat in inlining 2024-07-01 05:17:13 -07:00
coverage Bless coverage. 2024-07-13 12:02:12 +00:00
coverage-run-rustdoc coverage: Extract hole spans from HIR instead of MIR 2024-07-08 21:22:56 +10:00
crashes Rollup merge of #128173 - compiler-errors:misused-intrinsics, r=oli-obk 2024-07-25 16:48:22 +02:00
debuginfo Add Natvis visualiser and debuginfo tests for f16 2024-07-09 03:47:50 +01:00
incremental Auto merge of #126409 - pacak:incr-uplorry, r=michaelwoerister 2024-06-20 09:06:16 +00:00
mir-opt Rollup merge of #128271 - Nilstrieb:jump-into-a-can-of-worms-called-float-equality, r=compiler-errors 2024-07-27 13:33:00 -04:00
pretty Mark format! with must_use hint 2024-07-06 14:24:20 +02:00
run-make Auto merge of #128079 - Oneirical:testiges-of-civilization, r=jieyouxu 2024-07-28 04:16:12 +00:00
run-pass-valgrind
rustdoc Auto merge of #120812 - compiler-errors:impl-sorting, r=lcnr 2024-07-21 22:43:47 +00:00
rustdoc-gui Rollup merge of #125779 - GuillaumeGomez:copy-code, r=rustdoc-team 2024-07-28 20:07:44 +02:00
rustdoc-js
rustdoc-js-std
rustdoc-json Update all rustdoc-json/ tests to use the new style 2024-07-19 16:54:42 +02:00
rustdoc-ui Rollup merge of #128111 - estebank:no-question, r=fmease 2024-07-25 04:43:20 +02:00
ui Rollup merge of #125889 - Nilstrieb:migrate-into-the-future, r=compiler-errors 2024-07-28 13:42:18 +02:00
ui-fulldeps Auto merge of #126963 - runtimeverification:smir_serde_derive, r=celinval 2024-07-25 20:27:51 +00:00
COMPILER_TESTS.md