From 9a15c392db4bfa66fc1bd2c578d5072b8152b610 Mon Sep 17 00:00:00 2001
From: Adam Mulvany <amulvany@gitlab.com>
Date: Tue, 9 Jul 2024 13:07:39 +1000
Subject: [PATCH 1/4] Updating lints page to reflect recent changes

---
 src/doc/rustc/src/lints/index.md | 37 ++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/doc/rustc/src/lints/index.md b/src/doc/rustc/src/lints/index.md
index 029c9edc1b5fe..4fa91ea654341 100644
--- a/src/doc/rustc/src/lints/index.md
+++ b/src/doc/rustc/src/lints/index.md
@@ -39,19 +39,34 @@ provides detailed information and an opportunity for feedback. This gives
 users some time to fix the code to accommodate the change. After some time,
 the warning may become an error.
 
-The following is an example of what a future-incompatible looks like:
+The following is an example of what future-incompatible code looks like:
+
+```rust
+#[repr(packed)]
+struct Packed {
+    f1: u8,
+    f2: u16,
+}
+
+fn main() {
+    let packed = Packed { f1: 1, f2: 2 };
+    let _ = &packed.f2; // This line triggers the warning
+}
+```
+
+This code would produce a warning like:
 
 ```text
-warning: borrow of packed field is unsafe and requires unsafe function or block (error E0133)
-  --> lint_example.rs:11:13
-   |
-11 |     let y = &x.data.0;
-   |             ^^^^^^^^^
-   |
-   = note: `#[warn(safe_packed_borrows)]` on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #46043 <https://github.com/rust-lang/rust/issues/46043>
-   = note: fields of packed structs might be misaligned: dereferencing a misaligned pointer or even just creating a misaligned reference is undefined behavior
+warning: reference to packed field is unaligned
+ --> src/main.rs:8:13
+  |
+8 |     let _ = &packed.f2;
+  |             ^^^^^^^^^^
+  |
+  = note: `#[warn(unaligned_references)]` on by default
+  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+  = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
+  = help: copy the field contents to a local variable, or use `core::ptr::addr_of!` to create a reference that is guaranteed to be aligned
 ```
 
 For more information about the process and policy of future-incompatible

From 3638ad02ac33e5d364a30b15f3bb0794f98e5531 Mon Sep 17 00:00:00 2001
From: Adam Mulvany <amulvany@gitlab.com>
Date: Tue, 9 Jul 2024 13:14:01 +1000
Subject: [PATCH 2/4] Updating lints page to reflect recent changes

---
 src/doc/rustc/src/lints/index.md | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/doc/rustc/src/lints/index.md b/src/doc/rustc/src/lints/index.md
index 4fa91ea654341..9bfa5584abbb7 100644
--- a/src/doc/rustc/src/lints/index.md
+++ b/src/doc/rustc/src/lints/index.md
@@ -57,16 +57,16 @@ fn main() {
 This code would produce a warning like:
 
 ```text
-warning: reference to packed field is unaligned
- --> src/main.rs:8:13
+error[E0793]: reference to packed field is unaligned
+ --> src/main.rs:9:13
   |
-8 |     let _ = &packed.f2;
+9 |     let _ = &packed.f2; // This line triggers the warning
   |             ^^^^^^^^^^
   |
-  = note: `#[warn(unaligned_references)]` on by default
-  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-  = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
-  = help: copy the field contents to a local variable, or use `core::ptr::addr_of!` to create a reference that is guaranteed to be aligned
+  = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
+  = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+  = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
 ```
 
 For more information about the process and policy of future-incompatible

From 952e4642db818c7282cb5e56221cfd4cd16bf205 Mon Sep 17 00:00:00 2001
From: Adam Mulvany <amulvany@gitlab.com>
Date: Tue, 9 Jul 2024 14:51:34 +1000
Subject: [PATCH 3/4] Updating lints page to reflect recent changes

---
 src/doc/rustc/src/lints/index.md | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/doc/rustc/src/lints/index.md b/src/doc/rustc/src/lints/index.md
index 9bfa5584abbb7..c84a35c871dd6 100644
--- a/src/doc/rustc/src/lints/index.md
+++ b/src/doc/rustc/src/lints/index.md
@@ -41,7 +41,8 @@ the warning may become an error.
 
 The following is an example of what future-incompatible code looks like:
 
-```rust
+```bash
+$ cat main.rs
 #[repr(packed)]
 struct Packed {
     f1: u8,
@@ -52,11 +53,9 @@ fn main() {
     let packed = Packed { f1: 1, f2: 2 };
     let _ = &packed.f2; // This line triggers the warning
 }
-```
 
-This code would produce a warning like:
+$ rustc main.rs
 
-```text
 error[E0793]: reference to packed field is unaligned
  --> src/main.rs:9:13
   |
@@ -66,7 +65,6 @@ error[E0793]: reference to packed field is unaligned
   = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
   = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
   = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
-
 ```
 
 For more information about the process and policy of future-incompatible

From 18652477c31acb61f1909246278e656b4888c670 Mon Sep 17 00:00:00 2001
From: Adam Mulvany <amulvany@gitlab.com>
Date: Wed, 10 Jul 2024 08:42:04 +1000
Subject: [PATCH 4/4] example future incompat instead of error

---
 src/doc/rustc/src/lints/index.md | 42 ++++++++++++++++++--------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/src/doc/rustc/src/lints/index.md b/src/doc/rustc/src/lints/index.md
index c84a35c871dd6..0566bf631cf9e 100644
--- a/src/doc/rustc/src/lints/index.md
+++ b/src/doc/rustc/src/lints/index.md
@@ -41,30 +41,36 @@ the warning may become an error.
 
 The following is an example of what future-incompatible code looks like:
 
-```bash
-$ cat main.rs
-#[repr(packed)]
-struct Packed {
-    f1: u8,
-    f2: u16,
+```rust,compile_fail
+#![allow(unused)]
+enum E {
+    A,
+}
+impl Drop for E {
+    fn drop(&mut self) {
+        println!("Drop");
+    }
 }
 
+#[allow(cenum_impl_drop_cast)]
 fn main() {
-    let packed = Packed { f1: 1, f2: 2 };
-    let _ = &packed.f2; // This line triggers the warning
+    let e = E::A;
+    let i = e as u32;
 }
+```
 
-$ rustc main.rs
+This will produce the following warning:
 
-error[E0793]: reference to packed field is unaligned
- --> src/main.rs:9:13
-  |
-9 |     let _ = &packed.f2; // This line triggers the warning
-  |             ^^^^^^^^^^
-  |
-  = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
-  = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
-  = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+```text
+> warning: cannot cast enum `E` into integer `u32` because it implements `Drop`
+>   --> src/main.rs:14:13
+>    |
+> 14 |     let i = e as u32;
+>    |             ^^^^^^^^
+>    |
+>    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+>    = note: for more information, see issue #73333 <https://github.com/rust-lang/rust/issues/73333>
+> 
 ```
 
 For more information about the process and policy of future-incompatible