Rollup merge of #115425 - thechampagne:master, r=oli-obk

remove unnecessary heap allocation
This commit is contained in:
Matthias Krüger 2023-09-01 21:41:40 +02:00 committed by GitHub
commit cf24a9fdf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -367,7 +367,7 @@ impl<'a> LlvmArchiveBuilder<'a> {
match addition { match addition {
Addition::File { path, name_in_archive } => { Addition::File { path, name_in_archive } => {
let path = CString::new(path.to_str().unwrap())?; let path = CString::new(path.to_str().unwrap())?;
let name = CString::new(name_in_archive.clone())?; let name = CString::new(name_in_archive.as_bytes())?;
members.push(llvm::LLVMRustArchiveMemberNew( members.push(llvm::LLVMRustArchiveMemberNew(
path.as_ptr(), path.as_ptr(),
name.as_ptr(), name.as_ptr(),

View File

@ -441,7 +441,7 @@ fn thin_lto(
for (i, (name, buffer)) in modules.into_iter().enumerate() { for (i, (name, buffer)) in modules.into_iter().enumerate() {
info!("local module: {} - {}", i, name); info!("local module: {} - {}", i, name);
let cname = CString::new(name.clone()).unwrap(); let cname = CString::new(name.as_bytes()).unwrap();
thin_modules.push(llvm::ThinLTOModule { thin_modules.push(llvm::ThinLTOModule {
identifier: cname.as_ptr(), identifier: cname.as_ptr(),
data: buffer.data().as_ptr(), data: buffer.data().as_ptr(),