Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
arduano opened this issue Mar 23, 2024 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@arduano
Copy link

arduano commented Mar 23, 2024

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)

@arduano arduano added the C-bug Category: This is a bug. label Mar 23, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 23, 2024
@arduano arduano changed the title Incorrect argument index highlighting an error for type mismatch Incorrect argument index highlighting an error for type mismatch on static trait function calls Mar 23, 2024
@jieyouxu jieyouxu added D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-diagnostics Area: Messages for errors, warnings, and lints S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 23, 2024
@GrigorenkoPV
Copy link
Contributor

Regression somewhere in c0941df...015a824.

#100654 looks the most suspicious, cc @compiler-errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. D-incorrect Diagnostics: A diagnostic that is giving misleading or incorrect information. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants