-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Allow derives to allow(non_ascii_idents) at the non-crate level #151025
Copy link
Copy link
Open
Labels
A-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-rust-for-linuxRelevant for the Rust-for-Linux projectRelevant for the Rust-for-Linux projectI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
Description
Metadata
Metadata
Assignees
Labels
A-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-rust-for-linuxRelevant for the Rust-for-Linux projectRelevant for the Rust-for-Linux projectI-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.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.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.
In google/zerocopy#2880, a user reported that our use of non-ASCII identifiers in generated code triggers the
non_ascii_identslint in their codebase.In google/zerocopy#2882, we tried to solve this by emitting
allow(non_ascii_idents)in derive-generated code, but this unfortunately has no effect, simply triggering this warning:This "crate-level only" behavior is also true of a number of other lints (for example). This restriction prevents us from using non-ASCII identifiers in generated code, which we intentionally do in order to minimize the likelihood of identifier conflicts with surrounding code. It would be good to support this in derive-generated code.
We propose one of the following:
#[automatically_generated]#[automatically_generated]cc @jswrenn