File: repr-align.rs

package info (click to toggle)
rustc-web 1.70.0%2Bdfsg1-7~deb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,517,048 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,006; asm: 2,856
file content (33 lines) | stat: -rw-r--r-- 1,369 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![allow(dead_code)]

#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
                     //~| ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
struct S0(i32);

#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
                   //~| ERROR: invalid `repr(align)` attribute: not a power of two
struct S1(i32);

#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
                           //~| ERROR: invalid `repr(align)` attribute: larger than 2^29
struct S2(i32);

#[repr(align(536870912))] // ok: this is the largest accepted alignment
struct S3(i32);

#[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
                     //~| ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
enum E0 { A, B }

#[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
                   //~| ERROR: invalid `repr(align)` attribute: not a power of two
enum E1 { A, B }

#[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
                           //~| ERROR: invalid `repr(align)` attribute: larger than 2^29
enum E2 { A, B }

#[repr(align(536870912))] // ok: this is the largest accepted alignment
enum E3 { A, B }

fn main() {}