Skip to content

Third-party crates support: proc-macro2, quote, syn, serde and serde_derive #1007

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

Open
wants to merge 16 commits into
base: rust-next
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rust: syn: remove unicode-ident dependency
The `syn` crate depends on the `unicode-ident` crate
to determine whether characters have the XID_Start or XID_Continue
properties according to Unicode Standard Annex #31.

However, we only need ASCII identifiers in the kernel, thus we can
simplify the check and remove completely that dependency.

Signed-off-by: Miguel Ojeda <[email protected]>
  • Loading branch information
ojeda committed May 8, 2023
commit 3916aa6f2c633dd3ec33f458eea58de9284d1168
4 changes: 2 additions & 2 deletions rust/syn/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ impl From<Token![_]> for Ident {
pub fn xid_ok(symbol: &str) -> bool {
let mut chars = symbol.chars();
let first = chars.next().unwrap();
if !(first == '_' || unicode_ident::is_xid_start(first)) {
if !(first == '_' || first.is_ascii_alphabetic()) {
return false;
}
for ch in chars {
if !unicode_ident::is_xid_continue(ch) {
if !(ch == '_' || ch.is_ascii_alphanumeric()) {
return false;
}
}
Expand Down