diff options
| author | Ralf Jung <post@ralfj.de> | 2019-06-24 23:15:37 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-07-07 09:32:36 +0200 |
| commit | 076a5cdc357a3a9e03850a745bee0b3f0db3d54f (patch) | |
| tree | cf6586f7d7aa2ce6f429fb1b18d4688678ff983e /src/librustc_codegen_llvm | |
| parent | f5b30211c8fe3acb93be9a748004ee835adaa6e4 (diff) | |
| download | rust-076a5cdc357a3a9e03850a745bee0b3f0db3d54f.tar.gz rust-076a5cdc357a3a9e03850a745bee0b3f0db3d54f.zip | |
format a bit
Diffstat (limited to 'src/librustc_codegen_llvm')
| -rw-r--r-- | src/librustc_codegen_llvm/metadata.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/metadata.rs b/src/librustc_codegen_llvm/metadata.rs index 9bddd29d2e8..cd725588811 100644 --- a/src/librustc_codegen_llvm/metadata.rs +++ b/src/librustc_codegen_llvm/metadata.rs @@ -69,11 +69,13 @@ fn search_meta_section<'a>(of: &'a ObjectFile, let mut name_buf = None; let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf); let name = name_buf.map_or( - "".to_string(), + String::new(), // We got a NULL ptr, ignore `name_len`. |buf| String::from_utf8( slice::from_raw_parts(buf.as_ptr() as *const u8, name_len as usize) - .to_vec()).unwrap()); + .to_vec() + ).unwrap() + ); debug!("get_metadata_section: name {}", name); if read_metadata_section_name(target) == name { let cbuf = llvm::LLVMGetSectionContents(si.llsi); |
