Skip to content

no normalization of unused alias definitions in defaulted type parameters #156271

@lqd

Description

@lqd

We don't eagerly try to normalize defaulted type parameters, allowing the default to use a diverging alias.

This example was mentioned by @BoxyUwU within the context of the new solver, in rust-lang/trait-system-refactor-initiative#139 (comment), but this equally applies to both solvers. Therefore, we can track this in an issue here instead.

#![feature(rustc_attrs)]
#![rustc_no_implicit_bounds]

trait Trait {
    type Diverges<D: Trait>;
}

impl<T> Trait for T {
    type Diverges<D: Trait> = D::Diverges<D>;
}

struct Bar<T = <u8 as Trait>::Diverges<u8>>(*mut T);

passes in both solvers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    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