-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-UnicodeArea: UnicodeArea: UnicodeA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.F-non_ascii_idents`#![feature(non_ascii_idents)]``#![feature(non_ascii_idents)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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).
estebank and 3nt3197g
Metadata
Metadata
Assignees
Labels
A-UnicodeArea: UnicodeArea: UnicodeA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.F-non_ascii_idents`#![feature(non_ascii_idents)]``#![feature(non_ascii_idents)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.