File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
rustc_macros/src/diagnostics Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,14 @@ pub(crate) fn new_code_ident() -> syn::Ident {
3030}
3131
3232pub ( crate ) fn convert_to_litstr ( lit : & proc_macro2:: Literal ) -> LitStr {
33- let lit_content = format ! ( "{}" , lit) ;
34- LitStr :: new ( & lit_content[ 1 ..lit_content. len ( ) - 1 ] , lit. span ( ) )
33+ let s = format ! ( "{}" , lit) ;
34+ let s = if s. starts_with ( "r#\" " ) && s. ends_with ( "\" #" ) && s. len ( ) >= 5 {
35+ s[ 3 ..s. len ( ) - 2 ] . to_string ( )
36+ } else {
37+ s[ 1 ..s. len ( ) - 1 ] . to_string ( )
38+ } ;
39+
40+ LitStr :: new ( & s, lit. span ( ) )
3541}
3642
3743/// Checks whether the type name of `ty` matches `name`.
Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ pub(crate) struct ExpectedEqForLetExpr {
498498}
499499
500500#[ derive( Diagnostic ) ]
501- #[ diag( label = r#"expected `{"{"}`, found {$first_tok}"# ) ]
501+ #[ diag( r#"expected `{"{"}`, found {$first_tok}"# ) ]
502502pub ( crate ) struct ExpectedElseBlock {
503503 #[ primary_span]
504504 pub first_tok_span : Span ,
You can’t perform that action at this time.
0 commit comments