Skip to content

duplicate symbols with enum in boxed closure #2074

Closed
@grahame

Description

@grahame

This program seems correct to me:

fn main(args: [str]) {
    let one = fn@() -> uint {
        enum r { a };
        ret a as uint;
    };
    let two = fn@() -> uint {
        enum r { a };
        ret a as uint;
    };
    one(); two();
}

If I compile it with rust 0d5d2e5 I get:

herugrim::~/code/limerick $ RUST_LOG=rustc=0,::rt::backtrace rustc enumbug.rs
enumbug.rs:2:0: 12:1 warning: unused variable args
enumbug.rs:2 fn main(args: [str]) {
enumbug.rs:3     let one = fn@() -> uint {
enumbug.rs:4         enum r { a };
enumbug.rs:5         ret a as uint;
enumbug.rs:6     };
enumbug.rs:7     let two = fn@() -> uint {
             ...
error: internal compiler error duplicate LLVM symbol: _ZN4main1r1a7discrim17_7bb11dc7a9aa7ee4E
rust: upcall fail 'explicit failure', ../src/rustc/driver/diagnostic.rs:78
rust: upcall fail 'explicit failure', ../src/rustc/driver/rustc.rs:182
rust: domain main @0x7fd822818600 root task failed

This problem only seems to happen with boxed closures (fn@)

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions