When encountering duplicated item names, register error resolution to avoid further errors
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
As one example from our test suite, the following test has a duplicated name error, where the latter resolution is registered, which causes any use of the item when expecting the first causes subsequent errors:
Ideally when encountering duplicated names we should register that name as an error Res so that subsequent uses do not emit any errors. Fixing the duplicated names might cause subsequent errors to happen from any case where we were expecting the latter item, but it's just a coin toss in the end (and when adding a new item shadowing an existing one, the existing one is likely to have many more usages than the new one). Doing this trades less verbosity when encountering this for at least one additional compile cycle to get the errors of incorrect uses. An alternative would be to collect all access to duplicated items and emit a single error for them, but that might need additional complicated Resolver logic.
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 with tests/ui/traits/issue-106072.stderr and trace the compiler resolver's handling of duplicated names and the Resolver logic mentioned in the issue. Confirm the current diagnostics and identify the relevant duplicate-name resolution path. Done means duplicated names register an error Res so later uses do not produce follow-on errors, with UI expectations updated accordingly.
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
- Mostly clear
- Newbie friendliness
- 38/100