Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Work around https://github.com/rust-lang/rust/pull/55937 #1220

Merged
merged 1 commit into from
Jan 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl<O: Output> LsService<O> {
}
}

fn dispatch_message(&mut self, msg: &RawMessage) -> Result<(), jsonrpc::Error> {
fn dispatch_message(&mut self, msg: RawMessage) -> Result<(), jsonrpc::Error> {
macro_rules! match_action {
(
$method: expr;
Expand Down Expand Up @@ -334,9 +334,12 @@ impl<O: Output> LsService<O> {
}
}

if let Err(e) = self.dispatch_message(&raw_message) {
// Workaround https://github.com/rust-lang/rust/pull/55937 by moving
// raw_message instead of borrowing.
let id = raw_message.id.clone();
if let Err(e) = self.dispatch_message(raw_message) {
error!("dispatch error: {:?}, message: `{}`", e, msg_string);
self.output.failure(raw_message.id, e);
self.output.failure(id, e);
return ServerStateChange::Break { exit_code: 101 };
}

Expand Down