summary refs log tree commit diff
path: root/src/librustc_metadata/encoder.rs
AgeCommit message (Collapse)AuthorLines
2016-09-20rustc_metadata: reduce Lazy{,Seq} overhead by using a relative encoding.Eduard Burtescu-15/+58
2016-09-20rustc_metadata: replace RBML with a simple and type-safe scheme.Eduard Burtescu-757/+773
2016-09-20rustc_metadata: split the Def description of a DefId from item_children.Eduard Burtescu-0/+1
2016-09-20rustc_metadata: move all encoding/decoding helpers to methods.Eduard Burtescu-224/+219
2016-09-20rustc_metadata: use the shorthand encoding for predicates also.Eduard Burtescu-68/+42
2016-09-20rustc_metadata: group information into less tags.Eduard Burtescu-698/+371
2016-09-20rustc_metadata: group the tags into root tags and item tags.Eduard Burtescu-68/+66
2016-09-20rustc: remove ImplOrTraitItemId and TraitDef's associated_type_names.Eduard Burtescu-14/+3
2016-09-20rustc_metadata: move more RBML tags to auto-serialization.Eduard Burtescu-566/+374
2016-09-20rustc_metadata: remove ty{en,de}code and move to auto-derived serialization.Eduard Burtescu-15/+36
2016-09-20rustc_metadata: side-step ty{en,de}code for everything but Ty.Eduard Burtescu-34/+5
2016-09-20Remove librbml and the RBML-tagged auto-encoder/decoder.Eduard Burtescu-110/+134
2016-09-20rustc_trans: use the TypeId hashing mechanism instead of metadata.Eduard Burtescu-16/+1
2016-09-20rustc_metadata: go back to not using the opaque format.Eduard Burtescu-9/+9
2016-09-20rustc_metadata: go only through rustc_serialize in astencode.Eduard Burtescu-5/+4
2016-09-20rustc_metadata: combine DecodeContext and rbml::reader::Decoder.Eduard Burtescu-25/+1
2016-09-20rustc_metadata: encode miscellaneous information opaquely.Eduard Burtescu-13/+9
2016-09-20rustc_metadata: use specialization for {en,de}coding Ty and Substs.Eduard Burtescu-1/+44
2016-09-20rustc_metadata: combine EncodeContext and rbml::writer::Encoder.Eduard Burtescu-678/+627
2016-09-13Remove some ancient code providing special support for newtypesVadim Petrochenkov-28/+0
2016-09-06remove the "misc-items" from meta-dataNiko Matsakis-30/+5
It was duplicating information available elsewhere.
2016-09-04Replace `_, _` with `..`Vadim Petrochenkov-1/+1
2016-09-04Replace `_, _, _` with `..`Vadim Petrochenkov-4/+4
2016-09-03Fix rebaseVadim Petrochenkov-1/+32
2016-09-03Add unions to HIRVadim Petrochenkov-0/+3
2016-09-02rustc: Implement custom derive (macros 1.1)Alex Crichton-3/+10
This commit is an implementation of [RFC 1681] which adds support to the compiler for first-class user-define custom `#[derive]` modes with a far more stable API than plugins have today. [RFC 1681]: https://github.com/rust-lang/rfcs/blob/master/text/1681-macros-1.1.md The main features added by this commit are: * A new `rustc-macro` crate-type. This crate type represents one which will provide custom `derive` implementations and perhaps eventually flower into the implementation of macros 2.0 as well. * A new `rustc_macro` crate in the standard distribution. This crate will provide the runtime interface between macro crates and the compiler. The API here is particularly conservative right now but has quite a bit of room to expand into any manner of APIs required by macro authors. * The ability to load new derive modes through the `#[macro_use]` annotations on other crates. All support added here is gated behind the `rustc_macro` feature gate, both for the library support (the `rustc_macro` crate) as well as the language features. There are a few minor differences from the implementation outlined in the RFC, such as the `rustc_macro` crate being available as a dylib and all symbols are `dlsym`'d directly instead of having a shim compiled. These should only affect the implementation, however, not the public interface. This commit also ended up touching a lot of code related to `#[derive]`, making a few notable changes: * Recognized derive attributes are no longer desugared to `derive_Foo`. Wasn't sure how to keep this behavior and *not* expose it to custom derive. * Derive attributes no longer have access to unstable features by default, they have to opt in on a granular level. * The `derive(Copy,Clone)` optimization is now done through another "obscure attribute" which is just intended to ferry along in the compiler that such an optimization is possible. The `derive(PartialEq,Eq)` optimization was also updated to do something similar. --- One part of this PR which needs to be improved before stabilizing are the errors and exact interfaces here. The error messages are relatively poor quality and there are surprising spects of this such as `#[derive(PartialEq, Eq, MyTrait)]` not working by default. The custom attributes added by the compiler end up becoming unstable again when going through a custom impl. Hopefully though this is enough to start allowing experimentation on crates.io! syntax-[breaking-change]
2016-08-30Auto merge of #36066 - jseyfried:rollup, r=Manishearthbors-33/+4
Batch up libsyntax breaking changes Batch of the following syntax-[breaking-change] changes: - #35591: Add a field `span: Span` to `ast::Generics`. - #35618: Remove variant `Mod` of `ast::PathListItemKind` and refactor the remaining variant `ast::PathListKind::Ident` to a struct `ast::PathListKind_`. - #35480: Change uses of `Constness` in the AST to `Spanned<Constness>`. - c.f. `MethodSig`, `ItemKind` - #35728: Refactor `cx.pat_enum()` into `cx.pat_tuple_struct()` and `cx.pat_path()`. - #35850: Generalize the elements of lists in attributes from `MetaItem` to a new type `NestedMetaItem` that can represent a `MetaItem` or a literal. - #35917: Remove traits `AttrMetaMethods`, `AttributeMethods`, and `AttrNestedMetaItemMethods`. - Besides removing imports of these traits, this won't cause fallout. - Add a variant `Union` to `ItemKind` to future proof for `union` (c.f. #36016). - Remove inherent methods `attrs` and `fold_attrs` of `Annotatable`. - Use methods `attrs` and `map_attrs` of `HasAttrs` instead. r? @Manishearth
2016-08-27Make metadata encoding deterministicJonas Schievink-1/+6
`ty::Predicate` was being used as a key for a hash map, but its hash implementation indirectly hashed addresses, which vary between each compiler run. This is fixed by sorting predicates by their ID before encoding them. In my tests, rustc is now able to produce deterministic results when compiling libcore and libstd. I've beefed up `run-make/reproducible-build` to compare the produced artifacts bit-by-bit. This doesn't catch everything, but should be a good start. cc #34902
2016-08-25Implement RFC#1559: allow all literals in attributes.Sergio Benitez-33/+4
2016-08-24Remove AST from metadata except for consts and const fns.Eduard Burtescu-20/+6
2016-08-17remove seemingly unnecessary call to encode_predicatesNiko Matsakis-4/+0
2016-08-17remove `usize: DepGraphRead` and add `Untracked`Niko Matsakis-7/+18
The idea is that a `usize` is sort of ambiguous: in this case, it represents indices that do not need tracking, but it could as easily be some data read out from a tracked location, and hence represent tracked data. Therefore, we add an `Untracked` type that lets user assert that value is not tracked. Also correct various typos.
2016-08-17Add a comment, remove Deref/DerefMutNiko Matsakis-7/+7
The comment explains the `index-builder` pattern. We no longer need the `Deref/DerefMut` relationship, and it seems nicer without it.
2016-08-17pacify the mercilous tidyNiko Matsakis-2/+3
2016-08-17create a trait to ensure that data is trackedNiko Matsakis-16/+17
Also write a comment explaining the system.
2016-08-17change callback for expr/type to a fn pointerNiko Matsakis-59/+57
The idea is that, this way, we can cleanly isolate ALL state that is being passed, since it goes as an argument to the fn pointer.
2016-08-17extract two more record callsNiko Matsakis-55/+61
2016-08-17extract encode_info_for_trait_item into methodNiko Matsakis-100/+109
2016-08-17pull out call to `record` for impl itemsNiko Matsakis-99/+103
2016-08-17don't pass extra state fo encode_struct_ctorNiko Matsakis-34/+33
2016-08-17pull out encode_fieldNiko Matsakis-18/+31
2016-08-17pull out code for encoding enum variantsNiko Matsakis-43/+40
2016-08-17pull out the record call for encode_info_for_itemNiko Matsakis-242/+226
2016-08-17separate main items from addl items in metadataNiko Matsakis-154/+220
2016-08-17move rbml_w into the self structNiko Matsakis-409/+379
2016-08-17make record take a closureNiko Matsakis-540/+509
2016-08-17introduce Deref/DerefMut to model subtype relNiko Matsakis-6/+12
The idea is that ItemContentBuilder is a base-type of IndexBuilder.
2016-08-17move free encode fns into methods of IndexBuilderNiko Matsakis-896/+902
2016-08-17put ecx into IndexBuilder so we don't have to passNiko Matsakis-45/+50
2016-08-17rename CrateIndex to IndexBuilderNiko Matsakis-18/+18