From 37bf97a0f9cc764a19dfcff21d62384b2445dcbc Mon Sep 17 00:00:00 2001 From: gentlefolk Date: Sun, 9 Feb 2014 22:29:21 -0500 Subject: Updated metadata::creader::resolve_crate_deps to use the correct span. Clarified error message when an external crate's dependency is missing. Closes #2404. --- src/test/run-make/missing-crate-dependency/Makefile | 9 +++++++++ src/test/run-make/missing-crate-dependency/crateA.rs | 12 ++++++++++++ src/test/run-make/missing-crate-dependency/crateB.rs | 11 +++++++++++ src/test/run-make/missing-crate-dependency/crateC.rs | 13 +++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 src/test/run-make/missing-crate-dependency/Makefile create mode 100644 src/test/run-make/missing-crate-dependency/crateA.rs create mode 100644 src/test/run-make/missing-crate-dependency/crateB.rs create mode 100644 src/test/run-make/missing-crate-dependency/crateC.rs (limited to 'src/test') diff --git a/src/test/run-make/missing-crate-dependency/Makefile b/src/test/run-make/missing-crate-dependency/Makefile new file mode 100644 index 00000000000..a470ee0a7c1 --- /dev/null +++ b/src/test/run-make/missing-crate-dependency/Makefile @@ -0,0 +1,9 @@ +-include ../tools.mk + +all: + $(RUSTC) --crate-type=rlib crateA.rs + $(RUSTC) --crate-type=rlib crateB.rs + rm $(TMPDIR)/$(call RLIB_GLOB,crateA) + # Ensure crateC fails to compile since dependency crateA is missing + $(RUSTC) crateC.rs 2>&1 | \ + grep "error: can't find crate for \`crateA\` which \`crateB\` depends on" diff --git a/src/test/run-make/missing-crate-dependency/crateA.rs b/src/test/run-make/missing-crate-dependency/crateA.rs new file mode 100644 index 00000000000..4e111f29e8a --- /dev/null +++ b/src/test/run-make/missing-crate-dependency/crateA.rs @@ -0,0 +1,12 @@ +// Copyright 2014 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. + +// Base crate +pub fn func() {} diff --git a/src/test/run-make/missing-crate-dependency/crateB.rs b/src/test/run-make/missing-crate-dependency/crateB.rs new file mode 100644 index 00000000000..bf55017c646 --- /dev/null +++ b/src/test/run-make/missing-crate-dependency/crateB.rs @@ -0,0 +1,11 @@ +// Copyright 2014 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. + +extern crate crateA; diff --git a/src/test/run-make/missing-crate-dependency/crateC.rs b/src/test/run-make/missing-crate-dependency/crateC.rs new file mode 100644 index 00000000000..174d9382b76 --- /dev/null +++ b/src/test/run-make/missing-crate-dependency/crateC.rs @@ -0,0 +1,13 @@ +// Copyright 2014 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. + +extern crate crateB; + +fn main() {} -- cgit 1.4.1-3-g733a5