rust/tests
Guillaume Gomez 15cde9c505
Rollup merge of #146091 - janis-bhm:rustdoc-default-span-with-simple-test, r=GuillaumeGomez
fix rustdoc `render_call_locations`  panicking because of default span `DUMMY_SP` pointing at non local-source file

fixes https://github.com/rust-lang/rust/issues/144752
related to/builds on https://github.com/rust-lang/rust/pull/145008

bevy still crashes in the same way as rust-lang/rust#144752 when building docs on nightly, and from what I can tell the cause seems to be the following (copied from zulip [#t-rustdoc > docs on nightly with example scrapes crash](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/docs.20on.20nightly.20with.20example.20scrapes.20crash)):

> render_call_locations tries to [find](84a1747022/src/librustdoc/html/render/mod.rs (L2816)) the source span of a call to add as an example, but the example files are never actually in the source map from what I can tell, and so it falls back to the default span, which points at the first file in the source map.
> Now, the issue that guillaume mentions [here](https://github.com/rust-lang/rust/pull/145008) adds new files to the source map in order to get them into the dep info, and that leads to some files, namely docs-rs/trait-tags.html in the case of bevy because it's added with --html-after-content, being added before any source files, so then the default span points at them, and when href_from_span tries to find the [source file](84a1747022/src/librustdoc/html/render/context.rs (L368)) corresponding to the span, the file doesn't belong to local_sources, and it short circuits.
> This can be fixed by just not using DUMMY_SP as the default span and calculating, for example, the crates root source file as the span, because I'm not entirely sure what the href from that span is actually used for; it's not what links to the example in the end.
> I think the proper way of fixing this would be to make sure the example files are part of the local_sources or at least the source map, but I don't know nearly enough about rust internals to be able to figure out how to fix that.

I've included a test that's mostly copied from rust-lang/rust#145008's test with the addition of `--html-after-content after.html` in the `RUSTDOCFLAGS`, which panics on master in conjunction with the `-Zrustdoc-scrape-examples` cargo flag.

cc `@GuillaumeGomez`
2025-09-02 17:08:57 +02:00
..
assembly-llvm Auto merge of #123319 - no92:managarm-target, r=davidtwco 2025-08-30 07:59:16 +00:00
auxiliary Set NumRegisterParameters LLVM module flag to N when -Zregparm=N is 2025-08-13 17:37:30 +02:00
codegen-llvm Rollup merge of #144066 - RalfJung:extern-c-variadics, r=workingjubilee 2025-09-02 17:08:52 +02:00
codegen-units pub async fn implementation coroutine (func::{closure#0}) is monomorphized, when func itself is monomorphized 2025-09-01 13:45:00 +07:00
coverage Auto merge of #143290 - azhogin:azhogin/link-pub-async-impls, r=oli-obk 2025-09-01 10:54:40 +00:00
coverage-run-rustdoc
crashes Add compiler error when trying to use concat metavar expr in repetitions 2025-09-01 08:27:30 +02:00
debuginfo tests: Ignore basic-stepping.rs on riscv64 2025-08-29 08:11:48 +00:00
incremental Bless incremental tests. 2025-07-13 13:50:01 +00:00
mir-opt Auto merge of #144783 - folkertdev:loop-match-diverging-loop, r=SparrowLii 2025-09-01 14:42:07 +00:00
pretty Update autodiff tests for the new intrinsics impl 2025-08-14 18:33:43 +00:00
run-make turn pointer width into an integer in target.json 2025-08-27 23:44:49 +02:00
rustdoc Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
rustdoc-gui squash fix render_call_locations panic when default span points at file outside of local_sources 2025-09-02 01:38:23 +02:00
rustdoc-js rustdoc: add tests for raw pointers in type-based search 2025-08-21 17:50:12 -05:00
rustdoc-js-std tests/rustdoc-js-std/parser-errors.js: remove syntax that is now valid 2025-08-21 20:50:33 -05:00
rustdoc-json Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
rustdoc-ui Add ui test for unsupported doc(attribute = "...") case for attributes with namespace 2025-08-28 18:24:58 +02:00
ui Rollup merge of #146064 - jullanggit:patch-1, r=fmease 2025-09-02 17:08:54 +02:00
ui-fulldeps Switch next solver to use a specific associated type for trait def id 2025-08-25 16:52:08 +03:00
COMPILER_TESTS.md