File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -172,10 +172,10 @@ of UB.
172172There is [ an accepted RFC] [ extern-types ] to add proper types with an unknown size,
173173called * extern types* , which would let Rust developers model things like C's ` void* `
174174and other "declared but never defined" types more accurately. However as of
175- Rust 2018, the feature is stuck in limbo over how ` size_of ::<MyExternType>()`
176- should behave.
175+ Rust 2018, [ the feature is stuck in limbo over how ` size_of_val ::<MyExternType>()`
176+ should behave] [ extern-types-issue ] .
177177
178- [ dst-issue ] : https://github.com/rust-lang/rust/issues/26403
179178[ extern-types ] : https://github.com/rust-lang/rfcs/blob/master/text/1861-extern-types.md
179+ [ extern-types-issue ] : https://github.com/rust-lang/rust/issues/43467
180180[ `str` ] : ../std/primitive.str.html
181181[ slice ] : ../std/primitive.slice.html
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ reinterpreting values as a different type.
1515We strongly recommend using [ rust-bindgen] [ ] and/or [ cbindgen] [ ] to manage your FFI
1616boundaries for you. The Rust team works closely with those projects to ensure
1717that they work robustly and are compatible with current and future guarantees
18- about type layouts and reprs .
18+ about type layouts and ` repr ` s .
1919
2020The interaction of ` repr(C) ` with Rust's more exotic data layout features must be
2121kept in mind. Due to its dual purpose as "for FFI" and "for layout control",
@@ -92,7 +92,7 @@ manipulate its tag and fields. See [the RFC][really-tagged] for details.
9292Adding an explicit ` repr ` to an enum suppresses the null-pointer
9393optimization.
9494
95- These reprs have no effect on a struct.
95+ These ` repr ` s have no effect on a struct.
9696
9797## repr(packed)
9898
@@ -107,7 +107,8 @@ compiler might be able to paper over alignment issues with shifts and masks.
107107However if you take a reference to a packed field, it's unlikely that the
108108compiler will be able to emit code to avoid an unaligned load.
109109
110- ** [ As of Rust 2018, this still can cause undefined behavior.] [ ub loads ] **
110+ [ As this can cause undefined behavior] [ ub loads ] , the lint has been implemented
111+ and it will become a hard error.
111112
112113` repr(packed) ` is not to be used lightly. Unless you have extreme requirements,
113114this should not be used.
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ also cannot use `&mut base_ptr.field` as that would be creating a
137137reference. Thus, it is currently not possible to create a raw pointer to a field
138138of a partially initialized struct, and also not possible to initialize a single
139139field of a partially initialized struct. (a
140- [ solution to this problem] ( https://github.com/rust-lang/rfcs/pull/2582 ) is being
140+ [ solution to this problem] ( https://github.com/rust-lang/rust/issues/64490 ) is being
141141worked on).
142142
143143One last remark: when reading old Rust code, you might stumble upon the
You can’t perform that action at this time.
0 commit comments