diff options
| author | bors <bors@rust-lang.org> | 2021-12-09 04:04:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-12-09 04:04:01 +0000 |
| commit | e25077704164071a1ef87cdc90fe7dd1872ba3fa (patch) | |
| tree | 0c1e5f88fb29780ecfd8c8234dc6f7e7cd7e3d57 /compiler/rustc_interface | |
| parent | 3c857f48ce12d1f98f3ea6d48eb9e33d8d60c985 (diff) | |
| parent | 229aa1b106634c88084887f3e4fb20abb8c92b43 (diff) | |
| download | rust-e25077704164071a1ef87cdc90fe7dd1872ba3fa.tar.gz rust-e25077704164071a1ef87cdc90fe7dd1872ba3fa.zip | |
Auto merge of #91691 - matthiaskrgr:rollup-wfommdr, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #91042 (Use Vec extend instead of repeated pushes on several places) - #91476 (Improve 'cannot contain emoji' error.) - #91568 (Pretty print break and continue without redundant space) - #91645 (Implement `core::future::join!`) - #91666 (update Miri) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_interface')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index dbee92cf598..da76f221269 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -10,7 +10,7 @@ use rustc_codegen_ssa::traits::CodegenBackend; use rustc_data_structures::parallel; use rustc_data_structures::sync::{Lrc, OnceCell, WorkerLocal}; use rustc_data_structures::temp_dir::MaybeTempDir; -use rustc_errors::{ErrorReported, PResult}; +use rustc_errors::{Applicability, ErrorReported, PResult}; use rustc_expand::base::ExtCtxt; use rustc_hir::def_id::{StableCrateId, LOCAL_CRATE}; use rustc_hir::Crate; @@ -456,10 +456,26 @@ pub fn configure_and_expand( identifiers.sort_by_key(|&(key, _)| key); for (ident, mut spans) in identifiers.into_iter() { spans.sort(); - sess.diagnostic().span_err( - MultiSpan::from(spans), - &format!("identifiers cannot contain emoji: `{}`", ident), - ); + if ident == sym::ferris { + let first_span = spans[0]; + sess.diagnostic() + .struct_span_err( + MultiSpan::from(spans), + "Ferris cannot be used as an identifier", + ) + .span_suggestion( + first_span, + "try using their name instead", + "ferris".to_string(), + Applicability::MaybeIncorrect, + ) + .emit(); + } else { + sess.diagnostic().span_err( + MultiSpan::from(spans), + &format!("identifiers cannot contain emoji: `{}`", ident), + ); + } } }); |
