From 4b6eb0ff96022fd7323c6270f6ad7fa5973fa510 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 8 Jun 2021 10:32:26 +0900 Subject: [PATCH] Update some wording making reference to issues/RFCs --- src/exotic-sizes.md | 6 +++--- src/other-reprs.md | 7 ++++--- src/unchecked-uninit.md | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/exotic-sizes.md b/src/exotic-sizes.md index 6cbbf83..4357d80 100644 --- a/src/exotic-sizes.md +++ b/src/exotic-sizes.md @@ -172,10 +172,10 @@ of UB. There is [an accepted RFC][extern-types] to add proper types with an unknown size, called *extern types*, which would let Rust developers model things like C's `void*` and other "declared but never defined" types more accurately. However as of -Rust 2018, the feature is stuck in limbo over how `size_of::()` -should behave. +Rust 2018, [the feature is stuck in limbo over how `size_of_val::()` +should behave][extern-types-issue]. -[dst-issue]: https://github.com/rust-lang/rust/issues/26403 [extern-types]: https://github.com/rust-lang/rfcs/blob/master/text/1861-extern-types.md +[extern-types-issue]: https://github.com/rust-lang/rust/issues/43467 [`str`]: ../std/primitive.str.html [slice]: ../std/primitive.slice.html diff --git a/src/other-reprs.md b/src/other-reprs.md index 10f337b..c2eea41 100644 --- a/src/other-reprs.md +++ b/src/other-reprs.md @@ -15,7 +15,7 @@ reinterpreting values as a different type. We strongly recommend using [rust-bindgen][] and/or [cbindgen][] to manage your FFI boundaries for you. The Rust team works closely with those projects to ensure that they work robustly and are compatible with current and future guarantees -about type layouts and reprs. +about type layouts and `repr`s. The interaction of `repr(C)` with Rust's more exotic data layout features must be kept 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. Adding an explicit `repr` to an enum suppresses the null-pointer optimization. -These reprs have no effect on a struct. +These `repr`s have no effect on a struct. ## repr(packed) @@ -107,7 +107,8 @@ compiler might be able to paper over alignment issues with shifts and masks. However if you take a reference to a packed field, it's unlikely that the compiler will be able to emit code to avoid an unaligned load. -**[As of Rust 2018, this still can cause undefined behavior.][ub loads]** +[As this can cause undefined behavior][ub loads], the lint has been implemented +and it will become a hard error. `repr(packed)` is not to be used lightly. Unless you have extreme requirements, this should not be used. diff --git a/src/unchecked-uninit.md b/src/unchecked-uninit.md index e6df9cd..3c6913c 100644 --- a/src/unchecked-uninit.md +++ b/src/unchecked-uninit.md @@ -137,7 +137,7 @@ also cannot use `&mut base_ptr.field` as that would be creating a reference. Thus, it is currently not possible to create a raw pointer to a field of a partially initialized struct, and also not possible to initialize a single field of a partially initialized struct. (a -[solution to this problem](https://github.com/rust-lang/rfcs/pull/2582) is being +[solution to this problem](https://github.com/rust-lang/rust/issues/64490) is being worked on). One last remark: when reading old Rust code, you might stumble upon the