Closed
Description
It happens only when compiling with debug flag (-g), but I don't know if HashMap is the only things that trigger it.
Code:
extern crate collections;
use collections::HashMap;
fn main() {
let vars: HashMap<~str, ~str> = HashMap::new();
}
Output:
$ rustc -g hashmap.rs
hashmap.rs:9:9: 9:13 warning: unused variable: `vars`, #[warn(unused_variable)] on by default
hashmap.rs:9 let vars: HashMap<~str, ~str> = HashMap::new();
^~~~
error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64' '-L/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib' '-o' 'hashmap' 'hashmap.o' '-lmorestack' '-nodefaultlibs' '-Wl,--as-needed' '/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libnative-0915f5d5-0.10-pre.rlib' '/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-c0316c39-0.10-pre.rlib' '/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/librand-413a5926-0.10-pre.rlib' '/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib/libstd-31b43f22-0.10-pre.rlib' '-L/mnt/opensuse-home/hervie_g/epitest/projects/rust/highlight/.rust' '-L/mnt/opensuse-home/hervie_g/epitest/projects/rust/highlight' '-L/home/hervie_g/.rust' '-lc' '-ldl' '-lm' '-lpthread' '-lgcc_s' '-Wl,-rpath,$ORIGIN/../../../../../../../usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib' '-Wl,-rpath,/usr/lib64/rustlib/x86_64-unknown-linux-gnu/lib' '-Wl,-rpath,/usr/local/lib64/rustlib/x86_64-unknown-linux-gnu/lib' '-lcompiler-rt'
note: hashmap.o:(.debug_info+0xcd): undefined reference to `hashmap::INITIAL_LOG2_CAP::h10f342658dbaf397Pwd::v0.10.pre'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
$ rustc hashmap.rs
hashmap.rs:9:9: 9:13 warning: unused variable: `vars`, #[warn(unused_variable)] on by default
hashmap.rs:9 let vars: HashMap<~str, ~str> = HashMap::new();
^~~~
I'm using the latest Rust nightly build on Arch Linux:
$ rustc -v
rustc 0.10-pre-nightly (d79fbba 2014-03-29 18:56:36 -0700)
host: x86_64-unknown-linux-gnu