File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -112,8 +112,14 @@ pub fn quote(stream: TokenStream) -> TokenStream {
112112 ) ) , & mut ts) ; )
113113 }
114114 TokenTree :: Ident ( tt) => {
115- minimal_quote ! ( crate :: ToTokens :: to_tokens( & crate :: TokenTree :: Ident ( crate :: Ident :: new(
116- ( @ TokenTree :: from( Literal :: string( & tt. to_string( ) ) ) ) ,
115+ let literal = tt. to_string ( ) ;
116+ let ( literal, ctor) = if let Some ( stripped) = literal. strip_prefix ( "r#" ) {
117+ ( stripped, minimal_quote ! ( crate :: Ident :: new_raw) )
118+ } else {
119+ ( literal. as_str ( ) , minimal_quote ! ( crate :: Ident :: new) )
120+ } ;
121+ minimal_quote ! ( crate :: ToTokens :: to_tokens( & crate :: TokenTree :: Ident ( ( @ ctor) (
122+ ( @ TokenTree :: from( Literal :: string( literal) ) ) ,
117123 ( @ quote_span( proc_macro_crate. clone( ) , tt. span( ) ) ) ,
118124 ) ) , & mut ts) ; )
119125 }
You can’t perform that action at this time.
0 commit comments