From 8056506b1b8aef3dc1af1d6256e0665fbfc79ae9 Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 31 Mar 2018 22:12:52 +0100 Subject: [PATCH] Special-case OutputType::Metadata --- src/librustc_trans/back/link.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 168570df464..60ce0517cfa 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -146,7 +146,10 @@ pub(crate) fn link_binary(sess: &Session, let mut out_filenames = Vec::new(); for &crate_type in sess.crate_types.borrow().iter() { // Ignore executable crates if we have -Z no-trans, as they will error. - if sess.opts.debugging_opts.no_trans && crate_type == config::CrateTypeExecutable { + let output_metadata = sess.opts.output_types.contains_key(&OutputType::Metadata); + let ignore_executable = sess.opts.debugging_opts.no_trans || + !(sess.opts.output_types.should_trans() || output_metadata); + if crate_type == config::CrateTypeExecutable && ignore_executable { continue; }