os-rust/tests
Matthias Krüger 67278cd9f4
Rollup merge of #133392 - compiler-errors:object-sup, r=lcnr
Fix ICE when multiple supertrait substitutions need assoc but only one is provided

Dyn traits must have all of their associated types constrained either by:
1. writing them in the dyn trait itself as an associated type bound, like `dyn Iterator<Item = u32>`,
2. A supertrait bound, like `trait ConstrainedIterator: Iterator<Item = u32> {}`, then you may write `dyn ConstrainedIterator` which doesn't need to mention `Item`.

However, the object type lowering code did not consider the fact that there may be multiple supertraits with different substitutions, so it just used the associated type's *def id* as a key for keeping track of which associated types are missing:

1fc691e6dd/compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs (L131)

This means that we can have missing associated types when there are mutliple supertraits with different substitutions and only one of them is constrained, like:

```rust
trait Sup<T> {
    type Assoc: Default;
}

impl<T: Default> Sup<T> for () {
    type Assoc = T;
}
impl<T: Default, U: Default> Dyn<T, U> for () {}

trait Dyn<A, B>: Sup<A, Assoc = A> + Sup<B> {}
```

The above example allows you to name `<dyn Dyn<i32, u32> as Sup<u32>>::Assoc` even though it is not possible to project since it's neither constrained by a manually written projection bound or a supertrait bound. This successfully type-checks, but leads to a codegen ICE since we are not able to project the associated type.

This PR fixes the validation for checking that a dyn trait mentions all of its associated type bounds. This is theoretically a breaking change, since you could technically use that `dyn Dyn<A, B>` type mentionedin the example above without actually *projecting* to the bad associated type, but I don't expect it to ever be relevant to a user since it's almost certainly a bug. This is corroborated with the crater results[^crater], which show no failures[^unknown].

Crater: https://github.com/rust-lang/rust/pull/133392#issuecomment-2508769703

Fixes #133388

[^crater]: I cratered this originally with #133397, which is a PR that is stacked on top, then re-ran crater with just the failures from that PR.
[^unknown]: If you look at the crater results, it shows all of the passes as "unknown". I believe this is a crater bug, since looking at the results manually shows them as passes.
2024-12-14 23:56:30 +01:00
..
assembly Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr 2024-12-04 00:47:09 +00:00
auxiliary Support input/output in vector registers of s390x inline assembly 2024-11-22 04:18:14 +09:00
codegen Auto merge of #133899 - scottmcm:strip-mir-debuginfo, r=oli-obk 2024-12-13 08:32:20 +00:00
codegen-units Remove polymorphization 2024-12-06 16:42:09 -05:00
coverage Stabilize async closures 2024-12-13 00:04:56 +00:00
coverage-run-rustdoc coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
crashes Add a regression test for #134162 2024-12-14 17:07:20 +08:00
debuginfo Reformat Python code with ruff 2024-12-04 23:03:44 +01:00
incremental Add more info on type/trait mismatches for different crate versions 2024-12-07 18:18:08 +00:00
mir-opt Auto merge of #133899 - scottmcm:strip-mir-debuginfo, r=oli-obk 2024-12-13 08:32:20 +00:00
pretty Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
run-make Rollup merge of #133386 - wesleywiser:update_musl_base_crt_default, r=jieyouxu 2024-12-14 14:07:56 +01:00
rustdoc Stabilize async closures 2024-12-13 00:04:56 +00:00
rustdoc-gui Update GUI test after rebase 2024-12-05 22:50:21 +01:00
rustdoc-js rustdoc-search: fix mismatched path when parent re-exported twice 2024-12-12 13:29:18 -07:00
rustdoc-js-std rustdoc-search: update test with now-shorter function path 2024-12-13 09:08:44 -07:00
rustdoc-json Rollup merge of #133721 - aDotInTheVoid:rdj-dyn-link, r=GuillaumeGomez 2024-12-02 17:36:05 +01:00
rustdoc-ui Account for /// when rendering multiline spans 2024-12-13 18:48:33 +00:00
ui Rollup merge of #133392 - compiler-errors:object-sup, r=lcnr 2024-12-14 23:56:30 +01:00
ui-fulldeps Rollup merge of #134043 - ehuss:unicode-version, r=jieyouxu 2024-12-09 23:39:05 +01:00
COMPILER_TESTS.md