Skip to content

Commit 714c8ea

Browse files
authored
Rollup merge of rust-lang#63114 - matthewjasper:hygienic-format-args, r=petrochenkov
Remove gensym in format_args This also fixes some things to allow us to export opaque macros from libcore: * Don't consider items that are only reachable through opaque macros as public/exported (so they aren't linted as needing docs) * Mark private items reachable from the root of libcore as unstable - they are now reachable (in principle) in other crates via macros in libcore r? @petrochenkov
2 parents a038726 + d9d9246 commit 714c8ea

File tree

15 files changed

+310
-63
lines changed

15 files changed

+310
-63
lines changed

src/libcore/macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ pub(crate) mod builtin {
768768
#[stable(feature = "rust1", since = "1.0.0")]
769769
#[allow_internal_unstable(fmt_internals)]
770770
#[rustc_builtin_macro]
771-
#[rustc_macro_transparency = "semitransparent"]
772771
pub macro format_args {
773772
($fmt:expr) => ({ /* compiler built-in */ }),
774773
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
@@ -780,7 +779,6 @@ pub(crate) mod builtin {
780779
language use and is subject to change")]
781780
#[allow_internal_unstable(fmt_internals)]
782781
#[rustc_builtin_macro]
783-
#[rustc_macro_transparency = "semitransparent"]
784782
pub macro format_args_nl {
785783
($fmt:expr) => ({ /* compiler built-in */ }),
786784
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })

src/libcore/unicode/tables.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub const UNICODE_VERSION: UnicodeVersion = UnicodeVersion {
1414
micro: 0,
1515
_priv: (),
1616
};
17-
pub mod general_category {
18-
pub const Cc_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
17+
pub(crate) mod general_category {
18+
const Cc_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
1919
r1: &[
2020
0, 1, 0
2121
],
@@ -28,7 +28,7 @@ pub mod general_category {
2828
Cc_table.lookup(c)
2929
}
3030

31-
pub const N_table: &super::BoolTrie = &super::BoolTrie {
31+
const N_table: &super::BoolTrie = &super::BoolTrie {
3232
r1: [
3333
0x03ff000000000000, 0x0000000000000000, 0x720c000000000000, 0x0000000000000000,
3434
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
@@ -141,8 +141,8 @@ pub mod general_category {
141141

142142
}
143143

144-
pub mod derived_property {
145-
pub const Alphabetic_table: &super::BoolTrie = &super::BoolTrie {
144+
pub(crate) mod derived_property {
145+
const Alphabetic_table: &super::BoolTrie = &super::BoolTrie {
146146
r1: [
147147
0x0000000000000000, 0x07fffffe07fffffe, 0x0420040000000000, 0xff7fffffff7fffff,
148148
0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff,
@@ -327,7 +327,7 @@ pub mod derived_property {
327327
Alphabetic_table.lookup(c)
328328
}
329329

330-
pub const Case_Ignorable_table: &super::BoolTrie = &super::BoolTrie {
330+
const Case_Ignorable_table: &super::BoolTrie = &super::BoolTrie {
331331
r1: [
332332
0x0400408000000000, 0x0000000140000000, 0x0190a10000000000, 0x0000000000000000,
333333
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
@@ -464,7 +464,7 @@ pub mod derived_property {
464464
Case_Ignorable_table.lookup(c)
465465
}
466466

467-
pub const Cased_table: &super::BoolTrie = &super::BoolTrie {
467+
const Cased_table: &super::BoolTrie = &super::BoolTrie {
468468
r1: [
469469
0x0000000000000000, 0x07fffffe07fffffe, 0x0420040000000000, 0xff7fffffff7fffff,
470470
0xffffffffffffffff, 0xffffffffffffffff, 0xf7ffffffffffffff, 0xfffffffffffffff0,
@@ -565,7 +565,7 @@ pub mod derived_property {
565565
Cased_table.lookup(c)
566566
}
567567

568-
pub const Grapheme_Extend_table: &super::BoolTrie = &super::BoolTrie {
568+
const Grapheme_Extend_table: &super::BoolTrie = &super::BoolTrie {
569569
r1: [
570570
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
571571
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
@@ -689,7 +689,7 @@ pub mod derived_property {
689689
Grapheme_Extend_table.lookup(c)
690690
}
691691

692-
pub const Lowercase_table: &super::BoolTrie = &super::BoolTrie {
692+
const Lowercase_table: &super::BoolTrie = &super::BoolTrie {
693693
r1: [
694694
0x0000000000000000, 0x07fffffe00000000, 0x0420040000000000, 0xff7fffff80000000,
695695
0x55aaaaaaaaaaaaaa, 0xd4aaaaaaaaaaab55, 0xe6512d2a4e243129, 0xaa29aaaab5555240,
@@ -789,7 +789,7 @@ pub mod derived_property {
789789
Lowercase_table.lookup(c)
790790
}
791791

792-
pub const Uppercase_table: &super::BoolTrie = &super::BoolTrie {
792+
const Uppercase_table: &super::BoolTrie = &super::BoolTrie {
793793
r1: [
794794
0x0000000000000000, 0x0000000007fffffe, 0x0000000000000000, 0x000000007f7fffff,
795795
0xaa55555555555555, 0x2b555555555554aa, 0x11aed2d5b1dbced6, 0x55d255554aaaa490,
@@ -890,7 +890,7 @@ pub mod derived_property {
890890
Uppercase_table.lookup(c)
891891
}
892892

893-
pub const XID_Continue_table: &super::BoolTrie = &super::BoolTrie {
893+
const XID_Continue_table: &super::BoolTrie = &super::BoolTrie {
894894
r1: [
895895
0x03ff000000000000, 0x07fffffe87fffffe, 0x04a0040000000000, 0xff7fffffff7fffff,
896896
0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff,
@@ -1068,7 +1068,7 @@ pub mod derived_property {
10681068
XID_Continue_table.lookup(c)
10691069
}
10701070

1071-
pub const XID_Start_table: &super::BoolTrie = &super::BoolTrie {
1071+
const XID_Start_table: &super::BoolTrie = &super::BoolTrie {
10721072
r1: [
10731073
0x0000000000000000, 0x07fffffe07fffffe, 0x0420040000000000, 0xff7fffffff7fffff,
10741074
0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff,
@@ -1250,8 +1250,8 @@ pub mod derived_property {
12501250

12511251
}
12521252

1253-
pub mod property {
1254-
pub const Pattern_White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
1253+
pub(crate) mod property {
1254+
const Pattern_White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
12551255
r1: &[
12561256
0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
12571257
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -1268,7 +1268,7 @@ pub mod property {
12681268
Pattern_White_Space_table.lookup(c)
12691269
}
12701270

1271-
pub const White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
1271+
const White_Space_table: &super::SmallBoolTrie = &super::SmallBoolTrie {
12721272
r1: &[
12731273
0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
12741274
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -1290,7 +1290,7 @@ pub mod property {
12901290

12911291
}
12921292

1293-
pub mod conversions {
1293+
pub(crate) mod conversions {
12941294
pub fn to_lower(c: char) -> [char; 3] {
12951295
match bsearch_case_table(c, to_lowercase_table) {
12961296
None => [c, '\0', '\0'],

src/libcore/unicode/unicode.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def compute_trie(raw_data, chunk_size):
606606
return root, child_data
607607

608608

609-
def generate_bool_trie(name, codepoint_ranges, is_pub=True):
609+
def generate_bool_trie(name, codepoint_ranges, is_pub=False):
610610
# type: (str, List[Tuple[int, int]], bool) -> Iterator[str]
611611
"""
612612
Generate Rust code for BoolTrie struct.
@@ -681,7 +681,7 @@ def generate_bool_trie(name, codepoint_ranges, is_pub=True):
681681
yield " };\n\n"
682682

683683

684-
def generate_small_bool_trie(name, codepoint_ranges, is_pub=True):
684+
def generate_small_bool_trie(name, codepoint_ranges, is_pub=False):
685685
# type: (str, List[Tuple[int, int]], bool) -> Iterator[str]
686686
"""
687687
Generate Rust code for `SmallBoolTrie` struct.
@@ -726,7 +726,7 @@ def generate_property_module(mod, grouped_categories, category_subset):
726726
Generate Rust code for module defining properties.
727727
"""
728728

729-
yield "pub mod %s {\n" % mod
729+
yield "pub(crate) mod %s {\n" % mod
730730
for cat in sorted(category_subset):
731731
if cat in ("Cc", "White_Space", "Pattern_White_Space"):
732732
generator = generate_small_bool_trie("%s_table" % cat, grouped_categories[cat])
@@ -749,7 +749,7 @@ def generate_conversions_module(unicode_data):
749749
Generate Rust code for module defining conversions.
750750
"""
751751

752-
yield "pub mod conversions {"
752+
yield "pub(crate) mod conversions {"
753753
yield """
754754
pub fn to_lower(c: char) -> [char; 3] {
755755
match bsearch_case_table(c, to_lowercase_table) {

0 commit comments

Comments
 (0)