summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-12 08:54:40 +0000
committerbors <bors@rust-lang.org>2015-05-12 08:54:40 +0000
commitfeac9f1c7b17903ef14ff46bc24c2baa45f3b15f (patch)
tree62cb271674ec185c4811344f8446fff893c6279e /src/test
parentf2e1a1b50eee3dd98bbd760d71ae7b5fce360165 (diff)
parentdb9d01842450fe07f77ca97d9a68d105366f407e (diff)
downloadrust-feac9f1c7b17903ef14ff46bc24c2baa45f3b15f.tar.gz
rust-feac9f1c7b17903ef14ff46bc24c2baa45f3b15f.zip
Auto merge of #24818 - tbelaire:double-import, r=nrc
This isn't quite right, but it's interesting.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/double-import.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/compile-fail/double-import.rs b/src/test/compile-fail/double-import.rs
new file mode 100644
index 00000000000..cbf13c0a559
--- /dev/null
+++ b/src/test/compile-fail/double-import.rs
@@ -0,0 +1,27 @@
+// 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.
+#![feature(no_std)]
+#![no_std]
+
+// This tests that conflicting imports shows both `use` lines
+// when reporting the error.
+
+mod sub1 {
+    fn foo() {} // implementation 1
+}
+
+mod sub2 {
+    fn foo() {} // implementation 2
+}
+
+use sub1::foo; //~ NOTE previous import of `foo` here
+use sub2::foo; //~ ERROR a value named `foo` has already been imported in this module [E0252]
+
+fn main() {}