From 3ed8b0249f01cc6dce3b5d00bb84499deb015a01 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Thu, 6 Sep 2018 02:58:14 +0000 Subject: [PATCH 01/14] extract helper fn --- src/tools/compiletest/src/header.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 06eeef61a194d..09405dad0ded3 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -772,14 +772,7 @@ impl Config { } pub fn parse_name_value_directive(&self, line: &str, directive: &str) -> Option { - let colon = directive.len(); - if line.starts_with(directive) && line.as_bytes().get(colon) == Some(&b':') { - let value = line[(colon + 1)..].to_owned(); - debug!("{}: {}", directive, value); - Some(expand_variables(value, self)) - } else { - None - } + internal_parse_name_value_directive(self, line, directive) } pub fn find_rust_src_root(&self) -> Option { @@ -816,6 +809,17 @@ pub fn lldb_version_to_int(version_string: &str) -> isize { version_string.parse().expect(&error_string) } +fn internal_parse_name_value_directive(config: &Config, line: &str, directive: &str) -> Option { + let colon = directive.len(); + if line.starts_with(directive) && line.as_bytes().get(colon) == Some(&b':') { + let value = line[(colon + 1)..].to_owned(); + debug!("{}: {}", directive, value); + Some(expand_variables(value, config)) + } else { + None + } +} + fn expand_variables(mut value: String, config: &Config) -> String { const CWD: &'static str = "{{cwd}}"; const SRC_BASE: &'static str = "{{src-base}}"; From f9e988cfe077282dbad65f1aefa88010eed2dcf1 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Thu, 6 Sep 2018 11:42:19 +0000 Subject: [PATCH 02/14] try to make this testable --- src/tools/compiletest/src/header.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 09405dad0ded3..3ed8284d628c0 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -772,7 +772,7 @@ impl Config { } pub fn parse_name_value_directive(&self, line: &str, directive: &str) -> Option { - internal_parse_name_value_directive(self, line, directive) + internal_parse_name_value_directive(line, directive).map(|v| expand_variables(v, self)) } pub fn find_rust_src_root(&self) -> Option { @@ -809,12 +809,18 @@ pub fn lldb_version_to_int(version_string: &str) -> isize { version_string.parse().expect(&error_string) } -fn internal_parse_name_value_directive(config: &Config, line: &str, directive: &str) -> Option { +#[test] +fn test_parse_name_value_directive() { + let sample_directive = "aux-build:foo.rs"; + assert_eq!(Some("foo.rs".to_owned()), internal_parse_name_value_directive(&sample_directive, "aux-build")) +} + +fn internal_parse_name_value_directive(line: &str, directive: &str) -> Option { let colon = directive.len(); if line.starts_with(directive) && line.as_bytes().get(colon) == Some(&b':') { let value = line[(colon + 1)..].to_owned(); debug!("{}: {}", directive, value); - Some(expand_variables(value, config)) + Some(value) } else { None } From 945577fbff65905cec8826591d46093726e05524 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Thu, 6 Sep 2018 13:02:26 +0000 Subject: [PATCH 03/14] add negative test --- src/tools/compiletest/src/header.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 3ed8284d628c0..83dd40345f3bf 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -811,8 +811,8 @@ pub fn lldb_version_to_int(version_string: &str) -> isize { #[test] fn test_parse_name_value_directive() { - let sample_directive = "aux-build:foo.rs"; - assert_eq!(Some("foo.rs".to_owned()), internal_parse_name_value_directive(&sample_directive, "aux-build")) + assert_eq!(Some("foo.rs".to_owned()), internal_parse_name_value_directive("aux-build:foo.rs", "aux-build")); + assert_eq!(None, internal_parse_name_value_directive("faux-build:foo.rs", "aux-build")); } fn internal_parse_name_value_directive(line: &str, directive: &str) -> Option { From 7f4f0a449d1de38fb597e18a2b0857429b726a6c Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Thu, 6 Sep 2018 13:02:46 +0000 Subject: [PATCH 04/14] add name-kv parser --- src/tools/compiletest/src/header.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 83dd40345f3bf..9a0ad401cb167 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -815,6 +815,29 @@ fn test_parse_name_value_directive() { assert_eq!(None, internal_parse_name_value_directive("faux-build:foo.rs", "aux-build")); } +#[derive(Debug, PartialEq)] +struct KeyValue { + key: String, + value: String, +} + +#[test] +fn test_parse_name_kv_directive() { + let value = internal_parse_name_kv_directive("crate-aux-build:baz=foo.rs", "crate-aux-build"); + assert_eq!(Some(KeyValue{key:"baz".to_owned(), value:"foo.rs".to_owned()}), value); +} + +fn internal_parse_name_kv_directive(line: &str, directive: &str) -> Option { + if let Some(value) = internal_parse_name_value_directive(line, directive) { + let parts = value.split("=").collect::>(); + if parts.len() == 2 { + let (k,v) = (parts[0], parts[1]); + return Some(KeyValue{key:k.to_string(),value:v.to_string()}); + } + } + None +} + fn internal_parse_name_value_directive(line: &str, directive: &str) -> Option { let colon = directive.len(); if line.starts_with(directive) && line.as_bytes().get(colon) == Some(&b':') { From 920f25977260cf6f9e33a57064cbe465324b4af0 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 7 Sep 2018 04:59:03 +0000 Subject: [PATCH 05/14] expose aux_crate through Config --- src/tools/compiletest/src/header.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 9a0ad401cb167..68523f24cca11 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -77,6 +77,7 @@ pub struct EarlyProps { pub ignore: Ignore, pub should_fail: bool, pub aux: Vec, + pub aux_crate: Vec, pub revisions: Vec, } @@ -86,6 +87,7 @@ impl EarlyProps { ignore: Ignore::Run, should_fail: false, aux: Vec::new(), + aux_crate: Vec::new(), revisions: vec![], }; @@ -137,6 +139,10 @@ impl EarlyProps { props.aux.push(s); } + if let Some(s) = config.parse_aux_crate(ln) { + props.aux_crate.push(s); + } + if let Some(r) = config.parse_revisions(ln) { props.revisions.extend(r); } @@ -268,6 +274,8 @@ pub struct TestProps { // directory as the test, but for backwards compatibility reasons // we also check the auxiliary directory) pub aux_builds: Vec, + // crates that should be compiled and exposed as the given alias + pub aux_crates: Vec, // Environment settings to use for compiling pub rustc_env: Vec<(String, String)>, // Environment settings to use during execution @@ -327,6 +335,7 @@ impl TestProps { run_flags: None, pp_exact: None, aux_builds: vec![], + aux_crates: vec![], revisions: vec![], rustc_env: vec![], exec_env: vec![], @@ -442,6 +451,10 @@ impl TestProps { self.aux_builds.push(ab); } + if let Some(ab) = config.parse_aux_crate(ln) { + self.aux_crates.push(ab); + } + if let Some(ee) = config.parse_env(ln, "exec-env") { self.exec_env.push(ee); } @@ -576,6 +589,10 @@ impl Config { self.parse_name_value_directive(line, "aux-build") } + fn parse_aux_crate(&self, line: &str) -> Option { + self.parse_name_kv_directive(line, "aux-crate") + } + fn parse_compile_flags(&self, line: &str) -> Option { self.parse_name_value_directive(line, "compile-flags") } @@ -775,6 +792,10 @@ impl Config { internal_parse_name_value_directive(line, directive).map(|v| expand_variables(v, self)) } + pub fn parse_name_kv_directive(&self, line: &str, directive: &str) -> Option { + internal_parse_name_kv_directive(line, directive) + } + pub fn find_rust_src_root(&self) -> Option { let mut path = self.src_base.clone(); let path_postfix = Path::new("src/etc/lldb_batchmode.py"); @@ -815,8 +836,8 @@ fn test_parse_name_value_directive() { assert_eq!(None, internal_parse_name_value_directive("faux-build:foo.rs", "aux-build")); } -#[derive(Debug, PartialEq)] -struct KeyValue { +#[derive(Clone, Debug, PartialEq)] +pub struct KeyValue { key: String, value: String, } From d735cfbba304e0c42de54a009de075fc6389fde5 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 7 Sep 2018 05:21:15 +0000 Subject: [PATCH 06/14] extract helper --- src/tools/compiletest/src/runtest.rs | 118 ++++++++++++++------------- 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 8c3b1bb4df333..c3e0785b69860 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1563,63 +1563,7 @@ impl<'test> TestCx<'test> { } for rel_ab in &self.props.aux_builds { - let aux_testpaths = self.compute_aux_test_paths(rel_ab); - let aux_props = - self.props - .from_aux_file(&aux_testpaths.file, self.revision, self.config); - let aux_output = TargetLocation::ThisDirectory(self.aux_output_dir_name()); - let aux_cx = TestCx { - config: self.config, - props: &aux_props, - testpaths: &aux_testpaths, - revision: self.revision, - }; - // Create the directory for the stdout/stderr files. - create_dir_all(aux_cx.output_base_dir()).unwrap(); - let mut aux_rustc = aux_cx.make_compile_args(&aux_testpaths.file, aux_output); - - let crate_type = if aux_props.no_prefer_dynamic { - None - } else if self.config.target.contains("cloudabi") - || self.config.target.contains("emscripten") - || (self.config.target.contains("musl") && !aux_props.force_host) - || self.config.target.contains("wasm32") - { - // We primarily compile all auxiliary libraries as dynamic libraries - // to avoid code size bloat and large binaries as much as possible - // for the test suite (otherwise including libstd statically in all - // executables takes up quite a bit of space). - // - // For targets like MUSL or Emscripten, however, there is no support for - // dynamic libraries so we just go back to building a normal library. Note, - // however, that for MUSL if the library is built with `force_host` then - // it's ok to be a dylib as the host should always support dylibs. - Some("lib") - } else { - Some("dylib") - }; - - if let Some(crate_type) = crate_type { - aux_rustc.args(&["--crate-type", crate_type]); - } - - aux_rustc.arg("-L").arg(&aux_dir); - - let auxres = aux_cx.compose_and_run( - aux_rustc, - aux_cx.config.compile_lib_path.to_str().unwrap(), - Some(aux_dir.to_str().unwrap()), - None, - ); - if !auxres.status.success() { - self.fatal_proc_rec( - &format!( - "auxiliary build of {:?} failed to compile: ", - aux_testpaths.file.display() - ), - &auxres, - ); - } + build_auxiliary(self, rel_ab, &aux_dir); } rustc.envs(self.props.rustc_env.clone()); @@ -3249,6 +3193,66 @@ impl<'test> TestCx<'test> { } } +fn build_auxiliary(test_cx: &TestCx, rel_ab: &str, aux_dir: &Path) { + let aux_testpaths = test_cx.compute_aux_test_paths(rel_ab); + let aux_props = + test_cx.props + .from_aux_file(&aux_testpaths.file, test_cx.revision, test_cx.config); + let aux_output = TargetLocation::ThisDirectory(test_cx.aux_output_dir_name()); + let aux_cx = TestCx { + config: test_cx.config, + props: &aux_props, + testpaths: &aux_testpaths, + revision: test_cx.revision, + }; + // Create the directory for the stdout/stderr files. + create_dir_all(aux_cx.output_base_dir()).unwrap(); + let mut aux_rustc = aux_cx.make_compile_args(&aux_testpaths.file, aux_output); + + let crate_type = if aux_props.no_prefer_dynamic { + None + } else if test_cx.config.target.contains("cloudabi") + || test_cx.config.target.contains("emscripten") + || (test_cx.config.target.contains("musl") && !aux_props.force_host) + || test_cx.config.target.contains("wasm32") + { + // We primarily compile all auxiliary libraries as dynamic libraries + // to avoid code size bloat and large binaries as much as possible + // for the test suite (otherwise including libstd statically in all + // executables takes up quite a bit of space). + // + // For targets like MUSL or Emscripten, however, there is no support for + // dynamic libraries so we just go back to building a normal library. Note, + // however, that for MUSL if the library is built with `force_host` then + // it's ok to be a dylib as the host should always support dylibs. + Some("lib") + } else { + Some("dylib") + }; + + if let Some(crate_type) = crate_type { + aux_rustc.args(&["--crate-type", crate_type]); + } + + aux_rustc.arg("-L").arg(&aux_dir); + + let auxres = aux_cx.compose_and_run( + aux_rustc, + aux_cx.config.compile_lib_path.to_str().unwrap(), + Some(aux_dir.to_str().unwrap()), + None, + ); + if !auxres.status.success() { + test_cx.fatal_proc_rec( + &format!( + "auxiliary build of {:?} failed to compile: ", + aux_testpaths.file.display() + ), + &auxres, + ); + } +} + struct ProcArgs { prog: String, args: Vec, From 1beca8328197cbaedb4b1e39028c15bcee4c9872 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 7 Sep 2018 05:23:40 +0000 Subject: [PATCH 07/14] expose fields --- src/tools/compiletest/src/header.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 68523f24cca11..f85c67c56e315 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -838,8 +838,8 @@ fn test_parse_name_value_directive() { #[derive(Clone, Debug, PartialEq)] pub struct KeyValue { - key: String, - value: String, + pub key: String, + pub value: String, } #[test] From bd0280a99dc790992450a3dccc74d0d5a0047fb2 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 7 Sep 2018 05:35:20 +0000 Subject: [PATCH 08/14] compile aux_crates before compiling the test --- src/tools/compiletest/src/runtest.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index c3e0785b69860..dfe06814ed65d 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1566,6 +1566,10 @@ impl<'test> TestCx<'test> { build_auxiliary(self, rel_ab, &aux_dir); } + for rel_ab in &self.props.aux_crates { + build_auxiliary(self, &rel_ab.value, &aux_dir); + } + rustc.envs(self.props.rustc_env.clone()); self.compose_and_run( rustc, From 4b0cbefd58e568baeecaca1c6c23e9aba828f449 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 7 Sep 2018 05:39:18 +0000 Subject: [PATCH 09/14] pass down desired crate name to rustc --- src/tools/compiletest/src/runtest.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index dfe06814ed65d..99755c1797113 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1571,6 +1571,11 @@ impl<'test> TestCx<'test> { } rustc.envs(self.props.rustc_env.clone()); + + for aux_crate in &self.props.aux_crates { + rustc.arg(format!("--extern {}={}", aux_crate.key, aux_crate.value)); + } + self.compose_and_run( rustc, self.config.compile_lib_path.to_str().unwrap(), From e5523192e1cd7137023cf2be1b869aec7cc5f1e7 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 7 Sep 2018 05:41:37 +0000 Subject: [PATCH 10/14] add tests --- src/test/ui/auxiliary/baz.rs | 13 +++++++++++++ src/test/ui/issue-53737.rs | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/test/ui/auxiliary/baz.rs create mode 100644 src/test/ui/issue-53737.rs diff --git a/src/test/ui/auxiliary/baz.rs b/src/test/ui/auxiliary/baz.rs new file mode 100644 index 0000000000000..80bf1f2108adc --- /dev/null +++ b/src/test/ui/auxiliary/baz.rs @@ -0,0 +1,13 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub struct Yellow; diff --git a/src/test/ui/issue-53737.rs b/src/test/ui/issue-53737.rs new file mode 100644 index 0000000000000..5578afa33a834 --- /dev/null +++ b/src/test/ui/issue-53737.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-crate:myfoo=baz.rs +// edition:2018 + + +use myfoo::Yellow; + +fn main() { + let x = Yellow{}; +} From b982ecf5f0fb7536d1c7018c4d71537b281a7c6b Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 7 Sep 2018 06:01:34 +0000 Subject: [PATCH 11/14] tidy up --- src/tools/compiletest/src/header.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index f85c67c56e315..8ffc79e6c77d3 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -832,7 +832,8 @@ pub fn lldb_version_to_int(version_string: &str) -> isize { #[test] fn test_parse_name_value_directive() { - assert_eq!(Some("foo.rs".to_owned()), internal_parse_name_value_directive("aux-build:foo.rs", "aux-build")); + assert_eq!(Some("foo.rs".to_owned()), + internal_parse_name_value_directive("aux-build:foo.rs", "aux-build")); assert_eq!(None, internal_parse_name_value_directive("faux-build:foo.rs", "aux-build")); } From 99e569957011b76dd58824cab539d5c65b80f685 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Sat, 8 Sep 2018 03:58:04 +0000 Subject: [PATCH 12/14] port extern-prelude test to aux-crate this still doesn't have the definitive answer, but at least is a working start . --- .../use-suggestions-rust-2018/Makefile | 7 ------- .../rust-2018/auxiliary}/ep-nested-lib.rs | 2 +- .../rust-2018/use-suggestions-extern-prelude.rs} | 6 +++++- .../rust-2018/use-suggestions-extern-prelude.stderr | 13 +++++++++++++ src/tools/compiletest/src/runtest.rs | 3 ++- 5 files changed, 21 insertions(+), 10 deletions(-) delete mode 100644 src/test/run-make-fulldeps/use-suggestions-rust-2018/Makefile rename src/test/{run-make-fulldeps/use-suggestions-rust-2018 => ui/rust-2018/auxiliary}/ep-nested-lib.rs (95%) rename src/test/{run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs => ui/rust-2018/use-suggestions-extern-prelude.rs} (75%) create mode 100644 src/test/ui/rust-2018/use-suggestions-extern-prelude.stderr diff --git a/src/test/run-make-fulldeps/use-suggestions-rust-2018/Makefile b/src/test/run-make-fulldeps/use-suggestions-rust-2018/Makefile deleted file mode 100644 index fc39691c507e0..0000000000000 --- a/src/test/run-make-fulldeps/use-suggestions-rust-2018/Makefile +++ /dev/null @@ -1,7 +0,0 @@ --include ../tools.mk - -all: - $(RUSTC) ep-nested-lib.rs - - $(RUSTC) use-suggestions.rs --edition=2018 --extern ep_nested_lib=$(TMPDIR)/libep_nested_lib.rlib 2>&1 | $(CGREP) "use ep_nested_lib::foo::bar::Baz" - diff --git a/src/test/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs b/src/test/ui/rust-2018/auxiliary/ep-nested-lib.rs similarity index 95% rename from src/test/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs rename to src/test/ui/rust-2018/auxiliary/ep-nested-lib.rs index c0bce6e3371d0..2c741e70238ec 100644 --- a/src/test/run-make-fulldeps/use-suggestions-rust-2018/ep-nested-lib.rs +++ b/src/test/ui/rust-2018/auxiliary/ep-nested-lib.rs @@ -12,6 +12,6 @@ pub mod foo { pub mod bar { - pub struct Baz; + pub struct Bazz; } } diff --git a/src/test/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs b/src/test/ui/rust-2018/use-suggestions-extern-prelude.rs similarity index 75% rename from src/test/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs rename to src/test/ui/rust-2018/use-suggestions-extern-prelude.rs index 62730a5653f32..3f80cc305f770 100644 --- a/src/test/run-make-fulldeps/use-suggestions-rust-2018/use-suggestions.rs +++ b/src/test/ui/rust-2018/use-suggestions-extern-prelude.rs @@ -8,6 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// edition:2018 +// aux-crate:netted=ep-nested-lib.rs + fn main() { - let x = Baz{}; + let _x = Bazz{}; + //~^ ERROR cannot find struct, variant or union type `Bazz` in this scope } diff --git a/src/test/ui/rust-2018/use-suggestions-extern-prelude.stderr b/src/test/ui/rust-2018/use-suggestions-extern-prelude.stderr new file mode 100644 index 0000000000000..755b24b676a59 --- /dev/null +++ b/src/test/ui/rust-2018/use-suggestions-extern-prelude.stderr @@ -0,0 +1,13 @@ +error[E0422]: cannot find struct, variant or union type `Bazz` in this scope + --> $DIR/use-suggestions-extern-prelude.rs:15:14 + | +LL | let _x = Bazz{}; + | ^^^^ not found in this scope +help: possible candidate is found in another module, you can import it into scope + | +LL | use netted::foo::bar::Bazz; + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0422`. diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 99755c1797113..a82f63d3df243 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1573,7 +1573,8 @@ impl<'test> TestCx<'test> { rustc.envs(self.props.rustc_env.clone()); for aux_crate in &self.props.aux_crates { - rustc.arg(format!("--extern {}={}", aux_crate.key, aux_crate.value)); + rustc.arg("--extern"); + rustc.arg(format!("{}={}/lib{}", aux_crate.key, aux_dir.display(), &aux_crate.value.replace(".rs", ".so").replace("-","_"))); } self.compose_and_run( From 7dd0e3858304a668422a8a481af238c6f62a1884 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Sat, 8 Sep 2018 04:41:40 +0000 Subject: [PATCH 13/14] tidy up --- src/tools/compiletest/src/runtest.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a82f63d3df243..2826ef5592a8f 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1574,7 +1574,10 @@ impl<'test> TestCx<'test> { for aux_crate in &self.props.aux_crates { rustc.arg("--extern"); - rustc.arg(format!("{}={}/lib{}", aux_crate.key, aux_dir.display(), &aux_crate.value.replace(".rs", ".so").replace("-","_"))); + rustc.arg(format!("{}={}/lib{}", + aux_crate.key, + aux_dir.display(), + &aux_crate.value.replace(".rs", ".so").replace("-","_"))); } self.compose_and_run( From 90132e022a296ab0c01debd7c06a4c4c55f8ddc9 Mon Sep 17 00:00:00 2001 From: Douglas Campos Date: Fri, 19 Oct 2018 18:24:45 +0000 Subject: [PATCH 14/14] try to make this cross-platform safe --- src/tools/compiletest/src/runtest.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 2826ef5592a8f..efd3d0aff140c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -36,6 +36,7 @@ use std::io::{self, BufReader}; use std::path::{Path, PathBuf}; use std::process::{Child, Command, ExitStatus, Output, Stdio}; use std::str; +use std::env::consts::DLL_EXTENSION; use extract_gdb_version; use is_android_gdb_target; @@ -1577,7 +1578,9 @@ impl<'test> TestCx<'test> { rustc.arg(format!("{}={}/lib{}", aux_crate.key, aux_dir.display(), - &aux_crate.value.replace(".rs", ".so").replace("-","_"))); + aux_crate.value.replace(".rs", &format!(".{}", DLL_EXTENSION)) + .replace("-","_") + )); } self.compose_and_run(