Skip to content

ICE in trait normalization when specialization enabled #43037

Closed
@cjsut

Description

@cjsut

The following code (playground)

#![crate_type = "lib"]
#![feature(specialization)] // comment this line to get the expected behavior
trait X {}
trait Y: X {}
trait Z { type Assoc: Y; }
struct A<T>(T);

impl<T> Y for T where T: X {}
impl<T: X> Z for A<T> { type Assoc = T; }

// this impl is invalid, but causes an ICE anyway
impl<T> From<<A<T> as Z>::Assoc> for T {}

produces

error: internal compiler error: /checkout/src/librustc/traits/specialize/mod.rs:201: failed to fully normalize <T as std::convert::From<<A<T> as Z>::Assoc>>: [FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<T as X>)),depth=1),Unimplemented)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-specializationArea: Trait impl specializationC-bugCategory: This is a bug.F-specialization`#![feature(specialization)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions