Skip to content

Unicode 17? #1387

Description

@ajvondrak

Unicode 17.0.0 has been out since 2025 September 9: https://www.unicode.org/versions/Unicode17.0.0/

Rust updated shortly thereafter: rust-lang/rust#146330

But the latest update for regex-syntax seems to be from Unicode 16: 9239e7e

The disagreement causes divergent behavior, for example between char methods and regex character classes: EDIT: bad example, see #1387 (comment) instead.

Bad Example
[package]
name = "repro"
version = "0.1.0"
edition = "2024"

[dependencies]
regex = "1.13.1"
use regex::Regex;

fn main() {
    dbg!(char::UNICODE_VERSION);
    let c = '\u{323B0}';
    dbg!(c.is_alphabetic());
    dbg!(Regex::new(r"[[:alpha:]]").unwrap().is_match(&c.to_string()));
}
$ cargo run
   Compiling repro v0.1.0 (/private/tmp/repro)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.69s
     Running `target/debug/repro`
[src/main.rs:4:5] char::UNICODE_VERSION = (
    17,
    0,
    0,
)
[src/main.rs:6:5] c.is_alphabetic() = true
[src/main.rs:7:5] Regex::new(r"[[:alpha:]]").unwrap().is_match(&c.to_string()) = false

Two separate thoughts:

  1. Can we bump to Unicode 17?
  2. Could we expose a UNICODE_VERSION constant a la char::UNICODE_VERSION (or as in other crates, like unicode_ident::UNICODE_VERSION, unicode_normalization::UNICODE_VERSION, etc)? This could make it easier for some users to catch such version drift in the future, similar to this code: https://github.com/rust-lang/rust/blob/a04c7a037d59b6dedc9f921e84e391f13a257aa4/compiler/rustc_parse/src/lib.rs#L39-L75

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions