@@ -17,7 +17,7 @@ use span::Span;
1717use stdx:: JodChild ;
1818
1919use crate :: {
20- Codec , ProcMacro , ProcMacroKind , ProtocolFormat , ServerError ,
20+ ProcMacro , ProcMacroKind , ProtocolFormat , ServerError ,
2121 bidirectional_protocol:: { self , SubCallback , msg:: BidirectionalMessage , reject_subrequests} ,
2222 legacy_protocol:: { self , SpanMode } ,
2323 version,
@@ -305,17 +305,17 @@ impl ProcMacroServerProcess {
305305 result
306306 }
307307
308- pub ( crate ) fn send_task < Request , Response , C : Codec > (
308+ pub ( crate ) fn send_task_legacy < Request , Response > (
309309 & self ,
310310 send : impl FnOnce (
311311 & mut dyn Write ,
312312 & mut dyn BufRead ,
313313 Request ,
314- & mut C :: Buf ,
314+ & mut String ,
315315 ) -> Result < Option < Response > , ServerError > ,
316316 req : Request ,
317317 ) -> Result < Response , ServerError > {
318- self . with_locked_io :: < C , _ > ( |writer, reader, buf| {
318+ self . with_locked_io ( String :: new ( ) , |writer, reader, buf| {
319319 send ( writer, reader, req, buf) . and_then ( |res| {
320320 res. ok_or_else ( || {
321321 let message = "proc-macro server did not respond with data" . to_owned ( ) ;
@@ -331,13 +331,12 @@ impl ProcMacroServerProcess {
331331 } )
332332 }
333333
334- pub ( crate ) fn with_locked_io < C : Codec , R > (
334+ fn with_locked_io < R , B > (
335335 & self ,
336- f : impl FnOnce ( & mut dyn Write , & mut dyn BufRead , & mut C :: Buf ) -> Result < R , ServerError > ,
336+ mut buf : B ,
337+ f : impl FnOnce ( & mut dyn Write , & mut dyn BufRead , & mut B ) -> Result < R , ServerError > ,
337338 ) -> Result < R , ServerError > {
338339 let state = & mut * self . state . lock ( ) . unwrap ( ) ;
339- let mut buf = C :: Buf :: default ( ) ;
340-
341340 f ( & mut state. stdin , & mut state. stdout , & mut buf) . map_err ( |e| {
342341 if e. io . as_ref ( ) . map ( |it| it. kind ( ) ) == Some ( io:: ErrorKind :: BrokenPipe ) {
343342 match state. process . exit_err ( ) {
@@ -352,13 +351,13 @@ impl ProcMacroServerProcess {
352351 } )
353352 }
354353
355- pub ( crate ) fn run_bidirectional < C : Codec > (
354+ pub ( crate ) fn run_bidirectional (
356355 & self ,
357356 initial : BidirectionalMessage ,
358357 callback : SubCallback < ' _ > ,
359358 ) -> Result < BidirectionalMessage , ServerError > {
360- self . with_locked_io :: < C , _ > ( |writer, reader, buf| {
361- bidirectional_protocol:: run_conversation :: < C > ( writer, reader, buf, initial, callback)
359+ self . with_locked_io ( Vec :: new ( ) , |writer, reader, buf| {
360+ bidirectional_protocol:: run_conversation ( writer, reader, buf, initial, callback)
362361 } )
363362 }
364363
0 commit comments