Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve 'cannot contain emoji' error. #91476

Merged
merged 2 commits into from
Dec 9, 2021
Merged

Conversation

m-ou-se
Copy link
Member

@m-ou-se m-ou-se commented Dec 3, 2021

Before:

error: identifiers cannot contain emoji: `🦀`
 --> src/main.rs:2:9
  |
2 |     let 🦀 = 1;
  |         ^^

After:

error: Ferris cannot be used as an identifier
 --> src/main.rs:2:9
  |
2 |     let 🦀 = 1;
  |         ^^ help: try using their name instead: `ferris`

r? @estebank

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 3, 2021
@m-ou-se m-ou-se changed the title Ferris identifier Improve 'cannot contain emoji' error. Dec 3, 2021
@inquisitivecrystal
Copy link
Contributor

First of all, this is my new favorite PR.

Small editorial comment. I suggest making "Ferris" lowercase, both to match standard convention and to align it with the structured suggestion. If you disagree, feel free to disregard this.

@camelid
Copy link
Member

camelid commented Dec 3, 2021

Ferris is a name, so I think the current capitalization is more accurate ;)

@camelid camelid added A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Dec 3, 2021
@estebank
Copy link
Contributor

estebank commented Dec 9, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Dec 9, 2021

📌 Commit 9d535b4 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 9, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2021
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#91042 (Use Vec extend instead of repeated pushes on several places)
 - rust-lang#91476 (Improve 'cannot contain emoji' error.)
 - rust-lang#91568 (Pretty print break and continue without redundant space)
 - rust-lang#91645 (Implement `core::future::join!`)
 - rust-lang#91666 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dc834f0 into rust-lang:master Dec 9, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 9, 2021
@m-ou-se m-ou-se deleted the ferris-identifier branch December 15, 2021 10:50
@boehs
Copy link

boehs commented Dec 16, 2021

This was widely stopping rust adoption for me, Thank you.

@Be-ing
Copy link
Contributor

Be-ing commented Dec 16, 2021

First of all, this is my new favorite PR.

I think this pull request may have won the Internet.

Copy link

@ggangix ggangix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it !

@inferrna
Copy link

I think we need more bullshit like this. Next step would be including the whole gemoji crate into compiler codebase to be able to name any emoji, not just Ferris only.

@steffahn
Copy link
Member

steffahn commented Dec 16, 2021

The capitalization in the suggestions seems off when you don’t use it for a variable.

E.g. in a struct name

error: Ferris cannot be used as an identifier
 --> src/main.rs:1:8
  |
1 | struct 🦀;
  |        ^^ help: try using their name instead: `ferris`

or a const

error: Ferris cannot be used as an identifier
 --> src/main.rs:1:7
  |
1 | const 🦀: Crab = Crab::with_name("Ferris");
  |       ^^ help: try using their name instead: `ferris`

@boehs
Copy link

boehs commented Dec 16, 2021

I think we need more bullshit like this. Next step would be including the whole gemoji crate into compiler codebase to be able to name any emoji, not just Ferris only.

I think this is sarcastic but it would sure be fun!

@pro465
Copy link
Contributor

pro465 commented Feb 11, 2022

what the....

@arthurfiorette
Copy link

@m-ou-se Any chance we get 🦀 as the only allowed emoji identifier?
This is seriously preventing me from continuing to use rust in my projects.

@estebank
Copy link
Contributor

@arthurfiorette that would require t-lang sign-off. It would be too whimsical to do so, but I'm not against whimsy.

@arthurfiorette
Copy link

arthurfiorette commented Jun 29, 2022

I'm not familiar with the rust "workflow" for it... How can I start the process to get a t-lang sign-off? 😁

@m-ou-se
Copy link
Member Author

m-ou-se commented Jun 29, 2022

Adding 🦀 as an accepted identifier in Rust means removing this easter-egg, though. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-suggestion-diagnostics Area: Suggestions generated by the compiler applied by `cargo fix`. C-enhancement Category: An issue proposing an enhancement or a PR with one. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.