Skip to content

Commit 730626d

Browse files
committed
Don't use LLVMRustStringWriteImpl outside of RawRustStringOstream
1 parent 6295686 commit 730626d

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
@@ -1624,5 +1624,6 @@ extern "C" void LLVMRustComputeLTOCacheKey(RustStringRef KeyOut,
16241624
CfiFunctionDefs, CfiFunctionDecls);
16251625
#endif
16261626

1627-
LLVMRustStringWriteImpl(KeyOut, Key.c_str(), Key.size());
1627+
auto OS = RawRustStringOstream(KeyOut);
1628+
OS << Key.str();
16281629
}

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,8 @@ LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef, RustStringRef MessageOut,
15101510
const SourceMgr &LSM = *D.getSourceMgr();
15111511
const MemoryBuffer *LBuf =
15121512
LSM.getMemoryBuffer(LSM.FindBufferContainingLoc(D.getLoc()));
1513-
LLVMRustStringWriteImpl(BufferOut, LBuf->getBufferStart(),
1514-
LBuf->getBufferSize());
1513+
auto BufferOS = RawRustStringOstream(BufferOut);
1514+
BufferOS << LBuf->getBuffer();
15151515

15161516
*LocOut = D.getLoc().getPointer() - LBuf->getBufferStart();
15171517

0 commit comments

Comments
 (0)