summary refs log tree commit diff
path: root/src/librustc/metadata
AgeCommit message (Collapse)AuthorLines
2013-09-24Correctly encode item visibility in metadataAlex Crichton-25/+52
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-23librustc: Remove garbage collected functions from front/{config,test} and ↵Patrick Walton-3/+2
metadata/{tydecode,tyencode}
2013-09-16Resume inlining globals across cratesAlex Crichton-1/+7
In #8185 cross-crate condition handlers were fixed by ensuring that globals didn't start appearing in different crates with different addressed. An unfortunate side effect of that pull request is that constants weren't inlined across crates (uint::bits is unknown to everything but libstd). This commit fixes this inlining by using the `available_eternally` linkage provided by LLVM. It partially reverts #8185, and then adds support for this linkage type. The main caveat is that not all statics could be inlined into other crates. Before this patch, all statics were considered "inlineable items", but an unfortunate side effect of how we deal with `&static` and `&[static]` means that these two cases cannot be inlined across crates. The translation of constants was modified to propogate this condition of whether a constant should be considered inlineable into other crates. Closes #9036
2013-09-16auto merge of #9206 : alexcrichton/rust/issue-9188, r=catamorphismbors-1/+2
While they may have the same name within various scopes, this changes static names to use path_pretty_name to append some hash information at the end of the symbol. We're then guaranteed that each static has a unique NodeId, so this NodeId is as the "hash" of the pretty name. Closes #9188
2013-09-14Guarantee that statics have unique namesAlex Crichton-1/+2
While they may have the same name within various scopes, this changes static names to use path_pretty_name to append some hash information at the end of the symbol. We're then guaranteed that each static has a unique NodeId, so this NodeId is as the "hash" of the pretty name. Closes #9188
2013-09-14auto merge of #9115 : erickt/rust/master, r=ericktbors-2/+2
This is a series of patches to modernize option and result. The highlights are: * rename `.unwrap_or_default(value)` and etc to `.unwrap_or(value)` * add `.unwrap_or_default()` that uses the `Default` trait * add `Default` implementations for vecs, HashMap, Option * add `Option.and(T) -> Option<T>`, `Option.and_then(&fn() -> Option<T>) -> Option<T>`, `Option.or(T) -> Option<T>`, and `Option.or_else(&fn() -> Option<T>) -> Option<T>` * add `option::ToOption`, `option::IntoOption`, `option::AsOption`, `result::ToResult`, `result::IntoResult`, `result::AsResult`, `either::ToEither`, and `either::IntoEither`, `either::AsEither` * renamed `Option::chain*` and `Result::chain*` to `and_then` and `or_else` to avoid the eventual collision with `Iterator.chain`. * Added a bunch of impls of `Default` * Added a `#[deriving(Default)]` syntax extension * Removed impls of `Zero` for `Option<T>` and vecs.
2013-09-13rustc/rustpkg: Use a target-specific subdirectory in build/ and lib/Tim Chevalier-6/+11
As per rustpkg.md, rustpkg now builds in a target-specific subdirectory of build/, and installs libraries into a target-specific subdirectory of lib. Closes #8672
2013-09-12std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}Erick Tryzelaar-2/+2
2013-09-11ident->name cleanupJohn Clements-2/+3
2013-09-11Rename encode_struct_field_names to encode_struct_fields to reflect what it ↵SiegeLord-3/+3
actually does
2013-09-11Properly encode/decode structural variants.SiegeLord-25/+48
2013-09-06Remove even more usage of clownshoes in symbolsAlex Crichton-2/+3
This removes another large chunk of this odd 'clownshoes' identifier showing up in symbol names. These all originated from external crates because the encoded items were encoded independently of the paths calculated in ast_map. The encoding of these paths now uses the helper function in ast_map to calculate the "pretty name" for an impl block. Unfortunately there is still no information about generics in the symbol name, but it's certainly vastly better than before hash::__extensions__::write::_version::v0.8 becomes hash::Writer$SipState::write::hversion::v0.8 This also fixes bugs in which lots of methods would show up as `meth_XXX`, they now only show up as `meth` and throw some extra characters onto the version string.
2013-09-05Rename str::from_bytes to str::from_utf8, closes #8985Florian Hahn-3/+3
2013-09-04auto merge of #8875 : alexcrichton/rust/fix-inner-static-library-bug, r=huonwbors-6/+28
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-04stop treating char as an integer typeDaniel Micay-1/+1
Closes #7609
2013-09-04Implement support for indicating the stability of items.Huon Wilson-0/+1
There are 6 new compiler recognised attributes: deprecated, experimental, unstable, stable, frozen, locked (these levels are taken directly from Node's "stability index"[1]). These indicate the stability of the item to which they are attached; e.g. `#[deprecated] fn foo() { .. }` says that `foo` is deprecated. This comes with 3 lints for the first 3 levels (with matching names) that will detect the use of items marked with them (the `unstable` lint includes items with no stability attribute). The attributes can be given a short text note that will be displayed by the lint. An example: #[warn(unstable)]; // `allow` by default #[deprecated="use `bar`"] fn foo() { } #[stable] fn bar() { } fn baz() { } fn main() { foo(); // "warning: use of deprecated item: use `bar`" bar(); // all fine baz(); // "warning: use of unmarked item" } The lints currently only check the "edges" of the AST: i.e. functions, methods[2], structs and enum variants. Any stability attributes on modules, enums, traits and impls are not checked. [1]: http://nodejs.org/api/documentation.html [2]: the method check is currently incorrect and doesn't work.
2013-09-03Modernized a few more types in syntax::astMarvin Löbel-108/+108
2013-09-02Remove __extensions__ in names for a "pretty name"Alex Crichton-6/+28
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-25/+25
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-118/+118
2013-08-27auto merge of #8805 : jfager/rust/remove-hashutil, r=alexcrichtonbors-2/+0
2013-08-27librustc: Fix problem with cross-crate reexported static methods.Patrick Walton-8/+56
2013-08-27librustc: Implement basic lazy implementation loading.Patrick Walton-5/+158
This is only for implementations defined in the same crate as the trait they implement.
2013-08-27librustc: Remove `each_path`.Patrick Walton-43/+127
This does not implement lazy symbol resolution yet.
2013-08-27librustc: Stop calling `each_path` in coherence.Patrick Walton-1/+69
10% win or so for small crates.
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-9/+13
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: Add support for type parameters in the middle of paths.Patrick Walton-7/+16
For example, `foo::<T>::bar::<U>`. This doesn't enforce that the type parameters are in the right positions, however.
2013-08-27librustc: Remove `&const` and `*const` from the language.Patrick Walton-17/+5
They are still present as part of the borrow check.
2013-08-27Replace HashUtil w/ default method on HashJason Fager-2/+0
2013-08-26rustpkg: Test that different copies of the same package ID can exist in ↵Tim Chevalier-25/+42
multiple workspaces The test checks that rustpkg uses the first one, rather than complaining about multiple matches. Closes #7241
2013-08-26auto merge of #8758 : pnkfelix/rust/fsk-more-oldvisit-ports, r=pnkfelixbors-7/+15
Further followup on #7081. There still remains writeback.rs, but I want to wait to investigate that one because I've seen `make check` issues with it in the past.
2013-08-26Port creader.rs from oldvisit to <V:Visitor> trait API.Felix S. Klock II-7/+15
2013-08-25Revert "auto merge of #8745 : brson/rust/metadata, r=cmr"Brian Anderson-69/+64
This reverts commit 491bc3568c87dadaba4d342135bd308961c6e0ef, reversing changes made to 05f1bbba16912f63b562a7847801823872f89ec6.
2013-08-25auto merge of #8745 : brson/rust/metadata, r=cmrbors-64/+69
This does two things: 1) stops compressing metadata, 2) stops copying the metadata section, instead holding a reference to the buffer returned by the LLVM section iterator. Not compressing metadata requires something like 7x the storage space, but makes running tests about 9% faster. This has been a time improvement on all platforms I've tested, including windows. I considered leaving compression as an option but it doesn't seem to be worth the complexity since we don't currently have any use cases where we need to save that space. In order to avoid copying the metadata section I had to hack up extra::ebml a bit to support unsafe buffers. We should probably move it into librustc so that it can evolve to support the compiler without worrying about having a crummy interface. r? @graydon
2013-08-24Don't ever compress metadataBrian Anderson-37/+7
2013-08-24Make enum discriminants u64 instead of the host uint.Jed Davis-4/+4
2013-08-23Don't copy metadata after loadingBrian Anderson-59/+71
2013-08-23Allow metadata to be not compressedBrian Anderson-10/+33
2013-08-21auto merge of #8562 : bblum/rust/superkinds, r=nikomatsakisbors-1/+22
For #7083. The metadata issue with the old version is now fixed. Ready for review. This is also not the full solution to #7083, because this is not supported yet: ``` trait Foo : Send { } impl <T: Send> Foo for T { } fn foo<T: Foo>(val: T, chan: std::comm::Chan<T>) { chan.send(val); } ``` cc @nikomatsakis
2013-08-21auto merge of #8546 : jld/rust/discrim-symbol-rm, r=pcwaltonbors-9/+0
Given that bootstrapping and running the testsuite works without exporting discriminant values as global constants, I conclude that they're unused and can be removed.
2013-08-20rm obsolete integer to_str{,_radix} free functionsDaniel Micay-4/+2
2013-08-20Allow traits to use builtin kinds as supertraits for #7083.Ben Blum-1/+22
2013-08-19Remove discriminant symbols.Jed Davis-9/+0
Given that bootstrapping and running the testsuite works without exporting discriminant values as global constants, I conclude that they're unused and can be removed.
2013-08-16auto merge of #8532 : kballard/rust/cstr-cleanup, r=ericktbors-1/+1
Implement interior null checking in `.to_c_str()`, among other changes.
2013-08-16auto merge of #8526 : blake2-ppc/rust/either-result, r=catamorphismbors-11/+3
Retry of PR #8471 Replace the remaining functions marked for issue #8228 with similar functions that are iterator-based. Change `either::{lefts, rights}` to be iterator-filtering instead of returning a vector. Replace `map_vec`, `map_vec2`, `iter_vec2` in std::result with three functions: * `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>` * `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>` * `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`
2013-08-15Add ToCStr method .with_c_str()Kevin Ballard-1/+1
.with_c_str() is a replacement for the old .as_c_str(), to avoid unnecessary boilerplate. Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-15Switch metadata::encoder to <V:Visitor> trait.Felix S. Klock II-49/+81
placate make tidy. Remove dead code.
2013-08-15Update either::partitionblake2-ppc-11/+3
Remove the only use of either::partition since it was better accomplished with vector methods. Update either::partition so that it sizes the vectors correctly before it starts.
2013-08-12fix build with the new snapshot compilerDaniel Micay-10/+0
2013-08-11librustc: Convert from `@Object` to `@mut Object` as neededNiko Matsakis-8/+8