2
2
3
3
## Introduction
4
4
5
- This discussion is meant to focus on two things:
5
+ This discussion is meant to focus on the following things:
6
6
7
7
- What guarantees does Rust make regarding the layout of data structures?
8
8
- What guarantees does Rust make regarding ABI compatibility?
@@ -92,6 +92,8 @@ As an example, a value of `&T` type can never be null -- therefore,
92
92
say that they will have the same layout?
93
93
- or do we have the freedom to rearrange the types of ` A ` but not
94
94
` B ` , e.g. based on PGO results
95
+ - What about different instantiations of the same struct? (` Vec<A> `
96
+ vs ` Vec<B> ` )
95
97
- Rust currently says that no single value may be larger than ` isize ` bytes
96
98
- is this good? can it be changed? does it matter * here* anyway?
97
99
@@ -102,6 +104,9 @@ To start, we will create threads for each major categories of types
102
104
103
105
- Integers and floating points
104
106
- What about uninitialized values?
107
+ - What about signaling NaN etc? ([ Seems like a
108
+ non-issue] ( https://github.com/rust-lang/rust/issues/40470#issuecomment-343803381 ) ,
109
+ but it'd be good to resummarize the details).
105
110
- Booleans
106
111
- Prior discussions ([ #46156 ] [ ] , [ #46176 ] [ ] ) documented bool as a single
107
112
byte that is either 0 or 1.
@@ -118,12 +123,25 @@ To start, we will create threads for each major categories of types
118
123
(and/or treated by the ABI)?
119
124
- e.g., what about different structs with same definition
120
125
- across executions of the same program?
126
+ - For example, [ rkruppe
127
+ writes] ( https://github.com/rust-rfcs/unsafe-code-guidelines/pull/5#discussion_r212776247 )
128
+ that we might "want to guarantee (some subset of) newtype
129
+ unpacking and relegate repr(transparent) to being the way to
130
+ guarantee to other crates that a type with private fields is and
131
+ will remain a newtype?"
121
132
- Tuples
122
133
- Are these effectively anonymous structs?
123
134
- Unions
124
135
- Can we ever say anything about the initialized contents of a union?
125
136
- Is ` #[repr(C)] ` meaningful on a union?
137
+ - When (if ever) do we guarantee that all fields have the same address?
126
138
- Fn pointers (` fn() ` , ` extern "C" fn() ` )
139
+ - When is transmuting from one ` fn ` type to another allowed?
140
+ - Can you transmute from a ` fn ` to ` usize ` or raw pointer?
141
+ - In theory this is platform dependent, and C certainly draws a
142
+ distinction between ` void* ` and a function pointer, but are
143
+ there any modern and/or realisic platforms where it is an
144
+ issue?
127
145
- References ` &T ` and ` &mut T `
128
146
- Out of scope: aliasing rules
129
147
- We currently tell LLVM they are aligned and dereferenceable, have to justify that
0 commit comments