Skip to content

Conversation

@ekicyou
Copy link

@ekicyou ekicyou commented Dec 26, 2025

Summary

This PR adds support for the ucid (Unicode Identifiers) feature flag, which enables Unicode characters in Lua identifiers (variable names, function names, table fields, etc.).

Changes

Feature Flag Propagation

  • Added ucid feature to mlua/Cargo.toml that propagates to mlua-sys
  • Added ucid feature to mlua-sys/Cargo.toml that enables lua-src/ucid

This allows users to enable Unicode identifier support by adding:

[dependencies]
mlua = { version = "0.11", features = ["lua54", "vendored", "ucid"] }

Tests

  • Added tests/ucid.rs with comprehensive tests for Unicode identifiers:
    • Japanese variable names, function names, and table fields
    • Cyrillic (Russian) identifiers
    • Chinese identifiers
    • Mixed Unicode and ASCII identifiers

Background

The lua-src crate supports the ucid feature which compiles Lua with Unicode identifier support. This PR exposes that feature through mlua-sys to mlua, making it accessible to end users.

Testing

All tests pass with cargo test --features "lua54,vendored,ucid" --test ucid

Copilot AI review requested due to automatic review settings December 26, 2025 19:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for the ucid (Unicode Identifiers) feature flag, enabling Unicode characters in Lua identifiers such as variable names, function names, and table fields. This feature propagates from the lua-src crate through mlua-sys to mlua, making it accessible to end users.

Key Changes:

  • Added ucid feature flag to mlua/Cargo.toml that propagates to mlua-sys
  • Added ucid feature flag to mlua-sys/Cargo.toml that enables the lua-src/ucid sub-feature
  • Added comprehensive test suite covering Japanese, Chinese, Cyrillic, and mixed Unicode identifiers

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Cargo.toml Added ucid feature flag that propagates to mlua-sys
mlua-sys/Cargo.toml Added ucid feature flag that enables lua-src/ucid sub-feature
tests/ucid.rs New test file with comprehensive coverage of Unicode identifiers across multiple scripts (Japanese, Chinese, Cyrillic) and mixed usage scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

luau-codegen = ["luau"]
luau-vector4 = ["luau"]
vendored = ["lua-src", "luajit-src"]
ucid = ["lua-src/ucid"]
Copy link

Copilot AI Dec 26, 2025

Choose a reason for hiding this comment

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

The ucid feature depends on lua-src/ucid, which implicitly enables the optional lua-src dependency. However, lua-src only provides vendored Lua sources and is not used when linking against system Lua. This means the ucid feature will only work with the vendored feature enabled. Consider either:

  1. Making this explicit by defining the feature as ucid = ["vendored", "lua-src/ucid"] to enforce the dependency and improve clarity, or
  2. Adding documentation in a comment to clarify that ucid requires vendored to be enabled

This will help users understand the feature's requirements and prevent confusion when trying to use ucid without vendored.

Suggested change
ucid = ["lua-src/ucid"]
ucid = ["vendored", "lua-src/ucid"]

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant