Skip to content

llvm assert with exports, resources, and classes with destructors #2526

Description

@erickt

#[link(name = "zmq",
       vers = "0.2",
       uuid = "54cc1bc9-02b8-447c-a227-75ebc923bc29")];
#[crate_type = "lib"];

use std;

export context;

resource arc_destruct<T: const>(_data: int) { }

fn arc<T: const>(_data: T) -> arc_destruct<T> {
    arc_destruct(0)
}

fn init() -> arc_destruct<context_res> unsafe {
    arc(context_res())
}

class context_res {
    let ctx : int;

    new() { self.ctx = 0; }

    drop { }
}

type context = arc_destruct<context_res>;

impl context for context {
    fn socket() { }
}

errors with:

Global is external, but doesn't have external or dllimport or weak linkage!
void (i1*, { i8, { i64 } }*)* @_ZN11context_res5dtor517_51db91beafd4438c3_02E1
invalid linkage type for function declaration
void (i1*, { i8, { i64 } }*)* @_ZN11context_res5dtor517_51db91beafd4438c3_02E1
Broken module found, compilation aborted!
Stack dump:
0.  Running pass 'Function Pass Manager' on module 'zmq.rc'.
[3]    47900 illegal hardware instruction  rustc zmq.rs

Commenting out the export context fixes the assertion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions