diff options
| author | Florian Schmiderer <florian.schmiderer@posteo.net> | 2023-09-17 14:40:22 +0200 |
|---|---|---|
| committer | Florian Schmiderer <florian.schmiderer@posteo.net> | 2023-09-24 21:11:37 +0200 |
| commit | 3409ca65d835b858d9cefbe8949552f0f5ad0788 (patch) | |
| tree | 4c29f7080246e3db1671791ee5befdbac89fc9b4 /compiler/rustc_data_structures/src/small_c_str.rs | |
| parent | fc61fabc24b94755bb33517a81e81d9981c992ab (diff) | |
| download | rust-3409ca65d835b858d9cefbe8949552f0f5ad0788.tar.gz rust-3409ca65d835b858d9cefbe8949552f0f5ad0788.zip | |
Add OwnedTargetMachine to manage llvm:TargetMachine. Uses pointers
instead of &'static mut and provides safe interface to create/dispose it.
Diffstat (limited to 'compiler/rustc_data_structures/src/small_c_str.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/small_c_str.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/small_c_str.rs b/compiler/rustc_data_structures/src/small_c_str.rs index 719e4e3d974..349fd7f9769 100644 --- a/compiler/rustc_data_structures/src/small_c_str.rs +++ b/compiler/rustc_data_structures/src/small_c_str.rs @@ -79,3 +79,9 @@ impl<'a> FromIterator<&'a str> for SmallCStr { Self { data } } } + +impl From<&ffi::CStr> for SmallCStr { + fn from(s: &ffi::CStr) -> Self { + Self { data: SmallVec::from_slice(s.to_bytes()) } + } +} |
