Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #21352 from Veykril/push-knwlqypxtukr
minor: Remove unneeded allocation in proc-macro-srv-cli
| -rw-r--r-- | crates/proc-macro-api/src/transport/framing.rs | 2 | ||||
| -rw-r--r-- | crates/proc-macro-srv-cli/src/main_loop.rs | 2 | ||||
| -rw-r--r-- | crates/proc-macro-srv/src/lib.rs | 6 |
3 files changed, 4 insertions, 6 deletions
diff --git a/crates/proc-macro-api/src/transport/framing.rs b/crates/proc-macro-api/src/transport/framing.rs index 1e29c1982a..56c3b68e8c 100644 --- a/crates/proc-macro-api/src/transport/framing.rs +++ b/crates/proc-macro-api/src/transport/framing.rs @@ -3,7 +3,7 @@ use std::io::{self, BufRead, Write}; pub trait Framing { - type Buf: Default + Send; + type Buf: Default + Send + Sync; fn read<'a, R: BufRead + ?Sized>( inp: &mut R, diff --git a/crates/proc-macro-srv-cli/src/main_loop.rs b/crates/proc-macro-srv-cli/src/main_loop.rs index 4d98a8e29d..25a5104c5d 100644 --- a/crates/proc-macro-srv-cli/src/main_loop.rs +++ b/crates/proc-macro-srv-cli/src/main_loop.rs @@ -243,7 +243,7 @@ fn handle_expand_ra<C: Codec>( def_site, call_site, mixed_site, - Some(Box::new(ProcMacroClientHandle::<C> { stdin, stdout, buf })), + Some(&mut ProcMacroClientHandle::<C> { stdin, stdout, buf }), ) .map(|it| { ( diff --git a/crates/proc-macro-srv/src/lib.rs b/crates/proc-macro-srv/src/lib.rs index 687a4218b4..17ffa29ce1 100644 --- a/crates/proc-macro-srv/src/lib.rs +++ b/crates/proc-macro-srv/src/lib.rs @@ -91,7 +91,7 @@ impl<'env> ProcMacroSrv<'env> { } } -pub type ProcMacroClientHandle<'a> = Box<dyn ProcMacroClientInterface + Send + 'a>; +pub type ProcMacroClientHandle<'a> = &'a mut (dyn ProcMacroClientInterface + Sync + Send); pub trait ProcMacroClientInterface { fn source_text(&mut self, file_id: u32, start: u32, end: u32) -> Option<String>; @@ -178,9 +178,7 @@ impl ProcMacroSrv<'_> { } pub trait ProcMacroSrvSpan: Copy + Send + Sync { - type Server<'a>: proc_macro::bridge::server::Server<TokenStream = crate::token_stream::TokenStream<Self>> - where - Self: 'a; + type Server<'a>: proc_macro::bridge::server::Server<TokenStream = crate::token_stream::TokenStream<Self>>; fn make_server<'a>( call_site: Self, def_site: Self, |