Skip to content

Commit dd33b14

Browse files
committed
Fix usage of rustc --ls on invalid files
Closes #11259
1 parent c34ef5d commit dd33b14

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/librustc/lib/llvm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1936,7 +1936,7 @@ impl ObjectFile {
19361936
unsafe {
19371937
let llof = llvm::LLVMCreateObjectFile(llmb);
19381938
if llof as int == 0 {
1939-
llvm::LLVMDisposeMemoryBuffer(llmb);
1939+
// LLVMCreateObjectFile took ownership of llmb
19401940
return None
19411941
}
19421942

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-include ../tools.mk
2+
3+
all:
4+
$(RUSTC) foo.rs
5+
$(RUSTC) --ls $(TMPDIR)/foo
6+
touch $(TMPDIR)/bar
7+
$(RUSTC) --ls $(TMPDIR)/bar

src/test/run-make/ls-metadata/foo.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}

0 commit comments

Comments
 (0)