@@ -7,9 +7,7 @@ use rustc_ast::ast::{self, AttrStyle};
77use rustc_ast:: token:: { self , CommentKind , Delimiter , Token , TokenKind } ;
88use rustc_ast:: tokenstream:: TokenStream ;
99use rustc_ast:: util:: unicode:: contains_text_flow_control_chars;
10- use rustc_errors:: {
11- error_code, Applicability , DiagCtxt , Diagnostic , DiagnosticBuilder , FatalAbort , StashKey ,
12- } ;
10+ use rustc_errors:: { error_code, Applicability , DiagCtxt , Diagnostic , StashKey } ;
1311use rustc_lexer:: unescape:: { self , EscapeError , Mode } ;
1412use rustc_lexer:: { Base , DocStyle , RawStrError } ;
1513use rustc_lexer:: { Cursor , LiteralKind } ;
@@ -344,18 +342,6 @@ impl<'a> StringReader<'a> {
344342 token:: Ident ( sym, false )
345343 }
346344
347- fn struct_fatal_span_char (
348- & self ,
349- from_pos : BytePos ,
350- to_pos : BytePos ,
351- m : & str ,
352- c : char ,
353- ) -> DiagnosticBuilder < ' a , FatalAbort > {
354- self . sess
355- . dcx
356- . struct_span_fatal ( self . mk_sp ( from_pos, to_pos) , format ! ( "{}: {}" , m, escaped_char( c) ) )
357- }
358-
359345 /// Detect usages of Unicode codepoints changing the direction of the text on screen and loudly
360346 /// complain about it.
361347 fn lint_unicode_text_flow ( & self , start : BytePos ) {
@@ -568,13 +554,16 @@ impl<'a> StringReader<'a> {
568554 }
569555
570556 fn report_non_started_raw_string ( & self , start : BytePos , bad_char : char ) -> ! {
571- self . struct_fatal_span_char (
572- start,
573- self . pos ,
574- "found invalid character; only `#` is allowed in raw string delimitation" ,
575- bad_char,
576- )
577- . emit ( )
557+ self . sess
558+ . dcx
559+ . struct_span_fatal (
560+ self . mk_sp ( start, self . pos ) ,
561+ format ! (
562+ "found invalid character; only `#` is allowed in raw string delimitation: {}" ,
563+ escaped_char( bad_char)
564+ ) ,
565+ )
566+ . emit ( )
578567 }
579568
580569 fn report_unterminated_raw_string (
0 commit comments