Skip to content

incompletely relating alias args may cause borrowck ICE #140211

@lcnr

Description

@lcnr
trait Id { type This<'a>; } #[derive(Copy, Clone)] struct W<T>(T); impl Id for W<u32> { type This<'a> = W<u32>; } impl Id for W<i32> { type This<'a> = W<i32>; } trait Trait<T> {} // when using this impl we only normalize after instantiating // with infer vars, at this point `<?t as Id>::This<'a>` is still // ambig, so we keep the alias around and require it to structurally // relate. impl<T: Id> Trait<for<'a> fn(T::This<'a>)> for T {} fn is_trait<T: Trait<U>, U>(_x: T) {} fn main() { let x = W(1); // We prove `W<_>: Trait<for<'a> fn(<W<_>>::This<'a>)>` during // typeck, and `W<i32>: Trait<for<'a> fn(<W<i32>)>` during borrowck. // This then fails. is_trait(x); let _: W<i32> = x; }

ICEs with

error: internal compiler error: error performing operation: fully_perform --> src/main.rs:20:5 | 20 | is_trait::<_, _>(x); | ^^^^^^^^^^^^^^^^^^^ | note: delayed at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:87:25 - disabled backtrace --> src/main.rs:20:5 | 20 | is_trait::<_, _>(x); | ^^^^^^^^^^^^^^^^^^^ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions