summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-1/+0
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-02-22Auto merge of #31811 - alexcrichton:clean-deps, r=sanxiynbors-0/+1
The standard library doesn't depend on rustc_bitflags, so move it to explicit dependencies on all other crates. Additionally, the arena/fmt_macros deps could be dropped from libsyntax.
2016-02-21rustbuild: Sync some Cargo.toml/lib.rs dependenciesAlex Crichton-0/+1
The standard library doesn't depend on rustc_bitflags, so move it to explicit dependencies on all other crates. Additionally, the arena/fmt_macros deps could be dropped from libsyntax.
2016-02-20make *mut T -> *const T a coercionAriel Ben-Yehuda-4/+12
rather than being implicit quasi-subtyping. Nothing good can come out of quasi-subtyping.
2016-02-14Rename hir::Pat_ and its variantsVadim Petrochenkov-2/+2
2016-02-12Autoderef in librustc_metadataJonas Schievink-64/+64
2016-02-12Auto merge of #30830 - arcnmx:static-extern, r=alexcrichtonbors-28/+23
See #29676 r? @alexcrichton
2016-02-11bootstrap: Add a bunch of Cargo.toml filesAlex Crichton-0/+20
These describe the structure of all our crate dependencies.
2016-02-11Pass through diagnostic handler insteadarcnmx-1/+2
2016-02-11Only retain external static symbols across LTOarcnmx-28/+22
2016-02-11[breaking-change] don't glob export ast::MetaItem_Oliver 'ker' Schneider-6/+6
2016-02-11[breaking-change] don't glob export ast::Item_ variantsOliver 'ker' Schneider-3/+3
2016-02-11[breaking-change] don't pub export ast::Lit_ variantsOliver Schneider-1/+1
2016-02-11[breaking-change] don't glob export ast::{UintTy, IntTy} variantsOliver Schneider-10/+10
2016-02-11[breaking-change] don't glob export ast::FloatTy variantsOliver Schneider-2/+2
2016-02-11[breaking-change] don't glob import/export syntax::abi enum variantsOliver Schneider-7/+7
2016-02-09make `MirMap` a struct instead of a type alias for `NodeMap`Oliver Schneider-6/+7
2016-02-06Auto merge of #31307 - nagisa:mir-drop-terminator, r=nikomatsakisbors-1/+1
The scope of these refactorings is a little bit bigger than the title implies. See each commit for details. I’m submitting this for nitpicking now (the first 4 commits), because I feel the basic idea/implementation is sound and should work. I will eventually expand this PR to cover the translator changes necessary for all this to work (+ tests), ~~and perhaps implement a dynamic dropping scheme while I’m at it as well.~~ r? @nikomatsakis
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-04Synthesize calls to box_free language itemSimonas Kazlauskas-1/+1
This gets rid of Drop(Free, _) MIR construct by synthesizing a call to language item which takes care of dropping instead.
2016-02-02Auto merge of #31279 - DanielJCampbell:MacroReferencing, r=nrcbors-6/+24
r? @nrc
2016-02-01Implemented macro referencing for save analysisDaniel Campbell-6/+24
2016-01-30Auto merge of #30448 - alexcrichton:llvmup, r=nikomatsakisbors-1/+1
These commits perform a few high-level changes with the goal of enabling i686 MSVC unwinding: * LLVM is upgraded to pick up the new exception handling instructions and intrinsics for MSVC. This puts us somewhere along the 3.8 branch, but we should still be compatible with LLVM 3.7 for non-MSVC targets. * All unwinding for MSVC targets (both 32 and 64-bit) are implemented in terms of this new LLVM support. I would like to also extend this to Windows GNU targets to drop the runtime dependencies we have on MinGW, but I'd like to land this first. * Some tests were fixed up for i686 MSVC here and there where necessary. The full test suite should be passing now for that target. In terms of landing this I plan to have this go through first, then verify that i686 MSVC works, then I'll enable `make check` on the bots for that target instead of just `make` as-is today. Closes #25869
2016-01-29trans: Upgrade LLVMAlex Crichton-1/+1
This brings some routine upgrades to the bundled LLVM that we're using, the most notable of which is a bug fix to the way we handle range asserts when loading the discriminant of an enum. This fix ended up being very similar to f9d4149c where we basically can't have a range assert when loading a discriminant due to filling drop, and appropriate flags were added to communicate this to `trans::adt`.
2016-01-29Auto merge of #30900 - michaelwoerister:trans_item_collect, r=nikomatsakisbors-0/+16
The purpose of the translation item collector is to find all monomorphic instances of functions, methods and statics that need to be translated into LLVM IR in order to compile the current crate. So far these instances have been discovered lazily during the trans path. For incremental compilation we want to know the set of these instances in advance, and that is what the trans::collect module provides. In the future, incremental and regular translation will be driven by the collector implemented here. r? @nikomatsakis cc @rust-lang/compiler Translation Item Collection =========================== This module is responsible for discovering all items that will contribute to to code generation of the crate. The important part here is that it not only needs to find syntax-level items (functions, structs, etc) but also all their monomorphized instantiations. Every non-generic, non-const function maps to one LLVM artifact. Every generic function can produce from zero to N artifacts, depending on the sets of type arguments it is instantiated with. This also applies to generic items from other crates: A generic definition in crate X might produce monomorphizations that are compiled into crate Y. We also have to collect these here. The following kinds of "translation items" are handled here: - Functions - Methods - Closures - Statics - Drop glue The following things also result in LLVM artifacts, but are not collected here, since we instantiate them locally on demand when needed in a given codegen unit: - Constants - Vtables - Object Shims General Algorithm ----------------- Let's define some terms first: - A "translation item" is something that results in a function or global in the LLVM IR of a codegen unit. Translation items do not stand on their own, they can reference other translation items. For example, if function `foo()` calls function `bar()` then the translation item for `foo()` references the translation item for function `bar()`. In general, the definition for translation item A referencing a translation item B is that the LLVM artifact produced for A references the LLVM artifact produced for B. - Translation items and the references between them for a directed graph, where the translation items are the nodes and references form the edges. Let's call this graph the "translation item graph". - The translation item graph for a program contains all translation items that are needed in order to produce the complete LLVM IR of the program. The purpose of the algorithm implemented in this module is to build the translation item graph for the current crate. It runs in two phases: 1. Discover the roots of the graph by traversing the HIR of the crate. 2. Starting from the roots, find neighboring nodes by inspecting the MIR representation of the item corresponding to a given node, until no more new nodes are found. The roots of the translation item graph correspond to the non-generic syntactic items in the source code. We find them by walking the HIR of the crate, and whenever we hit upon a function, method, or static item, we create a translation item consisting of the items DefId and, since we only consider non-generic items, an empty type-substitution set. Given a translation item node, we can discover neighbors by inspecting its MIR. We walk the MIR and any time we hit upon something that signifies a reference to another translation item, we have found a neighbor. Since the translation item we are currently at is always monomorphic, we also know the concrete type arguments of its neighbors, and so all neighbors again will be monomorphic. The specific forms a reference to a neighboring node can take in MIR are quite diverse. Here is an overview: The most obvious form of one translation item referencing another is a function or method call (represented by a CALL terminator in MIR). But calls are not the only thing that might introduce a reference between two function translation items, and as we will see below, they are just a specialized of the form described next, and consequently will don't get any special treatment in the algorithm. A function does not need to actually be called in order to be a neighbor of another function. It suffices to just take a reference in order to introduce an edge. Consider the following example: ```rust fn print_val<T: Display>(x: T) { println!("{}", x); } fn call_fn(f: &Fn(i32), x: i32) { f(x); } fn main() { let print_i32 = print_val::<i32>; call_fn(&print_i32, 0); } ``` The MIR of none of these functions will contain an explicit call to `print_val::<i32>`. Nonetheless, in order to translate this program, we need an instance of this function. Thus, whenever we encounter a function or method in operand position, we treat it as a neighbor of the current translation item. Calls are just a special case of that. In a way, closures are a simple case. Since every closure object needs to be constructed somewhere, we can reliably discover them by observing `RValue::Aggregate` expressions with `AggregateKind::Closure`. This is also true for closures inlined from other crates. Drop glue translation items are introduced by MIR drop-statements. The generated translation item will again have drop-glue item neighbors if the type to be dropped contains nested values that also need to be dropped. It might also have a function item neighbor for the explicit `Drop::drop` implementation of its type. A subtle way of introducing neighbor edges is by casting to a trait object. Since the resulting fat-pointer contains a reference to a vtable, we need to instantiate all object-save methods of the trait, as we need to store pointers to these functions even if they never get called anywhere. This can be seen as a special case of taking a function reference. Since `Box` expression have special compiler support, no explicit calls to `exchange_malloc()` and `exchange_free()` may show up in MIR, even if the compiler will generate them. We have to observe `Rvalue::Box` expressions and Box-typed drop-statements for that purpose. Interaction with Cross-Crate Inlining ------------------------------------- The binary of a crate will not only contain machine code for the items defined in the source code of that crate. It will also contain monomorphic instantiations of any extern generic functions and of functions marked with The collection algorithm handles this more or less transparently. When constructing a neighbor node for an item, the algorithm will always call `inline::get_local_instance()` before proceeding. If no local instance can be acquired (e.g. for a function that is just linked to) no node is created; which is exactly what we want, since no machine code should be generated in the current crate for such an item. On the other hand, if we can successfully inline the function, we subsequently can just treat it like a local item, walking it's MIR et cetera. Eager and Lazy Collection Mode ------------------------------ Translation item collection can be performed in one of two modes: - Lazy mode means that items will only be instantiated when actually referenced. The goal is to produce the least amount of machine code possible. - Eager mode is meant to be used in conjunction with incremental compilation where a stable set of translation items is more important than a minimal one. Thus, eager mode will instantiate drop-glue for every drop-able type in the crate, even of no drop call for that type exists (yet). It will also instantiate default implementations of trait methods, something that otherwise is only done on demand. Open Issues ----------- Some things are not yet fully implemented in the current version of this module. Since no MIR is constructed yet for initializer expressions of constants and statics we cannot inspect these properly. Ideally, no translation item should be generated for const fns unless there is a call to them that cannot be evaluated at compile time. At the moment this is not implemented however: a translation item will be produced regardless of whether it is actually needed or not. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/rust-lang/rust/30900) <!-- Reviewable:end -->
2016-01-26Auto merge of #31120 - alexcrichton:attribute-deny-warnings, r=brsonbors-2/+3
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-26Implement the translation item collector.Michael Woerister-0/+16
The purpose of the translation item collector is to find all monomorphic instances of functions, methods and statics that need to be translated into LLVM IR in order to compile the current crate. So far these instances have been discovered lazily during the trans path. For incremental compilation we want to know the set of these instances in advance, and that is what the trans::collect module provides. In the future, incremental and regular translation will be driven by the collector implemented here.
2016-01-24mk: Move from `-D warnings` to `#![deny(warnings)]`Alex Crichton-2/+3
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-22The war on abort_if_errorsNick Cameron-11/+8
2016-01-21Auto merge of #31024 - oli-obk:move_checks_out_of_librustc, r=arielb1bors-1/+1
- check_const - check_static_recursion - check_loop - check_rvalues r? @arielb1
2016-01-21move more checks out of librustcOliver Schneider-1/+1
2016-01-21Auto merge of #29520 - retep998:staticlib-naming-fiasco, r=alexcrichtonbors-2/+10
I'm not sure if this was the best way to go about it, but it seems to work. Fixes https://github.com/rust-lang/rust/issues/29508 r? @alexcrichton
2016-01-20Rename Def's variants and don't reexport themVadim Petrochenkov-43/+43
2016-01-20Refactor definitions of ADTs in rustc::middle::defVadim Petrochenkov-44/+71
2016-01-16Change name when outputting staticlibs on WindowsPeter Atashian-2/+10
libfoo.a -> foo.lib In order to not cause conflicts, changes the DLL import library name foo.lib -> foo.dll.lib Fixes https://github.com/rust-lang/rust/issues/29508 Because this changes output filenames this is a [breaking-change] Signed-off-by: Peter Atashian <retep998@gmail.com>
2016-01-15Preserve struct/variant kinds in metadataVadim Petrochenkov-11/+32
Add tests for use of empty structs in cross-crate scenarios
2016-01-08Also store MIR of closures in crate metadata.Michael Woerister-6/+9
2016-01-07Refactor away extension traits RegionEscape and HasTypeFlagsJeffrey Seyfried-2/+2
2016-01-05Refactor compiler to make use of dep-tracking-maps. Also, in cases whereNiko Matsakis-11/+6
we were using interior mutability (RefCells, TyIvar), add some reads/writes.
2016-01-02Auto merge of #30264 - GuillaumeGomez:patch-5, r=Manishearthbors-1/+14
r? @Manishearth Also: should I merged both commits? Not sure if it's really useful to keep the first one.
2016-01-02Add E0463 error explanationGuillaume Gomez-1/+14
2015-12-31Rollup merge of #30565 - michaelwoerister:opaque_encoder, r=brsonSimonas Kazlauskas-325/+278
This PR changes the `emit_opaque` and `read_opaque` methods in the RBML library to use a space-efficient binary encoder that does not emit any tags and uses the LEB128 variable-length integer format for all numbers it emits. The space savings are nice, albeit a bit underwhelming, especially for dynamic libraries where metadata is already compressed. | RLIBs | NEW | OLD | |--------------|--------|-----------| |libstd | 8.8 MB | 10.5 MB | |libcore |15.6 MB | 19.7 MB | |libcollections| 3.7 MB | 4.8 MB | |librustc |34.0 MB | 37.8 MB | |libsyntax |28.3 MB | 32.1 MB | | SOs | NEW | OLD | |---------------|-----------|--------| | libstd | 4.8 MB | 5.1 MB | | librustc | 8.6 MB | 9.2 MB | | libsyntax | 7.8 MB | 8.4 MB | At least this should make up for the size increase caused recently by also storing MIR in crate metadata. Can this be a breaking change for anyone? cc @rust-lang/compiler
2015-12-31Auto merge of #30585 - Ms2ger:ExplicitSelfCategory, r=brsonbors-12/+12
2015-12-30Rebasing and review commentsNick Cameron-4/+5
2015-12-30use structured errorsNick Cameron-47/+65
2015-12-29Add a hint when given --extern with an indeterminate typeCorey Richardson-0/+2
@ubsan brought up this relatively poor error message. This adds a help message hinting when the problem actually is, and how to fix it.
2015-12-28Use a more efficient encoding for opaque data in RBML.Michael Woerister-325/+278
2015-12-28Rename ExplicitSelfCategory's variants and stop re-exporting them.Ms2ger-12/+12
2015-12-28rewrite the method-receiver matching codeAriel Ben-Yehuda-4/+1
the old code was *so terrible*.
2015-12-22Fix def paths creation for items inlined from external crates.Michael Woerister-17/+45
Avoid duplicating the last element of the def path which led to paths like "std::slice::into_vec::into_vec".