_ => AllowUnused::No,
};
- let mut rustc =
- self.make_compile_args(&self.testpaths.file, output_file, emit_metadata, allow_unused);
-
- rustc.arg("-L").arg(&self.aux_output_dir_name());
+ let rustc = self.make_compile_args(
+ &self.testpaths.file,
+ output_file,
+ emit_metadata,
+ allow_unused,
+ LinkToAux::Yes,
+ );
self.compose_and_run_compiler(rustc, None)
}
// Create the directory for the stdout/stderr files.
create_dir_all(aux_cx.output_base_dir()).unwrap();
let input_file = &aux_testpaths.file;
- let mut aux_rustc =
- aux_cx.make_compile_args(input_file, aux_output, EmitMetadata::No, AllowUnused::No);
+ let mut aux_rustc = aux_cx.make_compile_args(
+ input_file,
+ aux_output,
+ EmitMetadata::No,
+ AllowUnused::No,
+ LinkToAux::No,
+ );
for key in &aux_props.unset_rustc_env {
aux_rustc.env_remove(key);
output_file: TargetLocation,
emit_metadata: EmitMetadata,
allow_unused: AllowUnused,
+ link_to_aux: LinkToAux,
) -> Command {
let is_aux = input_file.components().map(|c| c.as_os_str()).any(|c| c == "auxiliary");
let is_rustdoc = self.is_rustdoc() && !is_aux;
rustc.arg("-Ctarget-feature=-crt-static");
}
+ if let LinkToAux::Yes = link_to_aux {
+ rustc.arg("-L").arg(self.aux_output_dir_name());
+ }
+
rustc.args(&self.props.compile_flags);
rustc
// codegen tests (using FileCheck)
fn compile_test_and_save_ir(&self) -> ProcRes {
- let aux_dir = self.aux_output_dir_name();
-
let output_file = TargetLocation::ThisDirectory(self.output_base_dir());
let input_file = &self.testpaths.file;
- let mut rustc =
- self.make_compile_args(input_file, output_file, EmitMetadata::No, AllowUnused::No);
- rustc.arg("-L").arg(aux_dir).arg("--emit=llvm-ir");
+ let mut rustc = self.make_compile_args(
+ input_file,
+ output_file,
+ EmitMetadata::No,
+ AllowUnused::No,
+ LinkToAux::Yes,
+ );
+ rustc.arg("--emit=llvm-ir");
self.compose_and_run_compiler(rustc, None)
}
let output_file = TargetLocation::ThisFile(output_path.clone());
let input_file = &self.testpaths.file;
- let mut rustc =
- self.make_compile_args(input_file, output_file, EmitMetadata::No, AllowUnused::No);
-
- rustc.arg("-L").arg(self.aux_output_dir_name());
+ let mut rustc = self.make_compile_args(
+ input_file,
+ output_file,
+ EmitMetadata::No,
+ AllowUnused::No,
+ LinkToAux::Yes,
+ );
match self.props.assembly_output.as_ref().map(AsRef::as_ref) {
Some("emit-asm") => {
output_file,
EmitMetadata::No,
AllowUnused::Yes,
+ LinkToAux::Yes,
);
- rustc.arg("-L").arg(&new_rustdoc.aux_output_dir_name());
new_rustdoc.build_all_auxiliary(&mut rustc);
let proc_res = new_rustdoc.document(&compare_dir);
if self.props.run_rustfix && self.config.compare_mode.is_none() {
// And finally, compile the fixed code and make sure it both
// succeeds and has no diagnostics.
- let mut rustc = self.make_compile_args(
+ let rustc = self.make_compile_args(
&self.testpaths.file.with_extension(UI_FIXED),
TargetLocation::ThisFile(self.make_exe_name()),
emit_metadata,
AllowUnused::No,
+ LinkToAux::Yes,
);
- rustc.arg("-L").arg(&self.aux_output_dir_name());
let res = self.compose_and_run_compiler(rustc, None);
if !res.status.success() {
self.fatal_proc_rec("failed to compile fixed code", &res);
Yes,
No,
}
+
+enum LinkToAux {
+ Yes,
+ No,
+}