Skip to content

cross-crate class construction fails #3012

Closed
@jesse99

Description

@jesse99

In https://github.com/jdm/rust-socket there is code like this:

export socket_handle;

class socket_handle {
    let sockfd: libc::c_int;
    new(x: libc::c_int) {self.sockfd = x;}
    drop {c::close(self.sockfd);}
}

From a different crate I do:

import socket;
let sock = @socket::socket_handle(fd);

And I get:

src/connection.rs:37:13: 37:39 error: mismatched types: expected function or foreign function but found socket::socket_handle
src/connection.rs:37    let sock = @socket::socket_handle(fd);

This is with rust f676547

Work around for now is to export a function that calls the ctor for me.

(I know instance construction is being actively worked on atm, but it seems like there may be a missing unit test for this case).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-resolveArea: Name/path resolution done by `rustc_resolve` specifically

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions