summary refs log tree commit diff
path: root/src/librustc_metadata/creader.rs
AgeCommit message (Collapse)AuthorLines
2016-07-02make the metadata lock more robust and bump the metadata encoding versionAriel Ben-Yehuda-21/+2
check the metadata lock when loading rather than afterwards Fixes #33733 Fixes #33015
2016-06-28refactor rustc_metadata to use CamelCase names and IndexVecAriel Ben-Yehuda-42/+38
2016-06-26Rollup merge of #33943 - jseyfried:libsyntax_cleanup, r=nrcJeffrey Seyfried-2/+2
Miscellaneous low priority cleanup in `libsyntax`.
2016-06-23Move errors from libsyntax to its own crateJonathan Turner-6/+7
2016-06-16Add an abs_path member to FileMap, use it when writing debug info.Ted Mielczarek-0/+2
When items are inlined from extern crates, the filename in the debug info is taken from the FileMap that's serialized in the rlib metadata. Currently this is just FileMap.name, which is whatever path is passed to rustc. Since libcore and libstd are built by invoking rustc with relative paths, they wind up with relative paths in the rlib, and when linked into a binary the debug info uses relative paths for the names, but since the compilation directory for the final binary, tools trying to read source filenames will wind up with bad paths. We noticed this in Firefox with source filenames from libcore/libstd having bad paths. This change stores an absolute path in FileMap.abs_path, and uses that if available for writing debug info. This is not going to magically make debuggers able to find the source, but it will at least provide sensible paths.
2016-06-15prefer `if let` to match with `None => ()` arm in some placesZack M. Davis-23/+20
Casual grepping revealed some places in the codebase (some of which antedated `if let`'s December 2014 stabilization in c200ae5a) where we were using a match with a `None => ()` arm where (in the present author's opinion) an `if let` conditional would be more readable. (Other places where matching to the unit value did seem to better express the intent were left alone.) It's likely that we don't care about making such trivial, non-functional, sheerly æsthetic changes. But if we do, this is a patch.
2016-06-14Remove the type parameter from `syntax::visit::Visitor`Jeffrey Seyfried-2/+2
2016-05-25rustc: use a simpler scheme for plugin registrar symbol names.Eduard Burtescu-5/+9
2016-05-20Auto merge of #33625 - alexcrichton:rustbuild-moar-tests, r=aturonbors-49/+80
rustbuild: Touch up some test suites This adds in some missing test suites, primarily a few pretty suites. It also starts optimizing tests by default as the current test suite does, but also recognizes `--disable-optimize-tests`. Currently the optimization of tests isn't recognized by crate tests because Cargo doesn't support the ability to compile an unoptimized test suite against an optimized library. Perhaps a feature to add, though!
2016-05-20rustc: Fix again order-dependence in extern crateAlex Crichton-49/+80
Originally fixed in #29961 the bug was unfortunately still present in the face of crates using `#[macro_use]`. This commit refactors for the two code paths to share common logic to ensure that they both pick up the same bug fix. Closes #33762
2016-05-20Auto merge of #33553 - alexcrichton:cdylibs, r=brsonbors-0/+1
rustc: Add a new crate type, cdylib This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: https://github.com/rust-lang/rfcs/pull/1510 Closes #33132
2016-05-19rustc: Add a new crate type, cdylibAlex Crichton-0/+1
This commit is an implementation of [RFC 1510] which adds a new crate type, `cdylib`, to the compiler. This new crate type differs from the existing `dylib` crate type in a few key ways: * No metadata is present in the final artifact * Symbol visibility rules are the same as executables, that is only reachable `extern` functions are visible symbols * LTO is allowed * All libraries are always linked statically This commit is relatively simple by just plubming the compiler with another crate type which takes different branches here and there. The only major change is an implementation of the `Linker::export_symbols` function on Unix which now actually does something. This helps restrict the public symbols from a cdylib on Unix. With this PR a "hello world" `cdylib` is 7.2K while the same `dylib` is 2.4MB, which is some nice size savings! [RFC 1510]: https://github.com/rust-lang/rfcs/pull/1510 Closes #33132
2016-05-18allow retracing paths across cratesNiko Matsakis-0/+1
For external crates, we must build up a map that goes from the DefKey to the DefIndex. We do this by iterating over each index that is found in the metadata and loading the associated DefKey.
2016-05-11Make LocalCrateReader private to creader.Ms2ger-8/+19
2016-05-10Correct typo in LocalCrateReader::definitions.Ms2ger-4/+4
2016-05-10Store a reference rather than a RefCell in LocalCrateReader.Ms2ger-5/+4
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-30/+122
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-05-02replace fileline_{help,note} with {help,note}Niko Matsakis-2/+2
The extra filename and line was mainly there to keep the indentation relative to the main snippet; now that this doesn't include filename/line-number as a prefix, it is distracted.
2016-04-20debugging, misc fixesNick Cameron-4/+7
2016-04-20def_collector and crate reader operate on AST instead of HIRNick Cameron-54/+26
And move extern crate reading earlier in the driver
2016-04-20Trivial refactoringNick Cameron-9/+8
2016-04-06rustc: move rustc_front to rustc::hir.Eduard Burtescu-4/+4
2016-03-31librustc_metadata: use bug!(), span_bug!()Benjamin Herr-3/+3
2016-03-25renumber error from E0522 to E0523Niko Matsakis-1/+1
another name was added in the meantime
2016-03-25pacify the merciless tidy: s/E0521/E0522Niko Matsakis-1/+1
Gah. I always find it confusing that make tidy gives me the highest error code, but not the **next** error code.
2016-03-25renumber diagnostic to avoid conflictNiko Matsakis-1/+1
specialization nabbed E0520
2016-03-25track the extern-crate def-id rather than pathNiko Matsakis-27/+59
We used to track, for each crate, a path that led to the extern-crate that imported it. Instead of that, track the def-id of the extern crate, along with a bit more information, and derive the path on the fly.
2016-03-25store krate information more uniformlyNiko Matsakis-1/+1
make DefPath store krate and enable uniform access to crate_name/crate_disambiguator
2016-03-25Add a "link-guard" to avoid accidentally linking to a wrong dylib at runtime.Michael Woerister-2/+2
We want to prevent compiling something against one version of a dynamic library and then, at runtime accidentally using a different version of the dynamic library. With the old symbol-naming scheme this could not happen because every symbol had the SVH in it and you'd get an error by the dynamic linker when using the wrong version of a dylib. With the new naming scheme this isn't the case any more, so this patch adds the "link-guard" to prevent this error case. This is implemented as follows: - In every crate that we compile, we emit a function called "__rustc_link_guard_<crate-name>_<crate-svh>" - The body of this function contains calls to the "__rustc_link_guard" functions of all dependencies. - An executable contains a call to it's own "__rustc_link_guard" function. As a consequence the "__rustc_link_guard" function call graph mirrors the crate graph and the dynamic linker will fail if a wrong dylib is loaded somewhere because its "__rustc_link_guard" function will contain a different SVH in its name.
2016-03-25Make the compiler emit an error if the crate graph contains two crates with ↵Michael Woerister-4/+44
the same crate-name and crate-salt but different SVHs.
2016-03-08Add help for E0514ggomez-8/+10
2016-02-12Autoderef in librustc_metadataJonas Schievink-2/+2
2016-02-11[breaking-change] don't glob export ast::Item_ variantsOliver 'ker' Schneider-1/+1
2016-02-11[breaking-change] don't glob import/export syntax::abi enum variantsOliver Schneider-2/+2
2016-02-05Instrument a bunch of tasks that employ the HIR map in one way orNiko Matsakis-1/+5
another and were not previously instrumented.
2016-02-01Implemented macro referencing for save analysisDaniel Campbell-3/+5
2016-01-22The war on abort_if_errorsNick Cameron-11/+8
2015-12-30use structured errorsNick Cameron-1/+5
2015-11-26fix tidyAriel Ben-Yehuda-4/+5
2015-11-26split the metadata code into rustc_metadataAriel Ben-Yehuda-0/+963
tests & rustdoc still broken