File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,13 @@ struct B {
56
56
then the struct is (strictly) only 18 bytes (but the alignment
57
57
requirements of ` u64 ` forces it to take up 24).
58
58
59
- ( Having an undefined layout does allow for possible security
59
+ Having an undefined layout does allow for possible security
60
60
improvements, like randomising struct fields, but this can trivially
61
- be done with a syntax extension that reorders them in the AST itself,
62
- and so is not part of this proposal.)
61
+ be done with a syntax extension that can be attached to a struct to
62
+ reorder the fields in the AST itself. That said, there may be benefits
63
+ from being able to randomise all structs in a program
64
+ automatically/for testing, effectively fuzzing code (especially
65
+ ` unsafe ` code).
63
66
64
67
Notably, Rust's ` enum ` s already have undefined layout, and provide the
65
68
` #[repr] ` attribute to control layout more precisely (specifically,
You can’t perform that action at this time.
0 commit comments