obj_filename: &Path,
out_filename: &Path,
lm: &LinkMeta) -> ~[Path] {
- // If we're generating a test executable, then ignore all other output
- // styles at all other locations
- let outputs = if sess.opts.test {
- ~[session::OutputExecutable]
- } else {
- (*sess.outputs).clone()
- };
-
let mut out_filenames = ~[];
- for output in outputs.move_iter() {
- let out_file = link_binary_output(sess, trans, output, obj_filename, out_filename, lm);
+ for &output in sess.outputs.iter() {
+ let out_file = link_binary_output(sess, trans, output, obj_filename,
+ out_filename, lm);
out_filenames.push(out_file);
}
}
pub fn building_library(options: &options, crate: &ast::Crate) -> bool {
+ if options.test { return false }
for output in options.outputs.iter() {
match *output {
OutputExecutable => {}
OutputStaticlib | OutputDylib | OutputRlib => return true
}
}
- if options.test { return false }
match syntax::attr::first_attr_value_str_by_name(crate.attrs, "crate_type") {
Some(s) => "lib" == s || "rlib" == s || "dylib" == s || "staticlib" == s,
_ => false
}
pub fn collect_outputs(options: &options, crate: &ast::Crate) -> ~[OutputStyle] {
+ // If we're generating a test executable, then ignore all other output
+ // styles at all other locations
+ if options.test {
+ return ~[OutputExecutable];
+ }
let mut base = options.outputs.clone();
let mut iter = crate.attrs.iter().filter_map(|a| {
if "crate_type" == a.name() {
--- /dev/null
+# Regression test for issue #10973
+
+-include ../tools.mk
+
+all:
+ $(RUSTC) --rlib --test foo.rs
+ rm $(TMPDIR)/foo.bc && exit 1 || exit 0