about summary refs log tree commit diff
path: root/src/librustc/metadata
AgeCommit message (Collapse)AuthorLines
2014-04-08rustc: Don't read both rlib and dylib metadataAlex Crichton-4/+12
This is an optimization which is quite impactful for compiling small crates. Reading libstd's metadata takes about 50ms, and a hello world before this change took about 100ms (this change halves that time). Recent changes made it such that this optimization wasn't performed, but I think it's a better idea do to this for now. See #10786 for tracking this issue.
2014-04-08rustc: Never register syntax crates in CStoreAlex Crichton-34/+45
When linking, all crates in the local CStore are used to link the final product. With #[phase(syntax)], crates want to be omitted from this linkage phase, and this was achieved by dumping the entire CStore after loading crates. This causes crates like the standard library to get loaded twice. This loading process is a fairly expensive operation when dealing with decompressing metadata. This commit alters the loading process to never register syntax crates in CStore. Instead, only phase(link) crates ever make their way into the map of crates. The CrateLoader trait was altered to return everything in one method instead of having separate methods for finding information.
2014-04-08rustc: Use CStore, not a separate crate cacheAlex Crichton-70/+61
This separate crate cache is one factor which is causing libstd to be loaded twice during normal compilation. The crates loaded for syntax extensions have a separate cache than the crates loaded for linking, so all crates are loaded once per #[phase] they're tagged with. This removes the cache and instead uses the CStore structure itself as the cache for loaded crates. This should allow crates loaded during the syntax phase to be shared with the crates loaded during the link phase.
2014-04-08Register new snapshotsAlex Crichton-11/+11
2014-04-08Made libflate functions return Options instead of outright failingTobba-3/+6
2014-04-06rustc: remove ty_unboxed_vec.Eduard Burtescu-2/+0
2014-04-04auto merge of #13284 : pnkfelix/rust/more-fs-info-on-crate-mismatch, ↵bors-28/+74
r=alexcrichton Fix #13266. There is a little bit of acrobatics in the definition of `crate_paths` to avoid calling `clone()` on the dylib/rlib unless we actually are going to need them. The other oddity is that I have replaced the `root_ident: Option<&str>` parameter with a `root: &Option<CratePaths>`, which may surprise one who was expecting to see something like: `root: Option<&CratePaths>`. I went with the approach here because I could not come up with code for the alternative that was acceptable to the borrow checker.
2014-04-05Accumulate list of paths for crate hash mismatch.Felix S. Klock II-23/+27
(i.e. semi-generalized version of prior errorinfo gathering.) Also revised presentation to put each path on its own line, prefixed by file:linenum information.
2014-04-04auto merge of #13301 : erickt/rust/remove-refcell-get, r=huonwbors-2/+2
`RefCell::get` can be a bit surprising, because it actually clones the wrapped value. This removes `RefCell::get` and replaces all the users with `RefCell::borrow()` when it can, and `RefCell::borrow().clone()` when it can't. It removes `RefCell::set` for consistency. This closes #13182. It also fixes an infinite loop in a test when debugging is on.
2014-04-03std: Remove `RefCell::get()`Erick Tryzelaar-2/+2
It's surprising that `RefCell::get()` is implicitly doing a clone on a value. This patch removes it and replaces all users with either `.borrow()` when we can autoderef, or `.borrow().clone()` when we cannot.
2014-04-03auto merge of #13237 : alexcrichton/rust/private-tuple-structs, r=brsonbors-4/+15
This is the final commit need to implement [RFC #4](https://github.com/rust-lang/rfcs/blob/master/active/0004-private-fields.md), it makes all tuple struct fields private by default, overridable with the `pub` keyword. I'll note one divergence from the original RFC which is outlined in the first commit.
2014-04-03syntax: Remove AbiSet, use one AbiAlex Crichton-26/+16
This change removes the AbiSet from the AST, converting all usage to have just one Abi value. The current scheme selects a relevant ABI given a list of ABIs based on the target architecture and how relevant each ABI is to that architecture. Instead of this mildly complicated scheme, only one ABI will be allowed in abi strings, and pseudo-abis will be created for special cases as necessary. For example the "system" abi exists for stdcall on win32 and C on win64. Closes #10049
2014-04-03rustc: Stop using LLVMGetSectionNameAlex Crichton-3/+5
The recent pull request to remove libc from libstd has hit a wall in compiling on windows, and I've been trying to investigate on the try bots as to why (it compiles locally just fine). To the best of my knowledge, the LLVM section iterator is behaving badly when iterating over the sections of the libc DLL. Upon investigating the LLVMGetSectionName function in LLVM, I discovered that this function doesn't always return a null-terminated string. It returns the data pointer of a StringRef instance (LLVM's equivalent of &str essentially), but it has no method of returning the length of the name of the section. This commit modifies the section iteration when loading libraries to invoke a custom LLVMRustGetSectionName which will correctly return both the length and the data pointer. I have not yet verified that this will fix landing liblibc, as it will require a snapshot before doing a full test. Regardless, this is a worrisome situation regarding the LLVM API, and should likely be fixed anyway.
2014-04-03After a hash mismatch error, emit file-system paths of crates involved.Felix S. Klock II-28/+70
Fix #13266. There is a little bit of acrobatics in the definition of `crate_paths` to avoid calling `clone()` on the dylib/rlib unless we actually are going to need them. The other oddity is that I have replaced the `root_ident: Option<&str>` parameter with a `root: &Option<CratePaths>`, which may surprise one who was expecting to see something like: `root: Option<&CratePaths>`. I went with the approach here because I could not come up with code for the alternative that was acceptable to the borrow checker.
2014-04-02metadata: filesearch: remove dead codeCorey Richardson-6/+0
2014-04-02metadata: decoder: remove dead codeCorey Richardson-39/+1
2014-04-01metadata: cstore: remove dead codeCorey Richardson-10/+0
2014-04-01metadata: csearch: remove dead codeCorey Richardson-21/+0
2014-04-01metadata: common: remove dead codeCorey Richardson-9/+0
2014-03-31rustc: Switch tuple structs to have private fieldsAlex Crichton-4/+15
This is a continuation of the work done in #13184 to make struct fields private by default. This commit finishes RFC 4 by making all tuple structs have private fields by default. Note that enum variants are not affected. A tuple struct having a private field means that it cannot be matched on in a pattern match (both refutable and irrefutable), and it also cannot have a value specified to be constructed. Similarly to private fields, switching the type of a private field in a tuple struct should be able to be done in a backwards compatible way. The one snag that I ran into which wasn't mentioned in the RFC is that this commit also forbids taking the value of a tuple struct constructor. For example, this code now fails to compile: mod a { pub struct A(int); } let a: fn(int) -> a::A = a::A; //~ ERROR: first field is private Although no fields are bound in this example, it exposes implementation details through the type itself. For this reason, taking the value of a struct constructor with private fields is forbidden (outside the containing module). RFC: 0004-private-fields
2014-03-31rustc: Switch field privacy as necessaryAlex Crichton-62/+62
2014-03-31vec: convert `append` and `append_one` to methodsDaniel Micay-3/+1
These were only free functions on `~[T]` because taking self by-value used to be broken.
2014-03-30Removed deprecated functions `map` and `flat_map` for vectors and slices.Marvin Löbel-3/+3
2014-03-29auto merge of #13188 : FlaPer87/rust/master, r=alexcrichtonbors-19/+3
2014-03-28auto merge of #13170 : eddyb/rust/syntax-cleanup, r=alexcrichtonbors-40/+43
Removes all Cell's/RefCell's from lexer::Reader implementations and a couple @.
2014-03-29Register new snapshotFlavio Percoco-19/+3
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-11/+11
Closes #2569
2014-03-28De-@ IdentInterner.Eduard Burtescu-40/+43
2014-03-28Rename Pod into CopyFlavio Percoco-2/+2
Summary: So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the Pod kind into Copy. RFC: 0003-opt-in-builtin-traits Test Plan: make check Reviewers: cmr Differential Revision: http://phabricator.octayn.net/D3
2014-03-27serialize: use ResultSean McArthur-65/+83
All of Decoder and Encoder's methods now return a Result. Encodable.encode() and Decodable.decode() return a Result as well. fixes #12292
2014-03-27auto merge of #13151 : brson/rust/dist, r=alexcrichton,brsonbors-10/+36
A variety of stuff here, mostly aimed at making `make install` work correctly with `--libdir` and `--mandir`. `make install` again goes through `install.sh`.
2014-03-26rustc: Fix detection of lib64 directoryBrian Anderson-1/+1
Instead of just looking for its presence we need to see if it actually contains rust stuffs.
2014-03-26syntax: Permit visibility on tuple fieldsAlex Crichton-5/+6
This change is in preparation for #8122. Nothing is currently done with these visibility qualifiers, they are just parsed and accepted by the compiler. RFC: 0004-private-fields
2014-03-25install: Support --libdir and --mandir correctlyBrian Anderson-10/+30
This adds a hack to rustc to make it find the library directory regardless of whether it is named lib/lib64/lib32.
2014-03-25rustc: Stop relying on CFG_LIBDIR_RELATIVEBrian Anderson-1/+7
This is not sufficient for finding the library directory for binary installs, but it does make the build more complex by requiring env vars be set to build rustc.
2014-03-25configure: Make rustlibdir non-configurableBrian Anderson-1/+1
Trying to reduce the complexity of installation
2014-03-23iter: remove `to_owned_vec`Daniel Micay-2/+2
This needs to be removed as part of removing `~[T]`. Partial type hints are now allowed, and will remove the need to add a version of this method for `Vec<T>`. For now, this involves a few workarounds for partial type hints not completely working.
2014-03-22auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichtonbors-4/+0
This PR removes the `Freeze` kind and the `NoFreeze` marker completely. Fixes #12577 cc @nikomatsakis r?
2014-03-22rustc: Fix fallout of removing get()Alex Crichton-163/+92
2014-03-22rustc: Remove special treatment for Freeze and NoFreezeFlavio Percoco-4/+0
Fixes #12577
2014-03-22auto merge of #13052 : sfackler/rust/clean-refcell, r=alexcrichtonbors-5/+5
These are superfluous now that we have fixed rvalue lifetimes and Deref. I'd also like to kill off `get` and `set`, but that'll be a large change so I want to make sure that we actually want to do that first.
2014-03-22Migrate all users of opt_vec to owned_slice, delete opt_vec.Huon Wilson-2/+2
syntax::opt_vec is now entirely unused, and so can go.
2014-03-20Remove RefCell::{with, with_mut}Steven Fackler-5/+5
These are superfluous now that we have fixed rvalue lifetimes and Deref.
2014-03-21syntax: make OptVec immutable.Huon Wilson-2/+2
This is the first step to replacing OptVec with a new representation: remove all mutability. Any mutations have to go via `Vec` and then make to `OptVec`. Many of the uses of OptVec are unnecessary now that Vec has no-alloc emptiness (and have been converted to Vec): the only ones that really need it are the AST and sty's (and so on) where there are a *lot* of instances of them, and they're (mostly) immutable.
2014-03-20auto merge of #13020 : alexcrichton/rust/vec, r=brsonbors-9/+0
The commits have the details.
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-9/+0
It's now in the prelude.
2014-03-20auto merge of #13017 : alexcrichton/rust/issue-13010, r=huonwbors-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-20auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakisbors-0/+4
`Share` implies that all *reachable* content is *threadsafe*. Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)... Fixes #11781 cc #12577 What this PR will do ================ - [x] Add Share kind and - [x] Replace usages of Freeze with Share in bounds. - [x] Add Unsafe<T> #12577 - [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior What's left to do in a separate PR (after the snapshot)? =========================================== - Remove `Freeze` completely
2014-03-20Add a Share kindFlavio Percoco-0/+4
Fixes #11781
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-11/+11
Closes #12771