File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
src/tools/rust-analyzer/crates/proc-macro-srv/src/server_impl Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,14 @@ impl server::TokenStream for RaSpanServer {
6565 fn is_empty ( & mut self , stream : & Self :: TokenStream ) -> bool {
6666 stream. is_empty ( )
6767 }
68- fn from_str ( & mut self , src : & str ) -> Result < Self :: TokenStream , String > {
69- Self :: TokenStream :: from_str ( src, self . call_site )
70- . map_err ( |e| format ! ( "failed to parse str to token stream: {e}" ) )
68+ fn from_str ( & mut self , src : & str ) -> Self :: TokenStream {
69+ Self :: TokenStream :: from_str ( src, self . call_site ) . unwrap_or_else ( |e| {
70+ Self :: TokenStream :: from_str (
71+ & format ! ( "compile_error!(\" failed to parse str to token stream: {e}\" )" ) ,
72+ self . call_site ,
73+ )
74+ . unwrap ( )
75+ } )
7176 }
7277 fn to_string ( & mut self , stream : & Self :: TokenStream ) -> String {
7378 stream. to_string ( )
Original file line number Diff line number Diff line change @@ -54,9 +54,14 @@ impl server::TokenStream for SpanIdServer {
5454 fn is_empty ( & mut self , stream : & Self :: TokenStream ) -> bool {
5555 stream. is_empty ( )
5656 }
57- fn from_str ( & mut self , src : & str ) -> Result < Self :: TokenStream , String > {
58- Self :: TokenStream :: from_str ( src, self . call_site )
59- . map_err ( |e| format ! ( "failed to parse str to token stream: {e}" ) )
57+ fn from_str ( & mut self , src : & str ) -> Self :: TokenStream {
58+ Self :: TokenStream :: from_str ( src, self . call_site ) . unwrap_or_else ( |e| {
59+ Self :: TokenStream :: from_str (
60+ & format ! ( "compile_error!(\" failed to parse str to token stream: {e}\" )" ) ,
61+ self . call_site ,
62+ )
63+ . unwrap ( )
64+ } )
6065 }
6166 fn to_string ( & mut self , stream : & Self :: TokenStream ) -> String {
6267 stream. to_string ( )
You can’t perform that action at this time.
0 commit comments