Repository navigation
Conversation
|
If the Unicode version changes are intentional, cc @rust-lang/lang-docs These commits modify the If this was unintentional then you should revert the changes before this PR is merged. The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease |
|
r? @jackh726 rustbot has assigned @jackh726. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| [lib] | ||
|
|
||
| # Note that this crate purposefully does not depend on other rustc crates | ||
| # Note that this crate purposefully does not depend on other rustc crates other than `rustc-unicode` |
There was a problem hiding this comment.
Not sure if this is appropriate, and how better to resolve this
There was a problem hiding this comment.
Well, the reason for this is the fact that rust-analyzer wants to depend on this crate (or rather their republish, ra-ap-rustc_lexer IIUC). Not sure if your change would break their process..
There was a problem hiding this comment.
There was a problem hiding this comment.
I think it should be fine as long as rustc_unicode doesn't use unstable features.
57b2272 to
02dd39e
Compare
This comment has been minimized.
This comment has been minimized.
02dd39e to
6de7046
Compare
|
Opened draft PRs to |
| // If this changes, update https://github.com/rust-lang/reference/blob/HEAD/src/identifiers.md. | ||
| const UNICODE_VERSION: (u8, u8, u8) = (17, 0, 0); | ||
|
|
||
| macro_rules! reexport_and_check { | ||
| ($($krate:ident),+ $(,)?) => { | ||
| $( | ||
| pub use $krate; | ||
| const _: () = { | ||
| let (major, minor, patch) = crate::UNICODE_VERSION; | ||
| let (major_, minor_, patch_) = $krate::UNICODE_VERSION; | ||
| if major != major_ as u8 || minor != minor_ as u8 || patch != patch_ as u8 { | ||
| panic!( | ||
| concat!( | ||
| stringify!($krate), | ||
| " does not have the correct Unicode version (`rustc-unicode::UNICODE_VERSION`)" | ||
| ) | ||
| ) | ||
| } | ||
| }; | ||
| )+ | ||
| } | ||
| } |
There was a problem hiding this comment.
Presumably this should check char::UNICODE_VERSION as well, since that is relied upon pretty much everywhere. Cc #164841 (comment).
I assume some cfg(bootstrap) may be needed for that since we can't bump it independently.
There was a problem hiding this comment.
Since Unicode 18 is in use there, we won't be able to add that check until #165289 lands. Depending on the order of things getting merged I'll open up a followup PR, or update this PR to Unicode 18.
Related to #165289.
I noticed that, while we check that
UNICODE_VERSIONis consistent across several crates, not all are included in the check. This introduces a newrustc-unicodecrate which handles depending on anyunicode-*crates, checks their versions are consistent, and re-exports them.unicode-scriptis one such crate that wasn't being checked, so update the version of that crate.