about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2021-09-27 16:28:38 +0900
committerTakayuki Maeda <takoyaki0316@gmail.com>2021-09-27 16:28:38 +0900
commit564cb87e270f70310e25ae9f459c642e949e8213 (patch)
tree2a6bc5fcbcd5b8294e07a2b3264d77bb8ff3f7f1 /src/test
parentb2804655f553022f8b7f2e8fcf4c1343b6ecf255 (diff)
downloadrust-564cb87e270f70310e25ae9f459c642e949e8213.tar.gz
rust-564cb87e270f70310e25ae9f459c642e949e8213.zip
suggest path for tuple struct
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/resolve/suggest-path-for-tuple-struct.rs26
-rw-r--r--src/test/ui/resolve/suggest-path-for-tuple-struct.stderr19
2 files changed, 45 insertions, 0 deletions
diff --git a/src/test/ui/resolve/suggest-path-for-tuple-struct.rs b/src/test/ui/resolve/suggest-path-for-tuple-struct.rs
new file mode 100644
index 00000000000..c8bc3e79fe2
--- /dev/null
+++ b/src/test/ui/resolve/suggest-path-for-tuple-struct.rs
@@ -0,0 +1,26 @@
+mod module {
+    pub struct SomeTupleStruct(u8);
+    pub struct SomeRegularStruct {
+        foo: u8
+    }
+
+    impl SomeTupleStruct {
+        pub fn new() -> Self {
+            Self(0)
+        }
+    }
+    impl SomeRegularStruct {
+        pub fn new() -> Self {
+            Self { foo: 0 }
+        }
+    }
+}
+
+use module::{SomeTupleStruct, SomeRegularStruct};
+
+fn main() {
+    let _ = SomeTupleStruct.new();
+    //~^ ERROR expected value, found struct `SomeTupleStruct`
+    let _ = SomeRegularStruct.new();
+    //~^ ERROR expected value, found struct `SomeRegularStruct`
+}
diff --git a/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr b/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr
new file mode 100644
index 00000000000..957045ca74b
--- /dev/null
+++ b/src/test/ui/resolve/suggest-path-for-tuple-struct.stderr
@@ -0,0 +1,19 @@
+error[E0423]: expected value, found struct `SomeTupleStruct`
+  --> $DIR/suggest-path-for-tuple-struct.rs:22:13
+   |
+LL |     let _ = SomeTupleStruct.new();
+   |             ^^^^^^^^^^^^^^^----
+   |             |
+   |             help: use the path separator to refer to an item: `SomeTupleStruct::new`
+
+error[E0423]: expected value, found struct `SomeRegularStruct`
+  --> $DIR/suggest-path-for-tuple-struct.rs:24:13
+   |
+LL |     let _ = SomeRegularStruct.new();
+   |             ^^^^^^^^^^^^^^^^^----
+   |             |
+   |             help: use the path separator to refer to an item: `SomeRegularStruct::new`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0423`.