about summary refs log tree commit diff
path: root/tests/ui/structs/struct-field-access-errors-24365.rs
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2025-07-13 16:39:45 -0400
committerOneirical <manchot@videotron.ca>2025-08-10 11:54:15 -0400
commitaa543963c68061d9ca46037071d66a028626ff3f (patch)
tree2d6e7de7e1b2fe2176d81f48a456a05ef1b06dff /tests/ui/structs/struct-field-access-errors-24365.rs
parentf8e355c230c6eb7b78ffce6a92fd81f78c890524 (diff)
downloadrust-aa543963c68061d9ca46037071d66a028626ff3f.tar.gz
rust-aa543963c68061d9ca46037071d66a028626ff3f.zip
Rehome tests/ui/issues/ tests [4/?]
Diffstat (limited to 'tests/ui/structs/struct-field-access-errors-24365.rs')
-rw-r--r--tests/ui/structs/struct-field-access-errors-24365.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/structs/struct-field-access-errors-24365.rs b/tests/ui/structs/struct-field-access-errors-24365.rs
new file mode 100644
index 00000000000..13a95cd1cca
--- /dev/null
+++ b/tests/ui/structs/struct-field-access-errors-24365.rs
@@ -0,0 +1,20 @@
+// https://github.com/rust-lang/rust/issues/24365
+pub enum Attribute {
+    Code {attr_name_idx: u16},
+}
+
+pub enum Foo {
+    Bar
+}
+
+fn test(a: Foo) {
+    println!("{}", a.b); //~ ERROR no field `b` on type `Foo`
+}
+
+fn main() {
+    let x = Attribute::Code {
+        attr_name_idx: 42,
+    };
+    let z = (&x).attr_name_idx; //~ ERROR no field `attr_name_idx` on type `&Attribute`
+    let y = x.attr_name_idx; //~ ERROR no field `attr_name_idx` on type `Attribute`
+}