Skip to content

Using enclosing function's type parameter in enum definition yields ICE instead of error #5997

Closed
@jld

Description

@jld
fn f<T>() { enum E { V(T) } }
pub fn main() { f::<int>(); }

⇒ error: internal compiler error: fictitious type ty_param({idx: 0, def_id: {crate: 0, node: 1}}) in sizing_type_of()

fn f<T>() { struct S(T); }
pub fn main() { f::<int>(); }

⇒ error: attempt to use a type argument out of scope

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-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