rust-lang / rust-lang/rust

improve spans for `CallArgument` constraints

Open
#135,238 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-borrow-checker A-diagnostics C-enhancement D-imprecise-spans T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

that's a quirk of CallArgument constraints. they get their span from the Location of the call terminator; since they don't store the span of the particular argument, it gets lost in diagnostics. that said, it does look like we have the spans of each argument in TypeChecker::check_call_inputs, so they could store that.

Originally posted by @dianne in https://github.com/rust-lang/rust/pull/133858#discussion_r1906130482

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at TypeChecker::check_call_inputs and trace how each argument's span is handled when creating CallArgument constraints. Check how the constraint currently uses the call terminator's Location, then preserve the particular argument span so diagnostics point to that argument. Done means CallArgument constraint diagnostics identify the relevant argument rather than the call terminator.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.