Skip to content

Explicit OIBIT impls hide the default impls #27554

Closed
@wthrowe

Description

@wthrowe
#![allow(dead_code)]

trait Foo {}
struct A<T>(T);
unsafe impl<T: Foo> Sync for A<T> {} // Comment this line and the code compiles

trait IsSync: Sync {}
struct X;
impl IsSync for A<X> {} // error: the trait `Foo` is not implemented for the type `X` [E0277]

fn main() {}

Nothing in this example opts out of Sync or contains a type that opts out, so everything should be Sync.

I suspect this is the same underlying issue as #23072, but unlike in that case this seems like something that should be allowed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions