rust-lang / rust-lang/rust-analyzer
Ergonomic Clone Support
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
The following code errors with rust analyzer, but builds and runs with cargo:
#![feature(ergonomic_clones)]
// ...
let mut y = use || {
// ...
};
specifically:
1. Syntax Error: expected expression [syntax-error] (on the 'u' in 'use')
2. Syntax Error: expected SEMICOLON [syntax-error] (on the space after 'use')
with nightly (2025-08-24) rust analyzer using rustup and rustaceanvim.
The other x.use syntax also fails as well, but the UseCloned trait works as expected.
It's an incomplete feature, so sorry if this is too early. I have no clue if those are supported or if it makes more sense to wait (couldn't find clear info on this). I thought I'd make this issue anyways in case someone else comes across this.
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 reproducing the reported snippet with rust-analyzer nightly 2025-08-24, rustup, and rustaceanvim, then compare diagnostics for the use || and x.use forms with the working UseCloned trait. Trace the syntax handling for the incomplete ergonomic_clones feature; done means supported forms no longer produce syntax errors, or their unsupported status is clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100