about summary refs log tree commit diff
path: root/tests/ui/offset-of/offset-of-tuple-field.rs
diff options
context:
space:
mode:
authorThe rustc-josh-sync Cronjob Bot <github-actions@github.com>2025-07-31 04:20:38 +0000
committerThe rustc-josh-sync Cronjob Bot <github-actions@github.com>2025-07-31 04:20:38 +0000
commit49aa0ecc7b251003e61c38a56471195a2d3dabee (patch)
tree8e45b6d6c87793c20c7254621a3bbe501d4ac718 /tests/ui/offset-of/offset-of-tuple-field.rs
parent8926d9cc0325f87dfc1959043097204bca49a1d9 (diff)
parent32e7a4b92b109c24e9822c862a7c74436b50e564 (diff)
downloadrust-49aa0ecc7b251003e61c38a56471195a2d3dabee.tar.gz
rust-49aa0ecc7b251003e61c38a56471195a2d3dabee.zip
Merge ref '32e7a4b92b10' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: 32e7a4b92b109c24e9822c862a7c74436b50e564
Filtered ref: 56d8aa13f54944edb711f3bdd7013b082dbaa65b

This merge was created using https://github.com/rust-lang/josh-sync.
Diffstat (limited to 'tests/ui/offset-of/offset-of-tuple-field.rs')
-rw-r--r--tests/ui/offset-of/offset-of-tuple-field.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/offset-of/offset-of-tuple-field.rs b/tests/ui/offset-of/offset-of-tuple-field.rs
new file mode 100644
index 00000000000..02d41f91a25
--- /dev/null
+++ b/tests/ui/offset-of/offset-of-tuple-field.rs
@@ -0,0 +1,22 @@
+#![feature(builtin_syntax)]
+
+use std::mem::offset_of;
+
+fn main() {
+    offset_of!((u8, u8), _0); //~ ERROR no field `_0`
+    offset_of!((u8, u8), 01); //~ ERROR no field `01`
+    offset_of!((u8, u8), 1e2); //~ ERROR no field `1e2`
+    offset_of!((u8, u8), 1_u8); //~ ERROR no field `1_`
+    //~| ERROR suffixes on a tuple index
+
+    builtin # offset_of((u8, u8), 1e2); //~ ERROR no field `1e2`
+    builtin # offset_of((u8, u8), _0); //~ ERROR no field `_0`
+    builtin # offset_of((u8, u8), 01); //~ ERROR no field `01`
+    builtin # offset_of((u8, u8), 1_u8); //~ ERROR no field `1_`
+    //~| ERROR suffixes on a tuple index
+
+    offset_of!(((u8, u16), (u32, u16, u8)), 0.2); //~ ERROR no field `2`
+    offset_of!(((u8, u16), (u32, u16, u8)), 0.1e2); //~ ERROR no field `1e2`
+    offset_of!(((u8, u16), (u32, u16, u8)), 1.2);
+    offset_of!(((u8, u16), (u32, u16, u8)), 1.2.0); //~ ERROR no field `0`
+}