about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/mod.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-26 06:21:59 +0000
committerbors <bors@rust-lang.org>2025-02-26 06:21:59 +0000
commit2b3cef882aa9085db417837ac6152463060f1f8a (patch)
treef8ea08fdc6df4a7473059bfe532540f7d443ea69 /compiler/rustc_codegen_llvm/src/llvm/mod.rs
parenta46c755c6ad2c9543a836a1ca134178b2345acc2 (diff)
parent1bb43192a2024e6d3c3c16afc7d42554efdbef89 (diff)
downloadrust-2b3cef882aa9085db417837ac6152463060f1f8a.tar.gz
rust-2b3cef882aa9085db417837ac6152463060f1f8a.zip
Auto merge of #137651 - fmease:rollup-s3s7m6f, r=fmease
Rollup of 14 pull requests

Successful merges:

 - #136576 (pass optimization level to llvm-bitcode-linker)
 - #137154 (Add UTF-8 validation fast paths in `Wtf8Buf`)
 - #137311 (Enable `f16` for MIPS)
 - #137320 (fix(rustdoc): Fixed stability version in rustdoc)
 - #137529 (remove few unused args)
 - #137544 (tests: Add regression test for derive token invalidation (#81099))
 - #137559 (run some tests on emscripten again)
 - #137601 (ssa/mono: deduplicate `type_has_metadata`)
 - #137603 (codegen_llvm: avoid `Deref` impls w/ extern type)
 - #137604 (trait_sel: resolve vars in host effects)
 - #137609 (Complete the list of resources used in rustdoc output)
 - #137613 (hir_analysis: skip self type of host effect preds in variances_of)
 - #137614 (fix doc in library/core/src/pin.rs)
 - #137622 (fix attribute-related ICE when parsing macro on the rhs of a name-value attribute)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/mod.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/mod.rs21
1 files changed, 10 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
index 5ec93424131..a36226b25a2 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs
@@ -1,7 +1,6 @@
 #![allow(non_snake_case)]
 
 use std::ffi::{CStr, CString};
-use std::ops::Deref;
 use std::ptr;
 use std::str::FromStr;
 use std::string::FromUtf8Error;
@@ -355,6 +354,16 @@ impl<'a> OperandBundleOwned<'a> {
         };
         OperandBundleOwned { raw: ptr::NonNull::new(raw).unwrap() }
     }
+
+    /// Returns inner `OperandBundle` type.
+    ///
+    /// This could be a `Deref` implementation, but `OperandBundle` contains an extern type and
+    /// `Deref::Target: ?Sized`.
+    pub(crate) fn raw(&self) -> &OperandBundle<'a> {
+        // SAFETY: The returned reference is opaque and can only used for FFI.
+        // It is valid for as long as `&self` is.
+        unsafe { self.raw.as_ref() }
+    }
 }
 
 impl Drop for OperandBundleOwned<'_> {
@@ -365,16 +374,6 @@ impl Drop for OperandBundleOwned<'_> {
     }
 }
 
-impl<'a> Deref for OperandBundleOwned<'a> {
-    type Target = OperandBundle<'a>;
-
-    fn deref(&self) -> &Self::Target {
-        // SAFETY: The returned reference is opaque and can only used for FFI.
-        // It is valid for as long as `&self` is.
-        unsafe { self.raw.as_ref() }
-    }
-}
-
 pub(crate) fn add_module_flag_u32(
     module: &Module,
     merge_behavior: ModuleFlagMergeBehavior,