summary refs log tree commit diff
path: root/tests/ui/attributes
diff options
context:
space:
mode:
authorJules Bertholet <julesbertholet@quoi.xyz>2025-06-29 14:33:51 -0400
committerJules Bertholet <julesbertholet@quoi.xyz>2025-07-06 16:56:42 -0400
commita144fd64bb339410806122c26da9e824a4a35a2a (patch)
tree570002cf983deb902602a6d6d353930e32602a4c /tests/ui/attributes
parentce8ab082cc327cf2064c0037fd39f2081397f9f6 (diff)
downloadrust-a144fd64bb339410806122c26da9e824a4a35a2a.tar.gz
rust-a144fd64bb339410806122c26da9e824a4a35a2a.zip
Add test for `dyn` alignment
Diffstat (limited to 'tests/ui/attributes')
-rw-r--r--tests/ui/attributes/fn-align-dyn.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/attributes/fn-align-dyn.rs b/tests/ui/attributes/fn-align-dyn.rs
new file mode 100644
index 00000000000..d67de05e7a9
--- /dev/null
+++ b/tests/ui/attributes/fn-align-dyn.rs
@@ -0,0 +1,15 @@
+//@ run-pass
+#![feature(fn_align)]
+
+trait Test {
+    #[align(4096)]
+    fn foo(&self);
+
+    #[align(4096)]
+    fn foo1(&self);
+}
+
+fn main() {
+    assert_eq!((<dyn Test>::foo as fn(_) as usize & !1) % 4096, 0);
+    assert_eq!((<dyn Test>::foo1 as fn(_) as usize & !1) % 4096, 0);
+}