You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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);
I'll look at this. I'm suspecting that the problem is that export socket_handle only exports the socket_handle type, and if you deleted the export statement (exporting everything), that would allow you to use the socket_handle constructor from another crate. But that's just a guess.
Couldn't reproduce with 0d7bef4 (I couldn't get rust-socket to compile with the current version of rustc, but I made a self-contained example), so I added the test case.
Activity
catamorphism commentedon Jul 26, 2012
I'll look at this. I'm suspecting that the problem is that
export socket_handleonly exports thesocket_handletype, and if you deleted the export statement (exporting everything), that would allow you to use thesocket_handleconstructor from another crate. But that's just a guess.brson commentedon Aug 15, 2012
structs also have this problem using the field initialization syntax
Test case for #3012
catamorphism commentedon Aug 16, 2012
Couldn't reproduce with 0d7bef4 (I couldn't get rust-socket to compile with the current version of rustc, but I made a self-contained example), so I added the test case.
pcwalton commentedon Aug 16, 2012
@brson, do you have a test case? I would like to fix this ASAP if it is still a bug.
pcwalton commentedon Aug 16, 2012
You can't construct cross-crate structs. Embarrassing. Fix underway.
Merge pull request rust-lang#3012 from YaLTeR/fix-issue-2496
Auto merge of rust-lang#3012 - rust-lang:rustup-2023-08-04, r=oli-obk
Merge rust-lang#7260
Merge pull request rust-lang#3012 from rust-lang/offload-usage-update