"mismatched types" on indexing into trait with two Index subtraits via output type #70944
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-inference
Area: Type inference
A-trait-system
Area: Trait system
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
If a trait has two or more
Index
subtraits, and one obtains a reference to something that implements that trait under specific conditions, typeck reports an error for indexing with all but the lastIndex
's key. Seems to happen only if that reference was obtained through another trait's output type.Consider the following example (playground):
This breaks with the message:
The issue does not occur if the indexing is performed on a
Foo
directly. That is, the following works just fine (playground):What I would expect to happen is that all three index operations work. More specifically, I would expect each of the operations to produce the corresponding
Index::Output
type correctly.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: