rust/tests
Matthias Krüger d6966fa15a
Rollup merge of #149274 - GuillaumeGomez:tyalias-method-link, r=lolbinarycat
Fix invalid link generation for type alias methods

Fixes https://github.com/rust-lang/rust/issues/149205.

That one was quite the wild ride. First commit is the actual fix, the second commit is just a small name variable improvement while I was going through the code. Anyway, let's go through it:

 * We don't generate directly implementations in the HTML files for local impls (which I think is a mistake and should be changed, gonna do that as a follow-up) but instead generate a JS file for each type alias containing the HTML for these impls.
 * So in `write_shared.rs::TypeAliasPart::get`, when generating the JS file, we generate the impl into a `String` by calling `render_impl`. This method expects an `AssocItemLink` to help it generate the correct link to the item (I'm planning to also remove this enum because it's yet another way to generate anchors/hrefs).
 * Problem was: we call the `provided_trait_methods` method on the impl item... which is empty if not a trait impl. This becomes an issue when we arrive in `render::assoc_href_attr` because of this code:
     ```rust
            AssocItemLink::GotoSource(did, provided_methods) => {
                let item_type = match item_type {
                    ItemType::Method | ItemType::TyMethod => {
                        if provided_methods.contains(&name) {
                            ItemType::Method
                        } else {
                            ItemType::TyMethod
                        }
                    }
                    item_type => item_type,
                };
                // ...
            }
    ```

     Since `provided_methods` is always empty, it means all methods on type aliases will be `TyMethod`, generating `#tymethod.` URLs instead of `#method.`.
 * So generating `AssocItemLink::GoToSource` only on traits (when `provided_trait_methods` is supposed to return something) was the fix.
 * And finally, because it's (currently) generating implementations only through JS, it means we cannot test it in `tests/rustdoc` so I had to write the test in `tests/rustdoc-gui`. Once I change how we generate local implementations for type aliases, I'll move it to `tests/rustdoc`.

r? ```@lolbinarycat```
2025-11-25 17:51:17 +01:00
..
assembly-llvm Rollup merge of #147173 - androm3da:bcain/hexagon_qurt, r=davidtwco,tgross35 2025-11-20 11:15:51 +01:00
auxiliary Rollup merge of #147521 - sayantn:simd-const-intrinsics, r=madsmtm 2025-11-19 09:48:07 +01:00
codegen-llvm Auto merge of #147827 - saethlin:maybeuninit-codegen2, r=scottmcm 2025-11-23 17:09:07 +00:00
codegen-units Document fmt::Arguments internal representation. 2025-11-12 12:48:39 +01:00
coverage Bless coverage tests. 2025-11-12 12:48:45 +01:00
coverage-run-rustdoc
crashes Replace OffsetOf by an actual sum. 2025-11-18 00:10:03 +00:00
debuginfo update tests 2025-11-24 00:17:53 -06:00
incremental Bless tests. 2025-11-12 12:48:27 +01:00
mir-opt Auto merge of #147827 - saethlin:maybeuninit-codegen2, r=scottmcm 2025-11-23 17:09:07 +00:00
pretty Document fmt::Arguments internal representation. 2025-11-12 12:48:39 +01:00
run-make Rollup merge of #148234 - notriddle:doc-cci, r=GuillaumeGomez 2025-11-24 19:10:43 +01:00
run-make-cargo Skip the panic-immediate-abort-works test when cross-compiling 2025-09-22 21:13:38 -04:00
rustdoc Add test for href of reexported enum variant 2025-11-18 12:23:32 +01:00
rustdoc-gui Fix invalid link generation for type alias methods 2025-11-24 17:01:32 +01:00
rustdoc-js Rollup merge of #147701 - lolbinarycat:rustdoc-search-alias-fix, r=GuillaumeGomez 2025-11-13 11:57:07 +11:00
rustdoc-js-std Add regression test for including derive macros in macro filtering 2025-10-27 16:00:32 +01:00
rustdoc-json Add tests for doc(attribute = "...") attribute 2025-08-28 15:56:30 +02:00
rustdoc-ui Rollup merge of #149197 - lolbinarycat:rustdoc-bad-render-attr, r=GuillaumeGomez 2025-11-23 16:28:13 -05:00
ui Rollup merge of #149268 - davidtwco:v0-mangling-global-asm-namespace, r=Kivooeo 2025-11-25 17:51:16 +01:00
ui-fulldeps When more than a single impl and less than 4 could apply, point at them 2025-10-31 20:44:01 +00:00
COMPILER_TESTS.md