Skip to content

E0277 Emitted Twice #125685

Open
Open
@veera-sivarajan

Description

@veera-sivarajan

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

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemD-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions