Skip to content

Coherence hint wrong for a blanked implementation bounded by a private trait #62194

Closed
@nagisa

Description

@nagisa

Given code like this:

trait Private {
}

impl<T: Private> Send for T {
}

the diagnostic will read as such:

error[E0119]: conflicting implementations of trait `std::marker::Send` for type `&_`:
 --> src/lib.rs:4:1
  |
4 | impl<T: Private> Send for T {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: conflicting implementation in crate `core`:
          - impl<T> std::marker::Send for &T
            where T: std::marker::Sync, T: ?Sized;
  = note: downstream crates may implement trait `Private` for type `&_`

the last note here is incorrect because the only thing that can implement this trait is the crate which declared the private Private trait.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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