diff options
Diffstat (limited to 'crates/proc_macro_api/src')
-rw-r--r-- | crates/proc_macro_api/src/process.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs index 907cb3db7..fca506905 100644 --- a/crates/proc_macro_api/src/process.rs +++ b/crates/proc_macro_api/src/process.rs | |||
@@ -19,7 +19,7 @@ use crate::{ | |||
19 | 19 | ||
20 | #[derive(Debug, Default)] | 20 | #[derive(Debug, Default)] |
21 | pub(crate) struct ProcMacroProcessSrv { | 21 | pub(crate) struct ProcMacroProcessSrv { |
22 | inner: Option<Weak<Sender<Task>>>, | 22 | inner: Weak<Sender<Task>>, |
23 | } | 23 | } |
24 | 24 | ||
25 | #[derive(Debug)] | 25 | #[derive(Debug)] |
@@ -42,7 +42,7 @@ impl ProcMacroProcessSrv { | |||
42 | }); | 42 | }); |
43 | 43 | ||
44 | let task_tx = Arc::new(task_tx); | 44 | let task_tx = Arc::new(task_tx); |
45 | let srv = ProcMacroProcessSrv { inner: Some(Arc::downgrade(&task_tx)) }; | 45 | let srv = ProcMacroProcessSrv { inner: Arc::downgrade(&task_tx) }; |
46 | let thread = ProcMacroProcessThread { handle, sender: task_tx }; | 46 | let thread = ProcMacroProcessThread { handle, sender: task_tx }; |
47 | 47 | ||
48 | Ok((thread, srv)) | 48 | Ok((thread, srv)) |
@@ -79,13 +79,8 @@ impl ProcMacroProcessSrv { | |||
79 | where | 79 | where |
80 | R: TryFrom<Response, Error = &'static str>, | 80 | R: TryFrom<Response, Error = &'static str>, |
81 | { | 81 | { |
82 | let sender = match &self.inner { | ||
83 | None => return Err(tt::ExpansionError::Unknown("No sender is found.".to_string())), | ||
84 | Some(it) => it, | ||
85 | }; | ||
86 | |||
87 | let (result_tx, result_rx) = bounded(0); | 82 | let (result_tx, result_rx) = bounded(0); |
88 | let sender = match sender.upgrade() { | 83 | let sender = match self.inner.upgrade() { |
89 | None => { | 84 | None => { |
90 | return Err(tt::ExpansionError::Unknown("Proc macro process is closed.".into())) | 85 | return Err(tt::ExpansionError::Unknown("Proc macro process is closed.".into())) |
91 | } | 86 | } |