Skip to content

Commit 8b76c44

Browse files
committed
Don't use LLVMRustStringWriteImpl outside of RawRustStringOstream
1 parent b8c8287 commit 8b76c44

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1588,5 +1588,6 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
15881588
CfiFunctionDefs, CfiFunctionDecls);
15891589
#endif
15901590

1591-
LLVMRustStringWriteImpl(KeyOut, Key.c_str(), Key.size());
1591+
auto OS = RawRustStringOstream(KeyOut);
1592+
OS << Key.str();
15921593
}

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1522,8 +1522,8 @@ LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef, RustStringRef MessageOut,
15221522
const SourceMgr &LSM = *D.getSourceMgr();
15231523
const MemoryBuffer *LBuf =
15241524
LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc()));
1525-
LLVMRustStringWriteImpl(BufferOut, LBuf->getBufferStart(),
1526-
LBuf->getBufferSize());
1525+
auto BufferOS = RawRustStringOstream(BufferOut);
1526+
BufferOS << LBuf->getBuffer();
15271527

15281528
*LocOut = D.getLoc().getPointer() - LBuf->getBufferStart();
15291529

0 commit comments

Comments
 (0)