Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure metadata encoder to track deps precisely #35684

Merged
merged 22 commits into from
Aug 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b5fa8ab
move CrateIndex into its own module
nikomatsakis Aug 10, 2016
85ac63e
rename CrateIndex to IndexBuilder
nikomatsakis Aug 10, 2016
25bb51d
store ecx, not dep-graph
nikomatsakis Aug 10, 2016
92f269e
put ecx into IndexBuilder so we don't have to pass
nikomatsakis Aug 10, 2016
b2c7922
move free encode fns into methods of IndexBuilder
nikomatsakis Aug 10, 2016
6b76932
introduce Deref/DerefMut to model subtype rel
nikomatsakis Aug 10, 2016
baccdc0
make record take a closure
nikomatsakis Aug 11, 2016
d49e1a9
move rbml_w into the self struct
nikomatsakis Aug 12, 2016
6277b1f
separate main items from addl items in metadata
nikomatsakis Aug 12, 2016
5166682
pull out the record call for encode_info_for_item
nikomatsakis Aug 12, 2016
f351963
pull out code for encoding enum variants
nikomatsakis Aug 12, 2016
c716ad8
pull out encode_field
nikomatsakis Aug 12, 2016
9afcd77
don't pass extra state fo encode_struct_ctor
nikomatsakis Aug 14, 2016
8dc8151
pull out call to `record` for impl items
nikomatsakis Aug 14, 2016
8c4a224
extract encode_info_for_trait_item into method
nikomatsakis Aug 14, 2016
c0c8ab9
extract two more record calls
nikomatsakis Aug 14, 2016
00e699f
change callback for expr/type to a fn pointer
nikomatsakis Aug 15, 2016
f3990fe
create a trait to ensure that data is tracked
nikomatsakis Aug 15, 2016
1a91e67
pacify the mercilous tidy
nikomatsakis Aug 15, 2016
9daea5b
Add a comment, remove Deref/DerefMut
nikomatsakis Aug 15, 2016
6b33f47
remove `usize: DepGraphRead` and add `Untracked`
nikomatsakis Aug 16, 2016
37d974f
remove seemingly unnecessary call to encode_predicates
nikomatsakis Aug 17, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,10 @@ fn reexports<'a>(d: rbml::Doc<'a>) -> reader::TaggedDocsIterator<'a> {
reader::tagged_docs(d, tag_items_data_item_reexport)
}

fn variant_disr_val(d: rbml::Doc) -> Option<u64> {
reader::maybe_get_doc(d, tag_disr_val).and_then(|val_doc| {
reader::with_doc_data(val_doc, |data| {
str::from_utf8(data).ok().and_then(|s| s.parse().ok())
})
fn variant_disr_val(d: rbml::Doc) -> u64 {
let val_doc = reader::get_doc(d, tag_disr_val);
reader::with_doc_data(val_doc, |data| {
str::from_utf8(data).unwrap().parse().unwrap()
})
}

Expand Down Expand Up @@ -402,17 +401,10 @@ pub fn get_adt_def<'a, 'tcx>(cdata: Cmd,
}
}
fn get_enum_variants<'tcx>(cdata: Cmd, doc: rbml::Doc) -> Vec<ty::VariantDefData<'tcx, 'tcx>> {
let mut disr_val = 0;
reader::tagged_docs(doc, tag_items_data_item_variant).map(|p| {
let did = translated_def_id(cdata, p);
let item = cdata.lookup_item(did.index);

if let Some(disr) = variant_disr_val(item) {
disr_val = disr;
}
let disr = disr_val;
disr_val = disr_val.wrapping_add(1);

let disr = variant_disr_val(item);
ty::VariantDefData {
did: did,
name: item_name(item),
Expand Down
Loading