about summary refs log tree commit diff
path: root/src/librustc/metadata
AgeCommit message (Collapse)AuthorLines
2014-03-19auto merge of #12772 : thestinger/rust/slice, r=alexcrichtonbors-3/+3
Closes #12702
2014-03-20rename std::vec -> std::sliceDaniel Micay-3/+3
Closes #12702
2014-03-19rustc: Prevent false positives in crate loadingAlex Crichton-19/+27
Previously, any library of the pattern `lib<name>-<hash>-<version>.so` was >considered a candidate (rightly so) for loading a crate. Sets are generated for each unique `<hash>`, and then from these sets a candidate is selected. If a set contained more than one element, then it immediately generated an error saying that multiple copies of the same dylib were found. This is incorrect because each candidate needs to be validated to actually contain a rust library (valid metadata). This commit alters the logic to filter each set of candidates for a hash to only libraries which are actually rust libraries. This means that if multiple false positives are found with the right name pattern, they're all ignored. Closes #13010
2014-03-19rustc: put ty_closure behind some indirection.Huon Wilson-1/+1
This reduces the size of sty from 112 to 96; like with the ty_trait variant, this variant of sty occurs rarely (~1%) so the benefits are large and the costs small.
2014-03-19rustc: put ty_trait behind some indirection.Huon Wilson-3/+3
This reduces ty::sty from 160 bytes to just 112, and some measurements eddyb made suggest that the ty_trait variant occurs very rarely (e.g. ~1% of all sty instances) hence this will result in a large memory saving, and the cost of the indirection is unlikely to be an issue.
2014-03-17De-@ codemap and diagnostic.Eduard Burtescu-12/+11
2014-03-17De-@ CStore uses.Eduard Burtescu-54/+47
2014-03-17De-@ filesearch.Eduard Burtescu-22/+13
2014-03-17De-@ tyencode::ctxt and related parts of astencode.Eduard Burtescu-21/+21
2014-03-17De-@ ty::ctxt usage.Eduard Burtescu-45/+45
2014-03-17De-@ Session usage.Eduard Burtescu-22/+13
2014-03-15Test fixes and rebase conflictsAlex Crichton-1/+1
This commit switches over the backtrace infrastructure from piggy-backing off the RUST_LOG environment variable to using the RUST_BACKTRACE environment variable (logging is now disabled in libstd).
2014-03-15rustc: Topographically sort rust dependenciesAlex Crichton-2/+30
This commit starts to topographically sort rust dependencies on the linker command line. The reason for this is that linkers use right-hand libraries to resolve left-hand libraries symbols, which is especially crucial for us because we're using --as-needed on linux.
2014-03-14extra: Put the nail in the coffin, delete libextraAlex Crichton-1/+1
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
2014-03-12Alpha-rename `.ident` fields of type `Name` to `.name`.Felix S. Klock II-6/+6
2014-03-08auto merge of #12758 : rgawdzik/rust/master, r=alexcrichtonbors-17/+28
Refactored get_metadata_section to return a Result<MetadataBlob,~str> instead of a Option<MetadataBlob>. This provides more clarity to the user through the debug output when using --ls. This is kind of a continuation of my original closed pull request 2 months ago (#11544), but I think the time-span constitutes a new pull request.
2014-03-08Refactored get_metadata_section to return a Result<T,~str>, added error ↵Robert Gawdzik-17/+28
messages. Closes #6615.
2014-03-08librustc: Fix up fallout from the automatic conversion.Felix S. Klock II-16/+26
2014-03-08librustc: Automatically change uses of `~[T]` to `Vec<T>` in rustc.Patrick Walton-99/+99
2014-03-07rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and ↵Liigo Zhuang-1/+1
clean::ExternMod to clean::ExternCrate
2014-03-06rustc: Move to FNV hashing for node/def idsAlex Crichton-5/+6
This leverages the new hashing framework and hashmap implementation to provide a much speedier hashing algorithm for node ids and def ids. The hash algorithm used is currentl FNV hashing, but it's quite easy to swap out. I originally implemented hashing as the identity function, but this actually ended up in slowing down rustc compiling libstd from 8s to 13s. I would suspect that this is a result of a large number of collisions. With FNV hashing, we get these timings (compiling with --no-trans, in seconds): | | before | after | |-----------|---------:|--------:| | libstd | 8.324 | 6.703 | | stdtest | 47.674 | 46.857 | | libsyntax | 9.918 | 8.400 |
2014-02-26rustc: Don't deduplicate libraries linked toAlex Crichton-6/+1
Linker argument order with respect to libraries is important enough that we shouldn't be attempting to filter out libraries getting passed through to the linker. When linking with a native library that has multiple dependant native libraries, it's useful to have control over the link argument order.
2014-03-02Make visible types public in rustcSteven Fackler-4/+4
2014-03-02auto merge of #12637 : pcwalton/rust/devecing, r=alexcrichtonbors-23/+32
r? @alexcrichton
2014-03-01rustc: Better error when loading invalid librariesAlex Crichton-4/+23
When the metadata format changes, old libraries often cause librustc to abort when reading their metadata. This should all change with the introduction of SVH markers, but the loader for crates should gracefully handle libraries without SVH markers still. This commit adds support for tripping fewer assertions when loading libraries by using maybe_get_doc when initially parsing metadata. It's still possible for some libraries to fall through the cracks, but this should deal with a fairly large number of them up front.
2014-03-01librustc: Fix errors arising from the automated `~[T]` conversionPatrick Walton-23/+32
2014-02-28rustc: Add the concept of a Strict Version HashAlex Crichton-61/+89
This new SVH is used to uniquely identify all crates as a snapshot in time of their ABI/API/publicly reachable state. This current calculation is just a hash of the entire crate's AST. This is obviously incorrect, but it is currently the reality for today. This change threads through the new Svh structure which originates from crate dependencies. The concept of crate id hash is preserved to provide efficient matching on filenames for crate loading. The inspected hash once crate metadata is opened has been changed to use the new Svh. The goal of this hash is to identify when upstream crates have changed but downstream crates have not been recompiled. This will prevent the def-id drift problem where upstream crates were recompiled, thereby changing their metadata, but downstream crates were not recompiled. In the future this hash can be expanded to exclude contents of the AST like doc comments, but limitations in the compiler prevent this change from being made at this time. Closes #10207
2014-02-28rustc: Simplify crate loading constraintsAlex Crichton-239/+150
The previous code passed around a {name,version} pair everywhere, but this is better expressed as a CrateId. This patch changes these paths to store and pass around crate ids instead of these pairs of name/version. This also prepares the code to change the type of hash that is stored in crates.
2014-02-27rustc: Remove codemap and reachable from metadata encoderBrian Anderson-15/+1
2014-02-24rustc: Don't error on the rlib symlinksAlex Crichton-2/+14
This commit implements a layman's version of realpath() for metadata::loader to use in order to not error on symlinks pointing to the same file. Closes #12459
2014-02-24auto merge of #12445 : huonw/rust/less-unsafe, r=alexcrichtonbors-1/+2
Commits for details. Highlights: - `flate` returns `CVec<u8>` to save reallocating a whole new `&[u8]` - a lot of `transmute`s removed outright or replaced with `as` (etc.)
2014-02-24Transition to new `Hash`, removing IterBytes and std::to_bytes.Huon Wilson-5/+7
2014-02-24flate: return CVec<u8> rather than copying into a new vector.Huon Wilson-1/+2
This trades an O(n) allocation + memcpy for a O(1) proc allocation (for the destructor). Most users only need &[u8] anyway (all of the users in the main repo), and so this offers large gains.
2014-02-23Move std::{trie, hashmap} to libcollectionsAlex Crichton-6/+6
These two containers are indeed collections, so their place is in libcollections, not in libstd. There will always be a hash map as part of the standard distribution of Rust, but by moving it out of the standard library it makes libstd that much more portable to more platforms and environments. This conveniently also removes the stuttering of 'std::hashmap::HashMap', although 'collections::HashMap' is only one character shorter.
2014-02-22auto merge of #12451 : edwardw/rust/ident-2-name, r=cmrbors-23/+23
Closes #7743.
2014-02-22auto merge of #11863 : erickt/rust/hash, r=acrichtobors-0/+2
This PR merges `IterBytes` and `Hash` into a trait that allows for generic non-stream-based hashing. It makes use of @eddyb's default type parameter support in order to have a similar usage to the old `Hash` framework. Fixes #8038. Todo: - [x] Better documentation - [ ] Benchmark - [ ] Parameterize `HashMap` on a `Hasher`.
2014-02-22Warn about unnecessary parentheses upon assignmentEduard Bopp-5/+2
Closes #12366. Parentheses around assignment statements such as let mut a = (0); a = (1); a += (2); are not necessary and therefore an unnecessary_parens warning is raised when statements like this occur. The warning mechanism was refactored along the way to allow for code reuse between the routines for checking expressions and statements. Code had to be adopted throughout the compiler and standard libraries to comply with this modification of the lint.
2014-02-21std: rewrite Hash to make it more genericErick Tryzelaar-0/+2
This patch merges IterBytes and Hash traits, which clears up the confusion of using `#[deriving(IterBytes)]` to support hashing. Instead, it now is much easier to use the new `#[deriving(Hash)]` for making a type hashable with a stream hash. Furthermore, it supports custom non-stream-based hashers, such as if a value's hash was cached in a database. This does not yet replace the old IterBytes-hash with this new version.
2014-02-22Represent lifetimes as Names instead of IdentsEdward Wang-23/+23
Closes #7743.
2014-02-21Move time out of extra (cc #8784)Arcterus-1/+2
2014-02-21Changed NonCamelCaseTypes lint to warn by defaultmr.Shu-8/+20
Added allow(non_camel_case_types) to librustc where necesary Tried to fix problems with non_camel_case_types outside rustc fixed failing tests Docs updated Moved #[allow(non_camel_case_types)] a level higher. markdown.rs reverted Fixed timer that was failing tests Fixed another timer
2014-02-20auto merge of #12164 : alexcrichton/rust/rlibs-and-dylibs, r=cmrbors-94/+167
The first commit improves error messages during linking, and the second commit improves error messages during crate-loading time. Closes #12297 Closes #12377
2014-02-20Re-work loading crates with nicer errorsAlex Crichton-94/+167
This commit rewrites crate loading internally in attempt to look at less metadata and provide nicer errors. The loading is now split up into a few stages: 1. Collect a mapping of (hash => ~[Path]) for a set of candidate libraries for a given search. The hash is the hash in the filename and the Path is the location of the library in question. All candidates are filtered based on their prefix/suffix (dylib/rlib appropriate) and then the hash/version are split up and are compared (if necessary). This means that if you're looking for an exact hash of library you don't have to open up the metadata of all libraries named the same, but also in your path. 2. Once this mapping is constructed, each (hash, ~[Path]) pair is filtered down to just a Path. This is necessary because the same rlib could show up twice in the path in multiple locations. Right now the filenames are based on just the crate id, so this could be indicative of multiple version of a crate during one crate_id lifetime in the path. If multiple duplicate crates are found, an error is generated. 3. Now that we have a mapping of (hash => Path), we error on multiple versions saying that multiple versions were found. Only if there's one (hash => Path) pair do we actually return that Path and its metadata. With this restructuring, it restructures code so errors which were assertions previously are now first-class errors. Additionally, this should read much less metadata with lots of crates of the same name or same version in a path. Closes #11908
2014-02-20Mass rename if_ok! to try!Alex Crichton-6/+6
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-17Updated metadata::creader::resolve_crate_deps to use the correct span. ↵gentlefolk-12/+29
Clarified error message when an external crate's dependency is missing. Closes #2404.
2014-02-14extern mod => extern crateAlex Crichton-2/+2
This was previously implemented, and it just needed a snapshot to go through
2014-02-14Refactored ast_map and friends, mainly to have Paths without storing them.Eduard Burtescu-446/+335
2014-02-13auto merge of #12061 : pongad/rust/delorderable, r=cmrbors-2/+2
#12057
2014-02-13Removed num::OrderableMichael Darakananda-2/+2
2014-02-13auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichtonbors-76/+76
The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature. The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.