We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f5b3021 commit 076a5cdCopy full SHA for 076a5cd
src/librustc_codegen_llvm/metadata.rs
@@ -69,11 +69,13 @@ fn search_meta_section<'a>(of: &'a ObjectFile,
69
let mut name_buf = None;
70
let name_len = llvm::LLVMRustGetSectionName(si.llsi, &mut name_buf);
71
let name = name_buf.map_or(
72
- "".to_string(),
+ String::new(), // We got a NULL ptr, ignore `name_len`.
73
|buf| String::from_utf8(
74
slice::from_raw_parts(buf.as_ptr() as *const u8,
75
name_len as usize)
76
- .to_vec()).unwrap());
+ .to_vec()
77
+ ).unwrap()
78
+ );
79
debug!("get_metadata_section: name {}", name);
80
if read_metadata_section_name(target) == name {
81
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
0 commit comments