Skip to content

Possibly spurious overlapping impl (even with specialization) #43048

@eira-fransham

Description

@eira-fransham

The following code leads to an "overlapping impl" error despite the fact that the bool impl is clearly more specific (totally concrete).

#![feature(specialization)]

trait Encodable {
    fn encode() {}
}
trait Decodable {
    fn decode() {}
}

impl Encodable for bool {
    fn encode() {}
}

impl Decodable for bool {
    fn decode() {}
}

impl<D> Encodable for D where for<'a> &'a D: AsRef<[u8]> {
    default fn encode() {}
}

impl<T: for<'a> From<&'a [u8]>> Decodable for T {
    default fn decode() {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-specializationArea: Trait impl specializationC-bugCategory: This is a bug.F-specialization`#![feature(specialization)]`

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions