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

Ferris 🦀 Identifier naming conventions #137356

Merged
merged 1 commit into from
Feb 22, 2025
Merged

Conversation

nik-rev
Copy link
Contributor

@nik-rev nik-rev commented Feb 21, 2025

You cannot use Ferris as an identifier in Rust, this code will suggest to correct the 🦀 to ferris:

fn main() {
  let  🦀 = 4;
}

But it also suggests to correct to ferris in these cases, too:

struct  🦀 {}
fn main() {}

^ suggests: ferris
~ with this PR: Ferris

static 🦀: &str = "ferris!";
fn main() {}

^ suggests: ferris
~ with this PR: FERRIS

This is my first pull requests here!

@rustbot
Copy link
Collaborator

rustbot commented Feb 21, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @fmease (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 21, 2025
@nik-rev nik-rev changed the title Ferris 🦀 Identifier correct naming conventions Ferris 🦀 Identifier naming conventions Feb 21, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

I'm tempted to say that this fix is a bit overkill for what amounts to an easter-egg in the compiler. Please at least fix the approach, remove the stray flake file, and squash all the commits into one though.

@nik-rev nik-rev marked this pull request as draft February 21, 2025 17:48
@nik-rev nik-rev force-pushed the FERRIS branch 2 times, most recently from ca69dc2 to 7df0af0 Compare February 21, 2025 19:30
test: add tests for correct ferris capitalization

fix: add "struct"

style: use rustfmt

style: remove newline

fix: _

_

_

_

_
@nik-rev nik-rev marked this pull request as ready for review February 21, 2025 20:46
@fmease fmease assigned compiler-errors and unassigned fmease Feb 21, 2025
@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 22, 2025

📌 Commit ec88bc2 has been approved by compiler-errors

It is now in the queue for this repository.

@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 Feb 22, 2025
Comment on lines +304 to +318
enum FerrisFix {
SnakeCase,
ScreamingSnakeCase,
PascalCase,
}

impl FerrisFix {
const fn as_str(self) -> &'static str {
match self {
FerrisFix::SnakeCase => "ferris",
FerrisFix::ScreamingSnakeCase => "FERRIS",
FerrisFix::PascalCase => "Ferris",
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't really need to be an enum, it's used for a single purpose so constants would have been fine and more compact. Or even literals considering SnakeCase and PascalCase are each constructed once and ScreamingSnakeCase only twice.

(but already approved so 🤷 )

compiler-errors added a commit to compiler-errors/rust that referenced this pull request Feb 22, 2025
Ferris 🦀 Identifier naming conventions

You cannot use Ferris as an identifier in Rust, this code will suggest to correct the  🦀 to `ferris`:

```rs
fn main() {
  let  🦀 = 4;
}
```

But it also suggests to correct to `ferris` in these cases, too:

```rs
struct  🦀 {}
fn main() {}
```

^ suggests: `ferris`
~ with this PR: `Ferris`

```rs
static 🦀: &str = "ferris!";
fn main() {}
```

^ suggests: `ferris`
~ with this PR: `FERRIS`

This is my first pull requests here!
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2025
…mpiler-errors

Rollup of 10 pull requests

Successful merges:

 - rust-lang#136642 (Put the alloc unit tests in a separate alloctests package)
 - rust-lang#136910 (Implement feature `isolate_most_least_significant_one` for integer types)
 - rust-lang#137183 (Prune dead regionck code)
 - rust-lang#137333 (Use `edition = "2024"` in the compiler (redux))
 - rust-lang#137356 (Ferris 🦀 Identifier naming conventions)
 - rust-lang#137362 (Add build step log for `run-make-support`)
 - rust-lang#137377 (Always allow reusing cratenum in CrateLoader::load)
 - rust-lang#137388 (Fix(lib/fs/tests): Disable rename POSIX semantics FS tests under Windows 7)
 - rust-lang#137410 (Use StableHasher + Hash64 for dep_tracking_hash)
 - rust-lang#137413 (jubilee cleared out the review queue)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2025
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#136910 (Implement feature `isolate_most_least_significant_one` for integer types)
 - rust-lang#137183 (Prune dead regionck code)
 - rust-lang#137333 (Use `edition = "2024"` in the compiler (redux))
 - rust-lang#137356 (Ferris 🦀 Identifier naming conventions)
 - rust-lang#137362 (Add build step log for `run-make-support`)
 - rust-lang#137377 (Always allow reusing cratenum in CrateLoader::load)
 - rust-lang#137388 (Fix(lib/fs/tests): Disable rename POSIX semantics FS tests under Windows 7)
 - rust-lang#137410 (Use StableHasher + Hash64 for dep_tracking_hash)
 - rust-lang#137413 (jubilee cleared out the review queue)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 72e41e5 into rust-lang:master Feb 22, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 22, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 22, 2025
Rollup merge of rust-lang#137356 - nik-rev:FERRIS, r=compiler-errors

Ferris 🦀 Identifier naming conventions

You cannot use Ferris as an identifier in Rust, this code will suggest to correct the  🦀 to `ferris`:

```rs
fn main() {
  let  🦀 = 4;
}
```

But it also suggests to correct to `ferris` in these cases, too:

```rs
struct  🦀 {}
fn main() {}
```

^ suggests: `ferris`
~ with this PR: `Ferris`

```rs
static 🦀: &str = "ferris!";
fn main() {}
```

^ suggests: `ferris`
~ with this PR: `FERRIS`

This is my first pull requests here!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

8 participants