rust-lang / rust-lang/reference
Improve method selection to make short-circuiting clear
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- PR merge metrics
- PR metrics pending
Description
Method resolution has two steps. We collect a list of types, then we go through that list and, for each type, look to see whether there's one or more matching methods. If we find multiple matching trait methods, that's an error. But otherwise, we stop if we find one.
What we don't do is continue down the list of types after finding a matching method. In PR #1394 this was brought up. We weren't happy with the fix, but this is something we should think about when reworking this language.
See also:
- https://github.com/rust-lang/reference/pull/1432
- https://github.com/rust-lang/reference/issues/1018
- https://github.com/rust-lang/reference/issues/718
cc @ehuss
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the discussion in PR #1394 and the linked Rust Reference PR #1432 and issues #1018 and #718. Determine whether the intended outcome is a documentation clarification or a language-design change; this issue is done only when the agreed method-resolution behavior is recorded in the Reference or superseded by a decided design.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100