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

Remove redundant phrasing from trait bound diagnostic #99418

Closed
JoJoJet opened this issue Jul 18, 2022 · 1 comment
Closed

Remove redundant phrasing from trait bound diagnostic #99418

JoJoJet opened this issue Jul 18, 2022 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@JoJoJet
Copy link
Contributor

JoJoJet commented Jul 18, 2022

Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5c8b3650fbcd3671c608fd2e6ed118ad

fn foo(x: impl std::ops::Add) {
    todo!()
}

struct X<T>(T);
impl<T: std::ops::Add<Output = T>> std::ops::Add for X<T> {
    type Output = Self;
    fn add(self, rhs: Self) -> Self {
        Self(self.0 + rhs.0)
    }
}

fn main() {
    foo(X("x"));
}

The current output is:

note: required because of the requirements on the impl of `Add` for `X<&str>`

Ideally the output should look like:

note: required by the impl of `Add` for `X<&str>`

The original phrasing is distracting and contributes to visual noise.

@JoJoJet JoJoJet added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 18, 2022
@fmease
Copy link
Member

fmease commented Jul 18, 2022

Coincidentally, there is an open PR (#98807) that tries to address this problem. Not sure if it has stalled.

@JoJoJet JoJoJet closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2022
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 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

2 participants