Skip to content

Filter out Debug note on E0277 in type context #74766

Open
@estebank

Description

@estebank

Given

trait T {
    type A: Display;
}

impl T for () {
    type A = ();
}

we shouldn't include the last note as that is only useful when dealing with expressions:

error[E0277]: `()` doesn't implement `std::fmt::Display`
 --> src/lib.rs:8:14
  |
3 | trait T {
  |       - required by a bound in this
4 |     type A: Display;
  |             ------- required by this bound in `T`
...
8 |     type A = ();
  |              ^^ `()` cannot be formatted with the default formatter
  |
  = help: the trait `std::fmt::Display` is not implemented for `()`
  = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.F-on_unimplementedError messages that can be tackled with `#[rustc_on_unimplemented]`P-lowLow priorityT-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