about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorIbraheem Ahmed <ibraheem@ibraheem.ca>2022-01-22 15:47:02 -0500
committerIbraheem Ahmed <ibraheem@ibraheem.ca>2022-01-22 15:48:45 -0500
commit32ab0b88f4248c612cb795d1f02d0030e30f57b5 (patch)
tree3c1c90a973d2cf04399ae4aeca666a255c8f7501 /src/test
parentcbaeec14f90b59a91a6b0f17fc046c66fa811892 (diff)
downloadrust-32ab0b88f4248c612cb795d1f02d0030e30f57b5.tar.gz
rust-32ab0b88f4248c612cb795d1f02d0030e30f57b5.zip
respect doc(hidden) when suggesting available fields
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs24
-rw-r--r--src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr19
2 files changed, 43 insertions, 0 deletions
diff --git a/src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs b/src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs
new file mode 100644
index 00000000000..0efc7daa3e1
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.rs
@@ -0,0 +1,24 @@
+#[derive(Default)]
+pub struct A {
+    #[doc(hidden)]
+    pub hello: i32,
+    pub bye: i32,
+}
+
+#[derive(Default)]
+pub struct B {
+    pub hello: i32,
+    pub bye: i32,
+}
+
+fn main() {
+    A::default().hey;
+    //~^ ERROR no field `hey` on type `A`
+    //~| NOTE unknown field
+    //~| NOTE available fields are: `bye`
+
+    B::default().hey;
+    //~^ ERROR no field `hey` on type `B`
+    //~| NOTE unknown field
+    //~| NOTE available fields are: `hello`, `bye`
+}
diff --git a/src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr b/src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr
new file mode 100644
index 00000000000..784986d3b95
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-93210-ignore-doc-hidden.stderr
@@ -0,0 +1,19 @@
+error[E0609]: no field `hey` on type `A`
+  --> $DIR/issue-93210-ignore-doc-hidden.rs:15:18
+   |
+LL |     A::default().hey;
+   |                  ^^^ unknown field
+   |
+   = note: available fields are: `bye`
+
+error[E0609]: no field `hey` on type `B`
+  --> $DIR/issue-93210-ignore-doc-hidden.rs:20:18
+   |
+LL |     B::default().hey;
+   |                  ^^^ unknown field
+   |
+   = note: available fields are: `hello`, `bye`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0609`.