aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-04-23 18:38:58 +0100
committerEdwin Cheng <[email protected]>2020-04-23 18:38:58 +0100
commit1627b55028a5e9a4fccad6124bef602d1b55b28b (patch)
tree137c74ad0827cab0e13c2e890d34eb17a08c4bc6
parent25e8f5ded9037bd9a172861c995b467b63390808 (diff)
Bubble up error
-rw-r--r--crates/ra_proc_macro_srv/src/cli.rs15
-rw-r--r--crates/rust-analyzer/src/bin/main.rs2
2 files changed, 7 insertions, 10 deletions
diff --git a/crates/ra_proc_macro_srv/src/cli.rs b/crates/ra_proc_macro_srv/src/cli.rs
index c7f41e448..ded1bcdbc 100644
--- a/crates/ra_proc_macro_srv/src/cli.rs
+++ b/crates/ra_proc_macro_srv/src/cli.rs
@@ -4,16 +4,13 @@ use crate::{expand_task, list_macros};
4use ra_proc_macro::msg::{self, Message}; 4use ra_proc_macro::msg::{self, Message};
5use std::io; 5use std::io;
6 6
7pub fn run() { 7pub fn run() -> io::Result<()> {
8 loop { 8 loop {
9 let req = match read_request() { 9 // bubble up the error for read request,
10 Err(err) => { 10 // as the stdin pipe may be closed.
11 // Panic here, as the stdin pipe may be closed. 11 let req = match read_request()? {
12 // Otherwise, client will be restarted the service anyway. 12 None => continue,
13 panic!("Read message error on ra_proc_macro_srv: {}", err); 13 Some(req) => req,
14 }
15 Ok(None) => continue,
16 Ok(Some(req)) => req,
17 }; 14 };
18 15
19 let res = match req { 16 let res = match req {
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index e8d5dad65..22a84b50c 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -66,7 +66,7 @@ fn setup_logging() -> Result<()> {
66} 66}
67 67
68fn run_proc_macro_srv() -> Result<()> { 68fn run_proc_macro_srv() -> Result<()> {
69 ra_proc_macro_srv::cli::run(); 69 ra_proc_macro_srv::cli::run()?;
70 Ok(()) 70 Ok(())
71} 71}
72 72