rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.9k stars 12.52k forks source link

Incorrect argument index highlighting an error for type mismatch on static trait function calls #122938

Open arduano opened 6 months ago

arduano commented 6 months ago
use std::fmt::Debug;

fn run() {
    let mut not_int = String::new();
    Foo::write_to(123, not_int); // Error span is on the wrong argument here
}

pub trait Foo<W: Debug, Err = ()> {
    fn write_to(self, not_int: W);
}

struct Test;
impl Foo<String> for Test {
    fn write_to(self, not_int: String) {}
}

Playground link

Creates the following error: image

rustc --version --verbose:

rustc 1.79.0-nightly (85e449a32 2024-03-22)

GrigorenkoPV commented 5 months ago

Regression somewhere in c0941dfb5a7d07ef2d70cc54d319669d9d6f6c01...015a824f2dffe32707fceb59c47effaf7b73486c.

100654 looks the most suspicious, cc @compiler-errors