@@ -67,8 +67,9 @@ impl server::Server for SpanIdServer<'_> {
6767 self . tracked_paths . insert ( path. into ( ) ) ;
6868 }
6969
70- fn literal_from_str ( & mut self , s : & str ) -> Result < Literal < Self :: Span > , ( ) > {
70+ fn literal_from_str ( & mut self , s : & str ) -> Result < Literal < Self :: Span > , String > {
7171 literal_from_str ( s, self . call_site )
72+ . map_err ( |( ) | "cannot parse string into literal" . to_string ( ) )
7273 }
7374
7475 fn emit_diagnostic ( & mut self , _: Diagnostic < Self :: Span > ) { }
@@ -84,14 +85,9 @@ impl server::Server for SpanIdServer<'_> {
8485 fn ts_is_empty ( & mut self , stream : & Self :: TokenStream ) -> bool {
8586 stream. is_empty ( )
8687 }
87- fn ts_from_str ( & mut self , src : & str ) -> Self :: TokenStream {
88- Self :: TokenStream :: from_str ( src, self . call_site ) . unwrap_or_else ( |e| {
89- Self :: TokenStream :: from_str (
90- & format ! ( "compile_error!(\" failed to parse str to token stream: {e}\" )" ) ,
91- self . call_site ,
92- )
93- . unwrap ( )
94- } )
88+ fn ts_from_str ( & mut self , src : & str ) -> Result < Self :: TokenStream , String > {
89+ Self :: TokenStream :: from_str ( src, self . call_site )
90+ . map_err ( |e| format ! ( "failed to parse str to token stream: {e}" ) )
9591 }
9692 fn ts_to_string ( & mut self , stream : & Self :: TokenStream ) -> String {
9793 stream. to_string ( )
0 commit comments