Skip to content

Commit 1cf592f

Browse files
authored
Auto merge of #36551 - eddyb:meta-games, r=nikomatsakis
Refactor away RBML from rustc_metadata. RBML and `ty{en,de}code` have had their long-overdue purge. Summary of changes: * Metadata is now a tree encoded in post-order and with relative backward references pointing to children nodes. With auto-deriving and type safety, this makes maintenance and adding new information to metadata painless and bug-free by default. It's also more compact and cache-friendly (cache misses should be proportional to the depth of the node being accessed, not the number of siblings as in EBML/RBML). * Metadata sizes have been reduced, for `libcore` it went down 16% (`8.38MB` -> `7.05MB`) and for `libstd` 14% (`3.53MB` -> `3.03MB`), while encoding more or less the same information * Specialization is used in the bundled `libserialize` (crates.io `rustc_serialize` remains unaffected) to customize the encoding (and more importantly, decoding) of various types, most notably those interned in the `TyCtxt`. Some of this abuses a soundness hole pending a fix (cc @aturon), but when that fix arrives, we'll move to macros 1.1 `#[derive]` and custom `TyCtxt`-aware serialization traits. * Enumerating children of modules from other crates is now orthogonal to describing those items via `Def` - this is a step towards bridging crate-local HIR and cross-crate metadata * `CrateNum` has been moved to `rustc` and both it and `NodeId` are now newtypes instead of `u32` aliases, for specializing their decoding. This is `[syntax-breaking]` (cc @Manishearth ). cc @rust-lang/compiler
2 parents 4f9812a + 4ac3001 commit 1cf592f

File tree

154 files changed

+4646
-12234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+4646
-12234
lines changed

mk/crates.mk

+4-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_
6161
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis \
6262
rustc_const_eval rustc_const_math rustc_incremental rustc_macro
6363
HOST_CRATES := syntax syntax_ext proc_macro syntax_pos $(RUSTC_CRATES) rustdoc fmt_macros \
64-
flate arena graphviz rbml log serialize
64+
flate arena graphviz log serialize
6565
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
6666

6767
DEPS_core :=
@@ -96,7 +96,6 @@ DEPS_getopts := std
9696
DEPS_graphviz := std
9797
DEPS_log := std
9898
DEPS_num := std
99-
DEPS_rbml := std log serialize
10099
DEPS_serialize := std log
101100
DEPS_term := std
102101
DEPS_test := std getopts term native:rust_test_helpers
@@ -110,7 +109,7 @@ DEPS_rustc_const_math := std syntax log serialize
110109
DEPS_rustc_const_eval := rustc_const_math rustc syntax log serialize \
111110
rustc_back graphviz syntax_pos
112111

113-
DEPS_rustc := syntax fmt_macros flate arena serialize getopts rbml \
112+
DEPS_rustc := syntax fmt_macros flate arena serialize getopts \
114113
log graphviz rustc_llvm rustc_back rustc_data_structures\
115114
rustc_const_math syntax_pos rustc_errors
116115
DEPS_rustc_back := std syntax flate log libc
@@ -126,7 +125,7 @@ DEPS_rustc_errors := log libc serialize syntax_pos
126125
DEPS_rustc_lint := rustc log syntax syntax_pos rustc_const_eval
127126
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
128127
DEPS_rustc_macro := std syntax
129-
DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rbml rustc_const_math \
128+
DEPS_rustc_metadata := rustc syntax syntax_pos rustc_errors rustc_const_math \
130129
rustc_macro syntax_ext
131130
DEPS_rustc_passes := syntax syntax_pos rustc core rustc_const_eval rustc_errors
132131
DEPS_rustc_mir := rustc syntax syntax_pos rustc_const_math rustc_const_eval rustc_bitflags
@@ -137,7 +136,7 @@ DEPS_rustc_privacy := rustc log syntax syntax_pos
137136
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back \
138137
log syntax serialize rustc_llvm rustc_platform_intrinsics \
139138
rustc_const_math rustc_const_eval rustc_incremental rustc_errors syntax_pos
140-
DEPS_rustc_incremental := rbml rustc syntax_pos serialize rustc_data_structures
139+
DEPS_rustc_incremental := rustc syntax_pos serialize rustc_data_structures
141140
DEPS_rustc_save_analysis := rustc log syntax syntax_pos serialize
142141
DEPS_rustc_typeck := rustc syntax syntax_pos rustc_platform_intrinsics rustc_const_math \
143142
rustc_const_eval rustc_errors

mk/tests.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ TEST_TARGET_CRATES = $(filter-out core rustc_unicode alloc_system libc \
2727
panic_abort,$(TARGET_CRATES)) \
2828
collectionstest coretest
2929
TEST_DOC_CRATES = $(DOC_CRATES) arena flate fmt_macros getopts graphviz \
30-
log rand rbml serialize syntax term test
30+
log rand serialize syntax term test
3131
TEST_HOST_CRATES = $(filter-out rustc_typeck rustc_borrowck rustc_resolve \
3232
rustc_trans rustc_lint,\
3333
$(HOST_CRATES))

src/librbml/Cargo.toml

-13
This file was deleted.

0 commit comments

Comments
 (0)