Skip to content

case-related lints (non_snake_case, non_camel_case_types, โ€ฆ) did not suggest actual case-changed characters with Mathematical Alphanumeric Symbolsย #77273

Closed

Description

This example code:

let ๐“ข๐“๐“๐“๐“๐“๐“š๐“”๐“ข = 1;

Produced a useless conversion suggestion:

warning: variable `๐“ข๐“๐“๐“๐“๐“๐“š๐“”๐“ข` should have a snake case name
 --> src/main.rs:4:9
  |
4 |     let ๐“ข๐“๐“๐“๐“๐“๐“š๐“”๐“ข = 1;
  |         ^^^^^^^^^ help: convert the identifier to snake case: `๐“ข๐“๐“๐“๐“๐“๐“š๐“”๐“ข`
  |
  = note: `#[warn(non_snake_case)]` on by default

The problem here is that while these characters are in the Uppercase Letter (Lu) general category, they do not have a proper lowercase mapping: the lowercase of ๐“ is still ๐“, not ๐“ช (thus Rust cannot suggest ๐“ผ๐“ท๐“ช๐“ช๐“ช๐“ช๐“ด๐“ฎ๐“ผ).

This is the same for the other direction:

warning: type `๐•Ÿ๐• ๐•ฅ_๐•’_๐•”๐•’๐•ž๐•–๐•` should have an upper camel case name
 --> src/lib.rs:3:8
  |
3 | struct ๐•Ÿ๐• ๐•ฅ_๐•’_๐•”๐•’๐•ž๐•–๐•;
  |        ^^^^^^^^^^^ help: convert the identifier to upper camel case: `๐•Ÿ๐• ๐•ฅ๐•’๐•”๐•’๐•ž๐•–๐•`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

It shouldn't produce the suggestion at all if the conversion result is not changed, but I'm not sure about cases involving adding or removing underscores.

Meta

rustc on playground, 1.48.0-nightly (2020-09-26 623fb90).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintArea: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`A-unicodeArea: UnicodeC-bugCategory: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.F-non_ascii_idents`#![feature(non_ascii_idents)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions