Skip to content

unsized coercion: select vs trait goal mismatch #241

@lcnr

Description

@lcnr
trait Super<'a> {}
trait Trait<'a>: Super<'a> + for<'hr> Super<'hr> {}

fn foo<'a>(x: Box<dyn Trait<'a>>) -> Box<dyn Super<'a>> {
    x
}

ICEs in the new solver: using select in HIR typeck arbitrarily prefers the earlier super trait bound, proving the CoerceUnsized trait goal in MIR typeck fails with ambiguity

the above is ambig in the old solver, this one is pass -> fail:

trait Super<T> {}
trait Trait<T>: Super<T> + for<'hr> Super<&'hr ()> {}

fn foo<'a>(x: Box<dyn Trait<&'a ()>>) -> Box<dyn Super<&'a ()>> {
    x
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    from-craterA regression found via a crater run, not part of our test suite

    Type

    No type

    Projects

    Status

    todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions