Skip to content

Commit a16bfd7

Browse files
authored
Merge pull request #21352 from Veykril/push-knwlqypxtukr
minor: Remove unneeded allocation in proc-macro-srv-cli
2 parents 7406f46 + 70d64cb commit a16bfd7

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

crates/proc-macro-api/src/transport/framing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::io::{self, BufRead, Write};
44

55
pub trait Framing {
6-
type Buf: Default + Send;
6+
type Buf: Default + Send + Sync;
77

88
fn read<'a, R: BufRead + ?Sized>(
99
inp: &mut R,

crates/proc-macro-srv-cli/src/main_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ fn handle_expand_ra<C: Codec>(
243243
def_site,
244244
call_site,
245245
mixed_site,
246-
Some(Box::new(ProcMacroClientHandle::<C> { stdin, stdout, buf })),
246+
Some(&mut ProcMacroClientHandle::<C> { stdin, stdout, buf }),
247247
)
248248
.map(|it| {
249249
(

crates/proc-macro-srv/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<'env> ProcMacroSrv<'env> {
9191
}
9292
}
9393

94-
pub type ProcMacroClientHandle<'a> = Box<dyn ProcMacroClientInterface + Send + 'a>;
94+
pub type ProcMacroClientHandle<'a> = &'a mut (dyn ProcMacroClientInterface + Sync + Send);
9595

9696
pub trait ProcMacroClientInterface {
9797
fn source_text(&mut self, file_id: u32, start: u32, end: u32) -> Option<String>;
@@ -178,9 +178,7 @@ impl ProcMacroSrv<'_> {
178178
}
179179

180180
pub trait ProcMacroSrvSpan: Copy + Send + Sync {
181-
type Server<'a>: proc_macro::bridge::server::Server<TokenStream = crate::token_stream::TokenStream<Self>>
182-
where
183-
Self: 'a;
181+
type Server<'a>: proc_macro::bridge::server::Server<TokenStream = crate::token_stream::TokenStream<Self>>;
184182
fn make_server<'a>(
185183
call_site: Self,
186184
def_site: Self,

0 commit comments

Comments
 (0)