Skip to content

ICE with (hopefully) illegal CoerceUnsized impl #68013

Closed
@nikomatsakis

Description

@nikomatsakis

I was experimenting with CoerceUnsized and I encountered an ICE with this example:

#[derive(Clone)]
struct Redirectable<'a, T: ?Sized> {
    data: Rc<Cell<&'a T>>
}

impl<U, T: CoerceUnsized<U>> CoerceUnsized<Redirectable<'_, U>> for Redirectable<'_, T> {}

This is hopefully an illegal CoerceUnsized impl, as it would permit us to do illegal mutation (see the full playground link above for the context). Possible duplicate of #44861.

Note that the ICE requires a feature gate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-coerce_unsizedThe `CoerceUnsized` traitI-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.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