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

Commit cdc2464

Browse files
authored
Merge pull request #1220 from Xanewok/ub-or-not-ub
Work around rust-lang/rust#55937
2 parents 82ecfdc + 085e926 commit cdc2464

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/server/mod.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<O: Output> LsService<O> {
170170
}
171171
}
172172

173-
fn dispatch_message(&mut self, msg: &RawMessage) -> Result<(), jsonrpc::Error> {
173+
fn dispatch_message(&mut self, msg: RawMessage) -> Result<(), jsonrpc::Error> {
174174
macro_rules! match_action {
175175
(
176176
$method: expr;
@@ -334,9 +334,12 @@ impl<O: Output> LsService<O> {
334334
}
335335
}
336336

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

0 commit comments

Comments
 (0)