Skip to content

closure in record triggers a memory leak and abort #1896

Closed
@erickt

Description

@erickt

There seems to be an issue with closures in records and the type checker. This code segfaults with a leaked memory message:

type t<T> = { f: fn() -> T };

fn f<T>(_x: t<T>) {}

fn main() {
    let x: t<()> = { f: { || () } };
    f(x);
}

However, if you remove : t<()> from let x: t<()> = { f: { || () } };, it works just fine.

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions