Rust: Add type inference tests for method resolution overlap#20715
Rust: Add type inference tests for method resolution overlap#20715hvitved merged 1 commit intogithub:mainfrom
Conversation
9dcfe73 to
92cf5b3
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR adds test cases for trait inheritance method resolution in Rust's type inference system. The changes test how method calls are resolved when a type implements both a base trait and a derived trait that inherits from it.
- Added test structures and traits to cover trait inheritance scenarios
- Added test calls to verify method resolution behavior with trait inheritance
- Updated consistency expectations to reflect the new test cases with multiple call targets
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| main.rs | Added MyTrait1/MyTrait2 trait definitions, S4 and S5 struct implementations, and test method calls to verify trait inheritance resolution behavior |
| PathResolutionConsistency.expected | Updated expected output to include new method calls that resolve to multiple targets due to trait inheritance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| struct S4; | ||
|
|
||
| impl MyTrait1 for S4 { | ||
| // <S4_as_MyTrait2>::m |
There was a problem hiding this comment.
The comment incorrectly references <S4_as_MyTrait2>::m, but this is an implementation of MyTrait1 for S4. The comment should be <S4_as_MyTrait1>::m to accurately reflect the trait being implemented.
| // <S4_as_MyTrait2>::m | |
| // <S4_as_MyTrait1>::m |
| struct S5<T5>(T5); | ||
|
|
||
| impl MyTrait1 for S5<i32> { | ||
| // <S5<i32>_as_MyTrait2>::m |
There was a problem hiding this comment.
The comment incorrectly references <S5<i32>_as_MyTrait2>::m, but this is an implementation of MyTrait1 for S5<i32>. The comment should be <S5<i32>_as_MyTrait1>::m to accurately reflect the trait being implemented.
| // <S5<i32>_as_MyTrait2>::m | |
| // <S5<i32>_as_MyTrait1>::m |
92cf5b3 to
6ed8bcb
Compare
No description provided.