Skip to content

specialization: default items completely drop candidates instead of ambiguity #105782

@lcnr

Description

@lcnr

which is unsound during coherence, as coherence requires completeness

#![feature(specialization)]

trait Default {
   type Id;
}

impl<T> Default for T {
   default type Id = T;
}

trait Overlap {
   type Assoc;
}

impl Overlap for u32 {
   type Assoc = usize;
}

impl Overlap for <u32 as Default>::Id {
   type Assoc = Box<usize>;
}

let eligible = match &impl_source {

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-coherenceArea: CoherenceA-specializationArea: Trait impl specializationA-trait-systemArea: Trait systemC-bugCategory: This is a bug.F-specialization`#![feature(specialization)]`I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessS-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions