about summary refs log tree commit diff
path: root/src/librustc/metadata/creader.rs
AgeCommit message (Collapse)AuthorLines
2014-09-12Remove largely unused context from Visitor.Eduard Burtescu-6/+6
2014-09-11Fix check for existing crate when using --externBrian Koropoff-1/+1
When checking for an existing crate, compare against the `crate_metadata::name` field, which is the crate name which was requested during resolution, rather than the result of the `crate_metadata::name()` method, which is the crate name within the crate metadata, as these may not match when using the --extern option to `rustc`. This fixes spurious "multiple crate version" warnings under the following scenario: - The crate `foo`, is referenced multiple times - `--extern foo=./path/to/libbar.rlib` is specified to rustc - The internal crate name of `libbar.rlib` is not `foo` The behavior surrounding `Context::should_match_name` and the comments in `loader.rs` both lead me to believe that this scenario is intended to work. Fixes #17186
2014-09-11Make debug message about resolving `extern crate` statements more helpfulBrian Koropoff-1/+1
2014-08-15Properly canonicalize crate paths specified via --externBjörn Steinbrink-1/+2
Crates that are resolved normally have their path canonicalized and all symlinks resolved. This does currently not happen for paths specified using the --extern option to rustc, which can lead to rustc thinking that it encountered two different versions of a crate, when it's actually the same version found through different paths. To fix this, we must store the canonical path for crates found via --extern and also use the canonical path when comparing paths. Fixes #16496
2014-07-24rustc: Compare paths with --extern, not bytesAlex Crichton-3/+6
The right hand side of the comparison in these checks are values of type Option<&Path> which are normalized versions of the left-hand side, so they're not guaranteed to be byte-for-byte equivalent even though they're the same path. For this reasons, the command line arguments are promoted to paths for comparison of equality. This fixes a bug on windows where if a library was specified with --extern it would then be picked up twice because it was not considered to have been previously registered.
2014-07-10rustc: Forbid plugin_registrar in only rlib formAlex Crichton-1/+9
If a plugin registrar is available, the library must be found in dylib form, not just in rlib form. Closes #15475
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-2/+2
[breaking-change]
2014-07-05Test fixes and rebase conflictsAlex Crichton-1/+1
2014-07-05rustc: Add a flag for specifying dependenciesAlex Crichton-5/+27
This comit implements a new flag, --extern, which is used to specify where a crate is located. The purpose of this flag is to bypass the normal crate loading/matching of the compiler to point it directly at the right file. This flag takes the form `--extern foo=bar` where `foo` is the name of a crate and `bar` is the location at which to find the crate. Multiple `--extern` directives are allowed with the same crate name to specify the rlib/dylib pair for a crate. It is invalid to specify more than one rlib or more than one dylib, and it's required that the crates are valid rust crates. I have also added some extensive documentation to metadata::loader about how crate loading should work. RFC: 0035-remove-crate-id
2014-07-05rustc: Remove CrateId and all related supportAlex Crichton-42/+51
This commit removes all support in the compiler for the #[crate_id] attribute and all of its derivative infrastructure. A list of the functionality removed is: * The #[crate_id] attribute no longer exists * There is no longer the concept of a version of a crate * Version numbers are no longer appended to symbol names * The --crate-id command line option has been removed To migrate forward, rename #[crate_id] to #[crate_name] and only the name of the crate itself should be mentioned. The version/path of the old crate id should be removed. For a transitionary state, the #[crate_id] attribute is still accepted if the #[crate_name] is not present, but it is warned about if it is the only identifier present. RFC: 0035-remove-crate-id [breaking-change]
2014-06-26Remove unnecessary to_string callsPiotr Jawniak-2/+2
This commit removes superfluous to_string calls from various places
2014-06-24rustc: Don't register syntax crates twiceAlex Crichton-1/+1
We only need to register them once, and once they're registered twice warnings will start being spewed or worse may happen! Closes #14330
2014-06-12Better dylib skipping based on Alex Crichton codeValerii Hiora-3/+3
2014-06-12Basic iOS supportValerii Hiora-1/+2
2014-06-09Implement #[plugin_registrar]Keegan McAllister-13/+11
See RFC 22. [breaking-change]
2014-06-05Fallout from the libcollections movementAlex Crichton-1/+1
2014-05-27std: Rename strbuf operations to stringRicho Healey-6/+6
[breaking-change]
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-1/+1
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-5/+9
2014-05-18Include file paths when dumping the list of resolved crates via `debug!`.Felix S. Klock II-2/+7
2014-05-12librustc: Remove all uses of `~str` from librustc.Patrick Walton-10/+15
2014-05-11Reorganise driver code.Nick Cameron-5/+5
The goal of this refactoring is to make the rustc driver code easier to understand and use. Since this is as close to an API as we have, I think it is important that it is nice. On getting stuck in, I found that there wasn't as much to change as I'd hoped to make the stage... fns easier to use by tools. This patch only moves code around - mostly just moving code to different files, but a few extracted method refactorings too. To summarise the changes: I added driver::config which handles everything about configuring the compiler. driver::session now just defines and builds session objects. I moved driver code from librustc/lib.rs to librustc/driver/mod.rs so all the code is one place. I extracted methods to make emulating the compiler without being the compiler a little easier. Within the driver directory, I moved code around to more logically fit in the modules.
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-2/+2
2014-04-23Enable use of syntax extensions when cross compiling.Douglas Young-88/+118
This adds the target triple to the crate metadata. When searching for a crate the phase (link, syntax) is taken into account. During link phase only crates matching the target triple are considered. During syntax phase, either the target or host triple will be accepted, unless the crate defines a macro_registrar, in which case only the host triple will match.
2014-04-22rustc: de-@ metadata::cstore.Eduard Burtescu-6/+6
2014-04-22rustc: de-@ some RefCell's.Eduard Burtescu-9/+4
2014-04-16rustc: Don't allocate a cnum to syntax cratesAlex Crichton-4/+11
Syntax-only crates are no longer registered with the cstore, so there's no need to allocate crate numbers to them. This ends up leaving gaps in the crate numbering scheme which is not expected in the rest of the compiler. Closes #13560
2014-04-13rustc: Don't link in syntax extensionsAlex Crichton-7/+7
This bug was introduced in #13384 by accident, and this commit continues the work of #13384 by finishing support for loading a syntax extension crate without registering it with the local cstore. Closes #13495
2014-04-10Remove some internal ~[] from several libraries.Huon Wilson-2/+2
Some straggling instances of `~[]` across a few different libs. Also, remove some public ones from workcache.
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/+49
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-04auto merge of #13284 : pnkfelix/rust/more-fs-info-on-crate-mismatch, ↵bors-18/+26
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-1/+1
(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-03syntax: Remove AbiSet, use one AbiAlex Crichton-1/+1
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-03After a hash mismatch error, emit file-system paths of crates involved.Felix S. Klock II-18/+26
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-03-31rustc: Switch field privacy as necessaryAlex Crichton-1/+1
2014-03-28auto merge of #13170 : eddyb/rust/syntax-cleanup, r=alexcrichtonbors-3/+4
Removes all Cell's/RefCell's from lexer::Reader implementations and a couple @.
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-28De-@ IdentInterner.Eduard Burtescu-3/+4
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-22rustc: Fix fallout of removing get()Alex Crichton-14/+9
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-17De-@ codemap and diagnostic.Eduard Burtescu-1/+1
2014-03-17De-@ CStore uses.Eduard Burtescu-18/+11
2014-03-17De-@ Session usage.Eduard Burtescu-21/+12
2014-03-08librustc: Fix up fallout from the automatic conversion.Felix S. Klock II-3/+5
2014-03-08librustc: Automatically change uses of `~[T]` to `Vec<T>` in rustc.Patrick Walton-3/+3
2014-03-07rename ast::ViewItemExternMod to ast::ViewItemExternCrate, and ↵Liigo Zhuang-1/+1
clean::ExternMod to clean::ExternCrate
2014-03-01librustc: Fix errors arising from the automated `~[T]` conversionPatrick Walton-3/+5