summary refs log tree commit diff
path: root/src/librustc/metadata/decoder.rs
AgeCommit message (Collapse)AuthorLines
2013-09-24Correctly encode item visibility in metadataAlex Crichton-17/+26
This fixes private statics and functions from being usable cross-crates, along with some bad privacy error messages. This is a reopening of #8365 with all the privacy checks in privacy.rs instead of resolve.rs (where they should be anyway). These maps of exported items will hopefully get used for generating documentation by rustdoc Closes #8592
2013-09-12std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}Erick Tryzelaar-1/+1
2013-09-11ident->name cleanupJohn Clements-2/+3
2013-09-11Properly encode/decode structural variants.SiegeLord-7/+14
2013-09-05Rename str::from_bytes to str::from_utf8, closes #8985Florian Hahn-1/+1
2013-09-04auto merge of #8875 : alexcrichton/rust/fix-inner-static-library-bug, r=huonwbors-0/+9
These commits fix bugs related to identically named statics in functions of implementations in various situations. The commit messages have most of the information about what bugs are being fixed and why. As a bonus, while I was messing around with name mangling, I improved the backtraces we'll get in gdb by removing `__extensions__` for the trait/type being implemented and by adding the method name as well. Yay!
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-47/+47
2013-09-02Remove __extensions__ in names for a "pretty name"Alex Crichton-0/+9
As with the previous commit, this is targeted at removing the possibility of collisions between statics. The main use case here is when there's a type-parametric function with an inner static that's compiled as a library. Before this commit, any impl would generate a path item of "__extensions__". This changes this identifier to be a "pretty name", which is either the last element of the path of the trait implemented or the last element of the type's path that's being implemented. That doesn't quite cut it though, so the (trait, type) pair is hashed and again used to append information to the symbol. Essentially, __extensions__ was removed for something nicer for debugging, and then some more information was added to symbol name by including a hash of the trait being implemented and type it's being implemented for. This should prevent colliding names for inner statics in regular functions with similar names.
2013-09-02Renamed syntax::ast::ident -> IdentMarvin Löbel-9/+9
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-78/+78
2013-08-27auto merge of #8805 : jfager/rust/remove-hashutil, r=alexcrichtonbors-1/+0
2013-08-27librustc: Fix problem with cross-crate reexported static methods.Patrick Walton-6/+50
2013-08-27librustc: Implement basic lazy implementation loading.Patrick Walton-1/+61
This is only for implementations defined in the same crate as the trait they implement.
2013-08-27librustc: Remove `each_path`.Patrick Walton-37/+103
This does not implement lazy symbol resolution yet.
2013-08-27librustc: Stop calling `each_path` in coherence.Patrick Walton-0/+10
10% win or so for small crates.
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-8/+12
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-27librustc: Remove `&const` and `*const` from the language.Patrick Walton-6/+3
They are still present as part of the borrow check.
2013-08-27Replace HashUtil w/ default method on HashJason Fager-1/+0
2013-08-24Make enum discriminants u64 instead of the host uint.Jed Davis-3/+3
2013-08-20Allow traits to use builtin kinds as supertraits for #7083.Ben Blum-1/+19
2013-08-09auto merge of #8361 : alexcrichton/rust/fix-node-hashes-in-crates, r=thestingerbors-6/+6
When running rusti 32-bit tests from a 64-bit host, these errors came up frequently. My best idea as to what was happening is: 1. First, if you hash the same `int` value on 32-bit and 64-bit, you will get two different hashes. 2. In a cross-compile situation, let's say x86_64 is building an i686 library, all of the hashes will be 64-bit hashes. 3. Then let's say you use the i686 libraries and then attempt to link against the same i686 libraries, because you're calculating hashes with a 32-bit int instead of a 64-bit one, you'll have different hashes and you won't be able to find items in the metadata (the items were generated with a 64-bit int). This patch changes the items to always be hashed as an `i64` to preserve the hash value across architectures. Here's a nice before/after for this patch of the state of rusti tests ``` host target before after 64 64 yes yes 64 32 no no (llvm assertion) 32 64 no yes 32 32 no no (llvm assertion) ``` Basically one case started working, but currently when the target is 32-bit LLVM is having a lot of problems generating code. That's another separate issue though.
2013-08-07core: option.map_consume -> option.map_moveErick Tryzelaar-6/+6
2013-08-06Fix node hashesAlex Crichton-6/+6
2013-08-03remove obsolete `foreach` keywordDaniel Micay-5/+5
this has been replaced by `for`
2013-08-03replace all remaining `for` with `foreach` or `do`Daniel Micay-81/+100
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-5/+5
2013-07-29New naming convention for ast::{node_id, local_crate, crate_node_id, ↵Michael Woerister-26/+26
blk_check_mode, ty_field, ty_method}
2013-07-25auto merge of #8015 : msullivan/rust/default-methods, r=nikomatsakisbors-0/+18
Lots of changes to vtable resolution, handling of super/self method calls in default methods. Fix a lot of trait inheritance bugs. r? @nikomatsakis
2013-07-24Allow uint discriminants and store them as suchKevin Murphy-3/+3
Infers type of constants used as discriminants and ensures they are integral, instead of forcing them to be a signed integer. Also, stores discriminant values as uint instead of int interally and deals with related fallout. Fixes issue #7994
2013-07-23Properly track and export information about vtables for impls in metadata.Michael Sullivan-0/+18
Partially rework how vtables are handled in default method calls. Closes #7460.
2013-07-22Ast spanned<T> refactoring, renaming: crate, local, blk, crate_num, crate_cfg.Michael Woerister-5/+5
`crate => Crate` `local => Local` `blk => Block` `crate_num => CrateNum` `crate_cfg => CrateConfig` Also, Crate and Local are not wrapped in spanned<T> anymore.
2013-07-20auto merge of #7902 : huonw/rust/attr++, r=cmr,pcwaltonbors-9/+9
This does a number of things, but especially dramatically reduce the number of allocations performed for operations involving attributes/ meta items: - Converts ast::meta_item & ast::attribute and other associated enums to CamelCase. - Converts several standalone functions in syntax::attr into methods, defined on two traits AttrMetaMethods & AttributeMethods. The former is common to both MetaItem and Attribute since the latter is a thin wrapper around the former. - Deletes functions that are unnecessary due to iterators. - Converts other standalone functions to use iterators and the generic AttrMetaMethods rather than allocating a lot of new vectors (e.g. the old code would have to allocate a new vector to use functions that operated on &[meta_item] on &[attribute].) - Moves the core algorithm of the #[cfg] matching to syntax::attr, similar to find_inline_attr and find_linkage_metas. This doesn't have much of an effect on the speed of #[cfg] stripping, despite hugely reducing the number of allocations performed; presumably most of the time is spent in the ast folder rather than doing attribute checks. Also fixes the Eq instance of MetaItem_ to correctly ignore spans, so that `rustc --cfg 'foo(bar)'` now works.
2013-07-20auto merge of #7710 : michaelwoerister/rust/WP4, r=jdmbors-7/+12
This pull request includes various improvements: + Composite types (structs, tuples, boxes, etc) are now handled more cleanly by debuginfo generation. Most notably, field offsets are now extracted directly from LLVM types, as opposed to trying to reconstruct them. This leads to more stable handling of edge cases (e.g. packed structs or structs implementing drop). + `debuginfo.rs` in general has seen a major cleanup. This includes better formatting, more readable variable and function names, removal of dead code, and better factoring of functionality. + Handling of `VariantInfo` in `ty.rs` has been improved. That is, the `type VariantInfo = @VariantInfo_` typedef has been replaced with explicit uses of @VariantInfo, and the duplicated logic for creating VariantInfo instances in `ty::enum_variants()` and `typeck::check::mod::check_enum_variants()` has been unified into a single constructor function. Both function now look nicer too :) + Debug info generation for enum types is now mostly supported. This includes: + Good support for C-style enums. Both DWARF and `gdb` know how to handle them. + Proper description of tuple- and struct-style enum variants as unions of structs. + Proper handling of univariant enums without discriminator field. + Unfortunately `gdb` always prints all possible interpretations of a union, so debug output of enums is verbose and unintuitive. Neither `LLVM` nor `gdb` support DWARF's `DW_TAG_variant` which allows to properly describe tagged unions. Adding support for this to `LLVM` seems doable. `gdb` however is another story. In the future we might be able to use `gdb`'s Python scripting support to alleviate this problem. In agreement with @jdm this is not a high priority for now. + The debuginfo test suite has been extended with 14 test files including tests for packed structs (with Drop), boxed structs, boxed vecs, vec slices, c-style enums (standalone and embedded), empty enums, tuple- and struct-style enums, and various pointer types to the above. ~~What is not yet included is DI support for some enum edge-cases represented as described in `trans::adt::NullablePointer`.~~ Cheers, Michael PS: closes #7819, fixes #7712
2013-07-20syntax: modernise attribute handling in syntax::attr.Huon Wilson-9/+9
This does a number of things, but especially dramatically reduce the number of allocations performed for operations involving attributes/ meta items: - Converts ast::meta_item & ast::attribute and other associated enums to CamelCase. - Converts several standalone functions in syntax::attr into methods, defined on two traits AttrMetaMethods & AttributeMethods. The former is common to both MetaItem and Attribute since the latter is a thin wrapper around the former. - Deletes functions that are unnecessary due to iterators. - Converts other standalone functions to use iterators and the generic AttrMetaMethods rather than allocating a lot of new vectors (e.g. the old code would have to allocate a new vector to use functions that operated on &[meta_item] on &[attribute].) - Moves the core algorithm of the #[cfg] matching to syntax::attr, similar to find_inline_attr and find_linkage_metas. This doesn't have much of an effect on the speed of #[cfg] stripping, despite hugely reducing the number of allocations performed; presumably most of the time is spent in the ast folder rather than doing attribute checks. Also fixes the Eq instance of MetaItem_ to correctly ignore spaces, so that `rustc --cfg 'foo(bar)'` now works.
2013-07-19Cleanup of ty::VariantInfo and related functions.Michael Woerister-3/+3
2013-07-19debuginfo: Added support for struct-style enums.Michael Woerister-5/+10
2013-07-18Export information about used default methods instead of regenerating it. ↵Michael Sullivan-1/+8
Closes #7862.
2013-07-18Add provided method information to ty::Method. Get rid of ProvidedMethodSource.Michael Sullivan-16/+18
2013-07-18Get rid of resolve::MethodInfo. Closes #4946.Michael Sullivan-14/+9
2013-07-17librustc: Remove all uses of "copy".Patrick Walton-2/+3
2013-07-17librustc: Add a lint mode for unnecessary `copy` and remove a bunch of them.Patrick Walton-7/+5
2013-07-12Remove the global 'vec::to_owned' functionAlex Crichton-1/+1
2013-07-07De-share trait_refJames Miller-1/+1
Also, makes the pretty-printer use & instead of @ as much as possible, which will help with later changes, though in the interim has produced some... interesting constructs.
2013-06-30auto merge of #7468 : cmr/rust/great_renaming, r=pcwaltonbors-9/+8
2013-06-29Remove mutability from unique boxes in the ASTAlex Crichton-1/+1
2013-06-29Warning cleanupCorey Richardson-1/+1
2013-06-29Great renaming: propagate throughout the rest of the codebaseCorey Richardson-8/+7
2013-06-28librustc: Fix even *more* merge fallout!Patrick Walton-4/+4
2013-06-28librustc: Fix more merge fallout.Patrick Walton-4/+4
2013-06-28Rewrite each_path to allow performance improvements in the future.Patrick Walton-93/+230
Instead of determining paths from the path tag, we iterate through modules' children recursively in the metadata. This will allow for lazy external module resolution.