about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAustin Bonander <austin.bonander@gmail.com>2017-03-16 14:41:08 -0700
committerPeter Atashian <retep998@gmail.com>2017-03-21 16:34:56 -0400
commit8a6ef505750152cf9034dfe26858b241221a3400 (patch)
tree20908529966770a1968dad7e1bc10d1c20b91758
parenta906d9912b32dd8c4d56b7dd61f48fd1ec0ceb63 (diff)
downloadrust-8a6ef505750152cf9034dfe26858b241221a3400.tar.gz
rust-8a6ef505750152cf9034dfe26858b241221a3400.zip
Regression test for rust-lang/rust#40535
-rw-r--r--src/test/run-make/issue-40535/Makefile11
-rw-r--r--src/test/run-make/issue-40535/bar.rs13
-rw-r--r--src/test/run-make/issue-40535/baz.rs11
-rw-r--r--src/test/run-make/issue-40535/foo.rs14
4 files changed, 49 insertions, 0 deletions
diff --git a/src/test/run-make/issue-40535/Makefile b/src/test/run-make/issue-40535/Makefile
new file mode 100644
index 00000000000..7d513a86a7f
--- /dev/null
+++ b/src/test/run-make/issue-40535/Makefile
@@ -0,0 +1,11 @@
+# The ICE occurred in the following situation:
+# * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`)
+# * `bar` declares and depends on `extern crate baz`
+# * All crates built in metadata-only mode (`cargo check`)
+all:
+	# cc https://github.com/rust-lang/rust/issues/40623
+	$(RUSTC) baz.rs --emit=metadata --out-dir=$(TMPDIR)
+	$(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta --out-dir=$(TMPDIR)
+	$(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta --out-dir=$(TMPDIR) 2>&1 | \
+	grep -vq "unexpectedly panicked"
+	# ^ Succeeds if it doesn't find the ICE message
diff --git a/src/test/run-make/issue-40535/bar.rs b/src/test/run-make/issue-40535/bar.rs
new file mode 100644
index 00000000000..4c22f181975
--- /dev/null
+++ b/src/test/run-make/issue-40535/bar.rs
@@ -0,0 +1,13 @@
+// Copyright 2017 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.
+
+#![crate_type = "lib"]
+
+extern crate baz;
diff --git a/src/test/run-make/issue-40535/baz.rs b/src/test/run-make/issue-40535/baz.rs
new file mode 100644
index 00000000000..737a918a039
--- /dev/null
+++ b/src/test/run-make/issue-40535/baz.rs
@@ -0,0 +1,11 @@
+// Copyright 2017 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.
+
+#![crate_type = "lib"]
diff --git a/src/test/run-make/issue-40535/foo.rs b/src/test/run-make/issue-40535/foo.rs
new file mode 100644
index 00000000000..53a8c8636b1
--- /dev/null
+++ b/src/test/run-make/issue-40535/foo.rs
@@ -0,0 +1,14 @@
+// Copyright 2017 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.
+
+#![crate_type = "lib"]
+
+extern crate bar;
+extern crate baz;