Closed
Description
given a modue testmod in src/testmod/ with this code
lib.rs
pub use other::FooBar;
pub use other::foo;
mod other;
other.rs
pub struct FooBar{value: int}
impl FooBar{
pub fn new(val: int) -> FooBar {
FooBar{value: val}
}
}
pub fn foo(){
1+1;
}
and test.rs
extern mod testmod;
#[test]
fn create() {
testmod::foo();
testmod::FooBar::new(1);
}
running
rustc --lib src/testmod/lib.rs -o src/testmod/testmod && rustc --test src/testmod/test.rs -L src/testmod/
fails with
error: linking with `cc` failed with code 1
note: cc arguments: -L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -m64 -o src/testmod/test src/testmod/test.o -L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -lstd-6c65cf4b443341b1-0.9-pre -Lsrc/testmod -ltestmod-15fb3a718ea23983-0.0 -L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -lextra-a7c050cfd46b2c9a-0.9-pre -lrustrt -lrt -lpthread -Lsrc/testmod -L. -L/home/xandy/Projects/rusttest/.rust -L/home/xandy/Projects/rusttest -lrt -ldl -lm -lmorestack -lrustrt -Wl,-rpath,$ORIGIN/../../../../../../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -Wl,-rpath,$ORIGIN/. -Wl,-rpath,/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib -Wl,-rpath,/home/xandy/Projects/rusttest/src/testmod
note: src/testmod/test.o: In function `create::hbb4547578de7b860ai::v0.0':
test.rc:(.text+0x41): undefined reference to `other::FooBar::new::h89aaf3c2942f8021LSaM::v0.0'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
task '<unnamed>' failed at 'explicit failure', /home/xandy/src/rust/src/libsyntax/diagnostic.rs:98
task '<unnamed>' failed at 'explicit failure', /home/xandy/src/rust/src/librustc/rustc.rs:391
if lib.rs has pub mod other; instead of mod other; it works. is this intended?
Metadata
Metadata
Assignees
Labels
No labels