Skip to content

if true { ... } runs destructors twice #10734

Closed
@alexcrichton

Description

@alexcrichton
$ cat foo.rs                        
fn main() {
    if true {
        let _a = ~2;
    } else {
        fail!()
    }
}
$ rustc foo.rs 
$ ./foo    
foo(23204,0x107be0000) malloc: *** error for object 0x7fd132c02790: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
zsh: abort      ./foo

Doesn't get much worse than that. Nominating because this is terrible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions