about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-16 18:09:10 +0200
committerGitHub <noreply@github.com>2024-07-16 18:09:10 +0200
commit73028fe48320766d5dd931394c2d7b17bed14646 (patch)
tree2cbed28bdaca67ac56f013fc05c2fd8614920264 /compiler/rustc_codegen_ssa/src
parent7409a5281de87e3e1f63fe3c05346fe8431147c4 (diff)
parent28503d69ac204ff208d115aea30dc09d6fca8728 (diff)
downloadrust-73028fe48320766d5dd931394c2d7b17bed14646.tar.gz
rust-73028fe48320766d5dd931394c2d7b17bed14646.zip
Rollup merge of #127730 - compiler-errors:ed-2024-unsafe, r=petrochenkov
Fix and enforce `unsafe_op_in_unsafe_fn` in compiler

In preparation for edition 2024, this PR previews the fallout of enabling the `unsafe_op_in_unsafe_fn` lint in the compiler, since it's defaulting to warn in the new edition (#112038).

The major annoyance comes primarily from the `rustc_codegen_llvm` module, where there's a ton of unsafe calls. I tended to wrap individual calls to unsafe fns in `unsafe {}`, but there a handful of places I chose to just wrap several calls in an `unsafe {}` block just because it would've been excessive to wrap each call individually.

This doesn't enable the lint for the standard library, since I'm not totally certain what T-libs prefers w/ this lint.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/lto.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/lto.rs b/compiler/rustc_codegen_ssa/src/back/lto.rs
index cb6244050df..5291cad148e 100644
--- a/compiler/rustc_codegen_ssa/src/back/lto.rs
+++ b/compiler/rustc_codegen_ssa/src/back/lto.rs
@@ -72,7 +72,7 @@ impl<B: WriteBackendMethods> LtoModuleCodegen<B> {
                 B::optimize_fat(cgcx, &mut module)?;
                 Ok(module)
             }
-            LtoModuleCodegen::Thin(thin) => B::optimize_thin(cgcx, thin),
+            LtoModuleCodegen::Thin(thin) => unsafe { B::optimize_thin(cgcx, thin) },
         }
     }