about summary refs log tree commit diff
path: root/src/test/ui/resolve
diff options
context:
space:
mode:
authorSNCPlay42 <SNCPlay42@gmail.com>2021-04-11 23:44:54 +0100
committerSNCPlay42 <SNCPlay42@gmail.com>2021-04-11 23:44:54 +0100
commita3ee0bb7264aaf59a2906ea28755c96d21405a68 (patch)
tree04c72a31be99e831c6866f96bf9a2e005fca7399 /src/test/ui/resolve
parent7953910464e073eb3876d1544a3fd5b5ba0ca49b (diff)
detect when suggested paths enter extern crates more rigorously
Diffstat (limited to 'src/test/ui/resolve')
-rw-r--r--src/test/ui/resolve/auxiliary/issue-80079.rs18
-rw-r--r--src/test/ui/resolve/issue-80079.rs12
-rw-r--r--src/test/ui/resolve/issue-80079.stderr9
3 files changed, 39 insertions, 0 deletions
diff --git a/src/test/ui/resolve/auxiliary/issue-80079.rs b/src/test/ui/resolve/auxiliary/issue-80079.rs
new file mode 100644
index 00000000000..190ca75aba8
--- /dev/null
+++ b/src/test/ui/resolve/auxiliary/issue-80079.rs
@@ -0,0 +1,18 @@
+#![crate_type = "lib"]
+
+pub mod public {
+    use private_import;
+
+    // should not be suggested since it is private
+    struct Foo;
+
+    mod private_module {
+        // should not be suggested since it is private
+        pub struct Foo;
+    }
+}
+
+mod private_import {
+    // should not be suggested since it is private
+    pub struct Foo;
+}
diff --git a/src/test/ui/resolve/issue-80079.rs b/src/test/ui/resolve/issue-80079.rs
new file mode 100644
index 00000000000..4795ed062c8
--- /dev/null
+++ b/src/test/ui/resolve/issue-80079.rs
@@ -0,0 +1,12 @@
+// aux-build:issue-80079.rs
+
+// using a module from another crate should not cause errors to suggest private
+// items in that module
+
+extern crate issue_80079;
+
+use issue_80079::public;
+
+fn main() {
+    let _ = Foo; //~ ERROR cannot find value `Foo` in this scope
+}
diff --git a/src/test/ui/resolve/issue-80079.stderr b/src/test/ui/resolve/issue-80079.stderr
new file mode 100644
index 00000000000..93e8c0341a1
--- /dev/null
+++ b/src/test/ui/resolve/issue-80079.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `Foo` in this scope
+  --> $DIR/issue-80079.rs:11:13
+   |
+LL |     let _ = Foo;
+   |             ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.