Interaction between operator traits and autoderef is unclear
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Documentation
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- rust
- Domain
- documentation
Research direction
Start by reading the linked Rust Reference sections on method-call autoderef and array-expression desugaring, then use the linked playground to compare the compiler's behavior for s[i].m(). Done means the interaction between operator traits, mutable-place context, and autoderef is precisely explained in the Reference, consistent with the observed behavior and relevant to RFC 997.
Written by the indexing model from the issue text.
Description
While doing research for rust-lang/rfcs#997, I realized that the precise interaction between operator desugaring and method calls is unclear.
Consider s[i].m(). This is a method call expression, so we can follow the autoderef rules in order to work out what to call. But the interior expression is s[i], which might desugar to an index or index_mut call, conditionally depending on whether or not the context is for a mutable place or not. So is the receiver position of m() a mutable place context?
This playground illustrates the compiler's behaviour here quite well, but I don't know the right way to word it in the reference that actually reflects what goes on in the code.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 12
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.
More from rust-lang/reference
-
A-const-eval A-undefined-behavior
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
A-resolve
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
A-coercions
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
All issues in rust-lang/reference
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100