Skip to content

Specialized associated type doesn't have impls that it should have #98389

Open
@ivan770

Description

@ivan770

I tried this code:

#![feature(specialization)]

trait One {
    type Output;
}

impl<T> One for T {
    default type Output = i32;
}

impl One for f32 {
    type Output = f32;
}

trait Two {
    type Output;
}

impl Two for i32 {
    type Output = String;
}

impl Two for f32 {
    type Output = Vec<()>;
}

type Whatever<T> = <<T as One>::Output as Two>::Output;

fn main() {
    let t: Whatever<Vec<i32>> = String::from("123");
}

I expected to see this happen: It compiles, as it does with Chalk

Instead, this happened: It doesn't compile

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemC-bugCategory: This is a bug.F-specialization`#![feature(specialization)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.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