rust-lang / rust-lang/rust

Cannot use unicode identifiers in `--extern` flags

Open
#134,250 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-crates A-metadata A-Unicode C-feature-request T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

> rustc --crate-name öwö --crate-type lib - <<<'pub fn öwö() {}'
> rustc --crate-name ūwū --crate-type bin --extern öwö=liböwö.rlib - <<<'fn main() { öwö::öwö(); }'

I expected to see this happen: successful compilation

Instead, this happened:

error: crate name `öwö` passed to `--extern` is not a valid ASCII identifier
Meta

rustc --version --verbose:

rustc 1.85.0 (c44b3d50f 2024-12-03)
binary: rustc
commit-hash: c44b3d50fea96a3e0417e8264c16ea21a0a3fca2
commit-date: 2024-12-03
host: x86_64-unknown-linux-gnu
release: 1.85.0
LLVM version: 19.1.4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the two rustc commands in the issue, focusing on validation of the --extern crate name. Trace where rustc rejects the non-ASCII identifier and identify the relevant compiler tests or entry point. Done means the shown commands compile successfully with the Unicode crate and function names.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.