File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change
1
+ #[ cfg( wrap_proc_macro) ]
2
+ use crate :: imp;
1
3
#[ cfg( span_locations) ]
2
4
use crate :: location:: LineColumn ;
3
5
use crate :: parse:: { self , Cursor } ;
@@ -1221,8 +1223,8 @@ fn escape_utf8(string: &str, repr: &mut String) {
1221
1223
#[ cfg( feature = "proc-macro" ) ]
1222
1224
pub ( crate ) trait FromStr2 : FromStr < Err = proc_macro:: LexError > {
1223
1225
#[ cfg( wrap_proc_macro) ]
1224
- fn from_str_checked ( src : & str ) -> Result < Self , Self :: Err > {
1225
- Self :: from_str ( src)
1226
+ fn from_str_checked ( src : & str ) -> Result < Self , imp :: LexError > {
1227
+ Self :: from_str ( src) . map_err ( imp :: LexError :: Compiler )
1226
1228
}
1227
1229
1228
1230
fn from_str_unchecked ( src : & str ) -> Self {
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ impl TokenStream {
91
91
// Catch panic to work around https://github.com/rust-lang/rust/issues/58736.
92
92
match panic:: catch_unwind ( || proc_macro:: TokenStream :: from_str_checked ( src) ) {
93
93
Ok ( Ok ( tokens) ) => Ok ( TokenStream :: Compiler ( DeferredTokenStream :: new ( tokens) ) ) ,
94
- Ok ( Err ( lex) ) => Err ( LexError :: Compiler ( lex) ) ,
94
+ Ok ( Err ( lex) ) => Err ( lex) ,
95
95
Err ( _panic) => Err ( LexError :: CompilerPanic ) ,
96
96
}
97
97
} else {
You can’t perform that action at this time.
0 commit comments