-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Rust: Add type inference tests for method resolution overlap #20715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9dcfe73 to
92cf5b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.