Skip to content

Commit 076a5cd

Browse files
committed
format a bit
1 parent f5b3021 commit 076a5cd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/librustc_codegen_llvm/metadata.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ fn search_meta_section<'a>(of: &'a ObjectFile,
6969
let mut name_buf = None;
7070
let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
7171
let name = name_buf.map_or(
72-
"".to_string(),
72+
String::new(), // We got a NULL ptr, ignore `name_len`.
7373
|buf| String::from_utf8(
7474
slice::from_raw_parts(buf.as_ptr() as *const u8,
7575
name_len as usize)
76-
.to_vec()).unwrap());
76+
.to_vec()
77+
).unwrap()
78+
);
7779
debug!("get_metadata_section: name {}", name);
7880
if read_metadata_section_name(target) == name {
7981
let cbuf = llvm::LLVMGetSectionContents(si.llsi);

0 commit comments

Comments
 (0)