Skip to content

ICE: fictitious type <&'static str as AsOwned>::R in sizing_type_of() #29832

Closed
@WildCryptoFox

Description

@WildCryptoFox

The following code causes a compiler panic.

trait AsOwned { type R; }
impl<'a> AsOwned for &'a str { type R = String; }
fn as_owned<'a>(a: &'a str) -> <&'a str as AsOwned>::R { a.to_owned() }

This should resolve to a concrete type but instead panics with: play.rust-lang.org

error: internal compiler error: fictitious type <&'static str as AsOwned>::R in
sizing_type_of()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions