about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCldfire <cldfire@3grid.net>2017-10-31 19:35:51 -0400
committerCldfire <cldfire@3grid.net>2017-10-31 19:35:51 -0400
commit61396a8286cde05bea720f5738eb939cc32b8d34 (patch)
tree948ff277f27762fe38a2fe568564d5172a8e99b8 /src
parentff832405d07d6c34ee060e26acf0aa6143b79d3f (diff)
downloadrust-61396a8286cde05bea720f5738eb939cc32b8d34.tar.gz
rust-61396a8286cde05bea720f5738eb939cc32b8d34.zip
Add UI test
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/suggestions/issue-32354-suggest-import-rename.rs22
-rw-r--r--src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr16
2 files changed, 38 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/issue-32354-suggest-import-rename.rs b/src/test/ui/suggestions/issue-32354-suggest-import-rename.rs
new file mode 100644
index 00000000000..51aba27498f
--- /dev/null
+++ b/src/test/ui/suggestions/issue-32354-suggest-import-rename.rs
@@ -0,0 +1,22 @@
+// 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.
+
+pub mod extension1 {
+    pub trait ConstructorExtension {}
+}
+
+pub mod extension2 {
+    pub trait ConstructorExtension {}
+}
+
+use extension1::ConstructorExtension;
+use extension2::ConstructorExtension;
+
+fn main() {}
diff --git a/src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr b/src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr
new file mode 100644
index 00000000000..07985191284
--- /dev/null
+++ b/src/test/ui/suggestions/issue-32354-suggest-import-rename.stderr
@@ -0,0 +1,16 @@
+error[E0252]: the name `ConstructorExtension` is defined multiple times
+  --> $DIR/issue-32354-suggest-import-rename.rs:20:5
+   |
+19 | use extension1::ConstructorExtension;
+   |     -------------------------------- previous import of the trait `ConstructorExtension` here
+20 | use extension2::ConstructorExtension;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ConstructorExtension` reimported here
+   |
+   = note: `ConstructorExtension` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+   |
+20 | use extension2::ConstructorExtension as OtherConstructorExtension;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+