summaryrefslogtreecommitdiffstats
path: root/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs')
-rw-r--r--tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
new file mode 100644
index 000000000..6040f3f30
--- /dev/null
+++ b/tests/ui/did_you_mean/dont-suggest-doc-hidden-fields.rs
@@ -0,0 +1,38 @@
+// Regression test for issue #93210.
+
+// aux-crate:doc_hidden_fields=doc-hidden-fields.rs
+// edition: 2021
+
+#[derive(Default)]
+pub struct A {
+ #[doc(hidden)]
+ pub hello: i32,
+ pub bye: i32,
+}
+
+#[derive(Default)]
+pub struct C {
+ pub hello: i32,
+ pub bye: i32,
+}
+
+fn main() {
+ // We want to list the field `hello` despite being marked
+ // `doc(hidden)` because it's defined in this crate.
+ A::default().hey;
+ //~^ ERROR no field `hey` on type `A`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `hello`, `bye`
+
+ // Here we want to hide the field `hello` since it's marked
+ // `doc(hidden)` and comes from an external crate.
+ doc_hidden_fields::B::default().hey;
+ //~^ ERROR no field `hey` on type `B`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `bye`
+
+ C::default().hey;
+ //~^ ERROR no field `hey` on type `C`
+ //~| NOTE unknown field
+ //~| NOTE available fields are: `hello`, `bye`
+}