@@ -10,7 +10,7 @@ use rustc_codegen_ssa::traits::CodegenBackend;
10
10
use rustc_data_structures:: parallel;
11
11
use rustc_data_structures:: sync:: { Lrc , OnceCell , WorkerLocal } ;
12
12
use rustc_data_structures:: temp_dir:: MaybeTempDir ;
13
- use rustc_errors:: { ErrorReported , PResult } ;
13
+ use rustc_errors:: { Applicability , ErrorReported , PResult } ;
14
14
use rustc_expand:: base:: ExtCtxt ;
15
15
use rustc_hir:: def_id:: { StableCrateId , LOCAL_CRATE } ;
16
16
use rustc_hir:: Crate ;
@@ -456,10 +456,26 @@ pub fn configure_and_expand(
456
456
identifiers. sort_by_key ( |& ( key, _) | key) ;
457
457
for ( ident, mut spans) in identifiers. into_iter ( ) {
458
458
spans. sort ( ) ;
459
- sess. diagnostic ( ) . span_err (
460
- MultiSpan :: from ( spans) ,
461
- & format ! ( "identifiers cannot contain emoji: `{}`" , ident) ,
462
- ) ;
459
+ if ident == sym:: ferris {
460
+ let first_span = spans[ 0 ] ;
461
+ sess. diagnostic ( )
462
+ . struct_span_err (
463
+ MultiSpan :: from ( spans) ,
464
+ "Ferris cannot be used as an identifier" ,
465
+ )
466
+ . span_suggestion (
467
+ first_span,
468
+ "try using their name instead" ,
469
+ "ferris" . to_string ( ) ,
470
+ Applicability :: MaybeIncorrect ,
471
+ )
472
+ . emit ( ) ;
473
+ } else {
474
+ sess. diagnostic ( ) . span_err (
475
+ MultiSpan :: from ( spans) ,
476
+ & format ! ( "identifiers cannot contain emoji: `{}`" , ident) ,
477
+ ) ;
478
+ }
463
479
}
464
480
} ) ;
465
481
0 commit comments