diff options
| author | Laurențiu Nicola <lnicola@users.noreply.github.com> | 2024-11-28 06:54:16 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-28 06:54:16 +0000 |
| commit | 8cf30c235619f60c0a0f0a0779bd17e7e70bf0fb (patch) | |
| tree | 564950531f457ebbe2a114e486cb2c8c72bf9ed0 /compiler/rustc_codegen_llvm/src/llvm/mod.rs | |
| parent | 4e3354ef925d9711c125470097643236c3a983d0 (diff) | |
| parent | 1a435ed7edc19812c29006701b0106a0d0802542 (diff) | |
| download | rust-8cf30c235619f60c0a0f0a0779bd17e7e70bf0fb.tar.gz rust-8cf30c235619f60c0a0f0a0779bd17e7e70bf0fb.zip | |
Merge pull request #18566 from lnicola/sync-from-rust
minor: Sync from downstream
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/mod.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/mod.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/mod.rs b/compiler/rustc_codegen_llvm/src/llvm/mod.rs index 00a5cd3b859..909afe35a17 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/mod.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/mod.rs @@ -1,6 +1,5 @@ #![allow(non_snake_case)] -use std::cell::RefCell; use std::ffi::{CStr, CString}; use std::ops::Deref; use std::ptr; @@ -8,8 +7,8 @@ use std::str::FromStr; use std::string::FromUtf8Error; use libc::c_uint; +use rustc_abi::{Align, Size, WrappingRange}; use rustc_llvm::RustString; -use rustc_target::abi::{Align, Size, WrappingRange}; pub use self::AtomicRmwBinOp::*; pub use self::CallConv::*; @@ -301,15 +300,11 @@ pub fn set_value_name(value: &Value, name: &[u8]) { } pub fn build_string(f: impl FnOnce(&RustString)) -> Result<String, FromUtf8Error> { - let sr = RustString { bytes: RefCell::new(Vec::new()) }; - f(&sr); - String::from_utf8(sr.bytes.into_inner()) + String::from_utf8(RustString::build_byte_buffer(f)) } pub fn build_byte_buffer(f: impl FnOnce(&RustString)) -> Vec<u8> { - let sr = RustString { bytes: RefCell::new(Vec::new()) }; - f(&sr); - sr.bytes.into_inner() + RustString::build_byte_buffer(f) } pub fn twine_to_string(tr: &Twine) -> String { |
