about summary refs log tree commit diff
path: root/tests/rustdoc-js-std/parser-weird-queries.js
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-04-17 17:40:27 +0200
committerGitHub <noreply@github.com>2025-04-17 17:40:27 +0200
commitda43826398d2d5aa7f0f1e2879af2bd80910553c (patch)
tree792b7f08ecf4488f9e4b314dfd8961c41ff01590 /tests/rustdoc-js-std/parser-weird-queries.js
parent883f9f72e87ccb6838d528d8158ea6323baacc65 (diff)
parente1936d22ed6c686bc9f2c92634fba9246bd86b9d (diff)
downloadrust-da43826398d2d5aa7f0f1e2879af2bd80910553c.tar.gz
rust-da43826398d2d5aa7f0f1e2879af2bd80910553c.zip
Rollup merge of #139774 - compiler-errors:supertrait-alias, r=lcnr
Fix replacing supertrait aliases in `ReplaceProjectionWith`

The new solver has a procedure called `predicates_for_object_candidate`, which elaborates the super-bounds and item-bounds that are required to hold for a dyn trait to implement something via a built-in object impl.

In that procedure, there is a folder called `ReplaceProjectionWith` which is responsible for replacing projections that reference `Self`, so that we don't encounter cycles when we then go on to normalize those projections in the process of proving these super-bounds.

That folder had a few problems: Firstly, it wasn't actually checking that this was a super bound originating from `Self`. Secondly, it only accounted for a *single* projection type def id, but trait objects can have multiple (i.e. `trait Foo<A, B>: Bar<A, Assoc = A> + Bar<B, Assoc = B>`).

To fix the first, it's simple enough to just add an equality check for the self ty. To fix the second, I implemented a matching step that's very similar to the `projection_may_match` check we have for upcasting, since on top of having multiple choices, we need to deal with both non-structural matches and ambiguity.

This probably lacks a bit of documentation, but I think it works pretty well.

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/171

r? lcnr
Diffstat (limited to 'tests/rustdoc-js-std/parser-weird-queries.js')
0 files changed, 0 insertions, 0 deletions