about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-02-07 06:34:37 +0000
committerbors <bors@rust-lang.org>2015-02-07 06:34:37 +0000
commite62fec36b97882b2e24bddae41ee025a75688bd7 (patch)
treeeb43ee53ee5adc1a9bebeb8ff4f33749d6002341 /src/test
parent0b6dbbc9cfb747df1db646bba16561c022704056 (diff)
parent8e3df865cc02a1a968a82dbc80295ac566eb6be8 (diff)
downloadrust-e62fec36b97882b2e24bddae41ee025a75688bd7.tar.gz
rust-e62fec36b97882b2e24bddae41ee025a75688bd7.zip
Auto merge of #21978 - Potpourri:error-extern-crate-staticlib, r=alexcrichton
Add special error for this case and help message `please recompile this crate using --crate-type lib`, also list found candidates.

See issue #14416

r? @alexcrichton
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make/error-found-staticlib-instead-crate/Makefile5
-rw-r--r--src/test/run-make/error-found-staticlib-instead-crate/bar.rs15
-rw-r--r--src/test/run-make/error-found-staticlib-instead-crate/foo.rs11
3 files changed, 31 insertions, 0 deletions
diff --git a/src/test/run-make/error-found-staticlib-instead-crate/Makefile b/src/test/run-make/error-found-staticlib-instead-crate/Makefile
new file mode 100644
index 00000000000..46be2385636
--- /dev/null
+++ b/src/test/run-make/error-found-staticlib-instead-crate/Makefile
@@ -0,0 +1,5 @@
+-include ../tools.mk
+
+all:
+	$(RUSTC) foo.rs --crate-type staticlib
+	$(RUSTC) bar.rs 2>&1 | grep "error: found staticlib"
diff --git a/src/test/run-make/error-found-staticlib-instead-crate/bar.rs b/src/test/run-make/error-found-staticlib-instead-crate/bar.rs
new file mode 100644
index 00000000000..5ab3e5ee99d
--- /dev/null
+++ b/src/test/run-make/error-found-staticlib-instead-crate/bar.rs
@@ -0,0 +1,15 @@
+// Copyright 2015 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+extern crate foo;
+
+fn main() {
+    foo::foo();
+}
diff --git a/src/test/run-make/error-found-staticlib-instead-crate/foo.rs b/src/test/run-make/error-found-staticlib-instead-crate/foo.rs
new file mode 100644
index 00000000000..222d98a12de
--- /dev/null
+++ b/src/test/run-make/error-found-staticlib-instead-crate/foo.rs
@@ -0,0 +1,11 @@
+// Copyright 2015 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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub fn foo() {}