Commit a8d4e4f
authored
Rollup merge of rust-lang#62848 - matklad:xid-unicode, r=petrochenkov
Use unicode-xid crate instead of libcore
This PR proposes to remove `char::is_xid_start` and `char::is_xid_continue` functions from `libcore` and use `unicode_xid` crate from crates.io (note that this crate is already present in rust-lang/rust's Cargo.lock).
Reasons to do this:
* removing rustc-binary-specific stuff from libcore
* making sure that, across the ecosystem, there's a single definition of what rust identifier is (`unicode-xid` has almost 10 million downs, as a `proc_macro2` dependency)
* making it easier to share `rustc_lexer` crate with rust-analyzer: no need to `#[cfg]` if we are building as a part of the compiler
Reasons not to do this:
* increased maintenance burden: we'll need to upgrade unicode version both in libcore and in unicode-xid. However, this shouldn't be a too heavy burden: just running `./unicode.py` after new unicode version. I (@matklad) am ready to be a t-compiler side maintainer of unicode-xid. Moreover, given that xid-unicode is an important dependency of syn, *someone* needs to maintain it anyway.
* xid-unicode implementation is significantly slower. It uses a more compact table with binary search, instead of a trie. However, this shouldn't matter in practice, because we have fast-path for ascii anyway, and code size savings is a plus. Moreover, in rust-lang#59706 not using libcore turned out to be *faster*, presumably beacause checking for whitespace with match is even faster.
<details>
<summary>old description</summary>
Followup to rust-lang#59706
r? @eddyb
Note that this doesn't actually remove tables from libcore, to avoid conflict with rust-lang#62641.
cc unicode-rs/unicode-xid#11
</details>File tree
17 files changed
+111
-510
lines changed- src
- libcore
- char
- unicode
- libfmt_macros
- librustc_lexer
- src
- librustc_mir
- borrow_check
- librustdoc
- libsyntax_ext
- libsyntax
- ext
17 files changed
+111
-510
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1011 | 1011 | | |
1012 | 1012 | | |
1013 | 1013 | | |
| 1014 | + | |
1014 | 1015 | | |
1015 | 1016 | | |
1016 | 1017 | | |
| |||
2372 | 2373 | | |
2373 | 2374 | | |
2374 | 2375 | | |
2375 | | - | |
| 2376 | + | |
2376 | 2377 | | |
2377 | 2378 | | |
2378 | 2379 | | |
| |||
3290 | 3291 | | |
3291 | 3292 | | |
3292 | 3293 | | |
3293 | | - | |
| 3294 | + | |
3294 | 3295 | | |
3295 | 3296 | | |
3296 | 3297 | | |
| |||
3368 | 3369 | | |
3369 | 3370 | | |
3370 | 3371 | | |
| 3372 | + | |
3371 | 3373 | | |
3372 | 3374 | | |
3373 | 3375 | | |
| |||
3976 | 3978 | | |
3977 | 3979 | | |
3978 | 3980 | | |
3979 | | - | |
| 3981 | + | |
3980 | 3982 | | |
3981 | 3983 | | |
3982 | 3984 | | |
| |||
3988 | 3990 | | |
3989 | 3991 | | |
3990 | 3992 | | |
3991 | | - | |
| 3993 | + | |
3992 | 3994 | | |
3993 | 3995 | | |
3994 | 3996 | | |
| |||
4017 | 4019 | | |
4018 | 4020 | | |
4019 | 4021 | | |
| 4022 | + | |
4020 | 4023 | | |
4021 | 4024 | | |
4022 | 4025 | | |
| |||
4532 | 4535 | | |
4533 | 4536 | | |
4534 | 4537 | | |
| 4538 | + | |
| 4539 | + | |
| 4540 | + | |
| 4541 | + | |
| 4542 | + | |
| 4543 | + | |
4535 | 4544 | | |
4536 | 4545 | | |
4537 | 4546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | 550 | | |
574 | 551 | | |
575 | 552 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
728 | 728 | | |
729 | 729 | | |
730 | 730 | | |
731 | | - | |
| 731 | + | |
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| |||
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
844 | | - | |
| 844 | + | |
845 | 845 | | |
846 | 846 | | |
847 | 847 | | |
848 | 848 | | |
849 | | - | |
850 | | - | |
| 849 | + | |
851 | 850 | | |
852 | 851 | | |
853 | 852 | | |
854 | 853 | | |
855 | 854 | | |
856 | | - | |
| 855 | + | |
857 | 856 | | |
858 | 857 | | |
859 | 858 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | | - | |
601 | | - | |
602 | | - | |
| 600 | + | |
| 601 | + | |
603 | 602 | | |
604 | 603 | | |
605 | | - | |
| 604 | + | |
606 | 605 | | |
607 | 606 | | |
608 | 607 | | |
| |||
611 | 610 | | |
612 | 611 | | |
613 | 612 | | |
614 | | - | |
| 613 | + | |
615 | 614 | | |
616 | 615 | | |
617 | 616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 7 | | |
12 | 8 | | |
13 | 9 | | |
14 | 10 | | |
15 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments