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

E0277 Emitted Twice #125685

Open
veera-sivarajan opened this issue May 28, 2024 · 1 comment
Open

E0277 Emitted Twice #125685

veera-sivarajan opened this issue May 28, 2024 · 1 comment
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-traits Area: Trait system D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@veera-sivarajan
Copy link
Contributor

veera-sivarajan commented May 28, 2024

Code

fn main() {}

trait Foo {
    type Output;
}

fn baz<I>(x: &<I as Foo>::Output) {}

Current output

error[E0277]: the trait bound `I: Foo` is not satisfied
  --> test.rs:23:15
   |
23 | fn baz<I>(x: &<I as Foo>::Output) {}
   |               ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I`
   |
help: consider restricting type parameter `I`
   |
23 | fn baz<I: Foo>(x: &<I as Foo>::Output) {}
   |         +++++

error[E0277]: the trait bound `I: Foo` is not satisfied
  --> test.rs:23:35
   |
23 | fn baz<I>(x: &<I as Foo>::Output) {}
   |                                   ^^ the trait `Foo` is not implemented for `I`
   |
help: consider restricting type parameter `I`
   |
23 | fn baz<I: Foo>(x: &<I as Foo>::Output) {}
   |         +++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0277`.

Desired output

error[E0277]: the trait bound `I: Foo` is not satisfied
 --> <source>:7:15
  |
7 | fn baz<I>(x: &<I as Foo>::Output) {}
  |               ^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `I`
  |
help: consider restricting type parameter `I`
  |
7 | fn baz<I: Foo>(x: &<I as Foo>::Output) {}
  |         +++++

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0277`.

Bisect

searched nightlies: from nightly-2024-02-01 to nightly-2024-03-16
regressed nightly: nightly-2024-02-15
searched commit range: a84bb95...ee9c7c9
regressed commit: ee9c7c9 (PR: #120847)

bisected with cargo-bisect-rustc v0.6.8

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --prompt --start=1.77.0 --end=1.78.0 

Rust Version

rustc 1.80.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.80.0-dev
LLVM version: 18.1.6
@veera-sivarajan veera-sivarajan 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 May 28, 2024
@compiler-errors compiler-errors self-assigned this May 28, 2024
@compiler-errors
Copy link
Member

compiler-errors commented May 28, 2024

I was just looking at errors like this today. I'll take a look.

@fmease fmease added A-traits Area: Trait system D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. labels May 28, 2024
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 A-traits Area: Trait system D-verbose Diagnostics: Too much output caused by a single piece of incorrect code. 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

3 participants