Sort FxHashSet
's contents before emitting errors for consistent output
This commit is contained in:
parent
38979a3ba1
commit
5402e4833f
2 changed files with 24 additions and 21 deletions
|
@ -452,7 +452,10 @@ pub fn configure_and_expand(
|
||||||
|
|
||||||
// Gate identifiers containing invalid Unicode codepoints that were recovered during lexing.
|
// Gate identifiers containing invalid Unicode codepoints that were recovered during lexing.
|
||||||
sess.parse_sess.bad_unicode_identifiers.with_lock(|identifiers| {
|
sess.parse_sess.bad_unicode_identifiers.with_lock(|identifiers| {
|
||||||
for (ident, spans) in identifiers.drain() {
|
let mut identifiers: Vec<_> = identifiers.drain().collect();
|
||||||
|
identifiers.sort_by_key(|&(key, _)| key);
|
||||||
|
for (ident, mut spans) in identifiers.into_iter() {
|
||||||
|
spans.sort();
|
||||||
sess.diagnostic().span_err(
|
sess.diagnostic().span_err(
|
||||||
MultiSpan::from(spans),
|
MultiSpan::from(spans),
|
||||||
&format!("identifiers cannot contain emoji: `{}`", ident),
|
&format!("identifiers cannot contain emoji: `{}`", ident),
|
||||||
|
|
|
@ -18,23 +18,11 @@ LL | fn i_like_to_😅_a_lot() -> 👀 {
|
||||||
LL | let _ = i_like_to_😄_a_lot() ➖ 4;
|
LL | let _ = i_like_to_😄_a_lot() ➖ 4;
|
||||||
| ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot`
|
| ^^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `i_like_to_😅_a_lot`
|
||||||
|
|
||||||
error: identifiers cannot contain emoji: `i_like_to_😄_a_lot`
|
error: identifiers cannot contain emoji: `ABig👩👩👧👧Family`
|
||||||
--> $DIR/emoji-identifiers.rs:13:13
|
--> $DIR/emoji-identifiers.rs:1:8
|
||||||
|
|
|
|
||||||
LL | let _ = i_like_to_😄_a_lot() ➖ 4;
|
LL | struct ABig👩👩👧👧Family;
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: identifiers cannot contain emoji: `full_of_✨`
|
|
||||||
--> $DIR/emoji-identifiers.rs:4:8
|
|
||||||
|
|
|
||||||
LL | fn full_of_✨() -> 👀 {
|
|
||||||
| ^^^^^^^^^^
|
|
||||||
|
|
||||||
error: identifiers cannot contain emoji: `full_of✨`
|
|
||||||
--> $DIR/emoji-identifiers.rs:9:8
|
|
||||||
|
|
|
||||||
LL | 👀::full_of✨()
|
|
||||||
| ^^^^^^^^^
|
|
||||||
|
|
||||||
error: identifiers cannot contain emoji: `👀`
|
error: identifiers cannot contain emoji: `👀`
|
||||||
--> $DIR/emoji-identifiers.rs:2:8
|
--> $DIR/emoji-identifiers.rs:2:8
|
||||||
|
@ -53,17 +41,29 @@ LL | fn i_like_to_😅_a_lot() -> 👀 {
|
||||||
LL | 👀::full_of✨()
|
LL | 👀::full_of✨()
|
||||||
| ^^
|
| ^^
|
||||||
|
|
||||||
|
error: identifiers cannot contain emoji: `full_of_✨`
|
||||||
|
--> $DIR/emoji-identifiers.rs:4:8
|
||||||
|
|
|
||||||
|
LL | fn full_of_✨() -> 👀 {
|
||||||
|
| ^^^^^^^^^^
|
||||||
|
|
||||||
error: identifiers cannot contain emoji: `i_like_to_😅_a_lot`
|
error: identifiers cannot contain emoji: `i_like_to_😅_a_lot`
|
||||||
--> $DIR/emoji-identifiers.rs:8:4
|
--> $DIR/emoji-identifiers.rs:8:4
|
||||||
|
|
|
|
||||||
LL | fn i_like_to_😅_a_lot() -> 👀 {
|
LL | fn i_like_to_😅_a_lot() -> 👀 {
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: identifiers cannot contain emoji: `ABig👩👩👧👧Family`
|
error: identifiers cannot contain emoji: `full_of✨`
|
||||||
--> $DIR/emoji-identifiers.rs:1:8
|
--> $DIR/emoji-identifiers.rs:9:8
|
||||||
|
|
|
|
||||||
LL | struct ABig👩👩👧👧Family;
|
LL | 👀::full_of✨()
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
||||||
|
error: identifiers cannot contain emoji: `i_like_to_😄_a_lot`
|
||||||
|
--> $DIR/emoji-identifiers.rs:13:13
|
||||||
|
|
|
||||||
|
LL | let _ = i_like_to_😄_a_lot() ➖ 4;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0599]: no function or associated item named `full_of✨` found for struct `👀` in the current scope
|
error[E0599]: no function or associated item named `full_of✨` found for struct `👀` in the current scope
|
||||||
--> $DIR/emoji-identifiers.rs:9:8
|
--> $DIR/emoji-identifiers.rs:9:8
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue