Skip to content

Commit 3f2ece7

Browse files
committed
Fix a BorrowMut error when stdout is closed
There was one location in the job queue where the shell is borrowed twice by accident, so instead hold the same borrow over both locations. Closes #9220
1 parent c68432f commit 3f2ece7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cargo/core/compiler/job_queue.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,13 +748,14 @@ impl<'cfg> DrainState<'cfg> {
748748
}
749749
}
750750
if cx.bcx.build_config.emit_json() {
751+
let mut shell = cx.bcx.config.shell();
751752
let msg = machine_message::BuildFinished {
752753
success: error.is_none(),
753754
}
754755
.to_json_string();
755-
if let Err(e) = writeln!(cx.bcx.config.shell().out(), "{}", msg) {
756+
if let Err(e) = writeln!(shell.out(), "{}", msg) {
756757
if error.is_some() {
757-
crate::display_error(&e.into(), &mut cx.bcx.config.shell());
758+
crate::display_error(&e.into(), &mut shell);
758759
} else {
759760
return Some(e.into());
760761
}

0 commit comments

Comments
 (0)