about summary refs log tree commit diff
path: root/src/librustc/middle/trans
AgeCommit message (Collapse)AuthorLines
2014-11-18Move trans, back, driver, and back into a new crate, rustc_trans. Reduces ↵Niko Matsakis-27728/+0
memory usage significantly and opens opportunities for more parallel compilation.
2014-11-18auto merge of #19050 : japaric/rust/moar-dst, r=aturonbors-4/+4
r? @aturon cc #16918
2014-11-17librustc: DSTify `ClassList`, `LlvmRepr` and `Repr`Jorge Aparicio-4/+4
2014-11-18rollup merge of #18910: aturon/borrow-traitsJakub Bukaj-5/+5
Following [the collections reform RFC](https://github.com/rust-lang/rfcs/pull/235), this PR: * Adds a new `borrow` module to libcore. The module contains traits for borrowing data (`BorrowFrom` and `BorrowFromMut`), generalized cloning (`ToOwned`), and a clone-on-write smartpointer (`Cow`). * Deprecates the `_equiv` family of methods on `HashMap` and `HashSet` by instead generalizing the "normal" methods like `get` and `remove` to use the new `std::borrow` infrastructure. * Generalizes `TreeMap`, `TreeSet`, `BTreeMap` and `BTreeSet` to use the new `std::borrow` infrastructure for lookups. [breaking-change]
2014-11-18rollup merge of #18890: luqmana/tfJakub Bukaj-28/+46
This is especially useful for declaring a static with external linkage in an executable. There isn't any way to do that currently since we mark everything in an executable as internal by default. Also, a quick fix to have the no-compiler-rt target option respected when building staticlibs as well.
2014-11-17Fallout from deprecationAaron Turon-5/+5
This commit handles the fallout from deprecating `_with` and `_equiv` methods.
2014-11-17Switch to purely namespaced enumsSteven Fackler-2/+47
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17auto merge of #19027 : nick29581/rust/coercions-4, r=alexcrichtonbors-154/+154
The forwards compatible parts of #18645, rebased. Converts implicit coercions from `[T, ..n]` to `&[T]` into explicit references.
2014-11-17Fix fallout from coercion removalNick Cameron-154/+154
2014-11-17auto merge of #18914 : Gankro/rust/cloned, r=aturonbors-26/+26
Part of #18424. r? @aturon [breaking-change]
2014-11-16auto merge of #18994 : sfackler/rust/struct-variants-pt2, r=jakub-bors-7/+7
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change] r? @alexcrichton
2014-11-16fallout from deprecating find_copy and get_copyAlexis Beingessner-26/+26
2014-11-16Complete the removal of ty_nil, ast::LitNil, ast::TyBot and ast::TyUniqJakub Bukaj-9/+16
[breaking-change] This will break any uses of macros that assumed () being a valid literal.
2014-11-16Try to remove ty_nil, some kind of error in exhaustiveness checkingNiko Matsakis-39/+28
2014-11-16rollup merge of #18965: cmr/masterJakub Bukaj-1/+6
2014-11-15Un-feature gate struct variantsSteven Fackler-7/+7
Struct variant field visibility is now inherited. Remove `pub` keywords from declarations. Closes #18641 [breaking-change]
2014-11-15auto merge of #18922 : japaric/rust/for, r=jakub-bors-4/+4
r? @alexcrichton
2014-11-14librustc: use type parameters less vigorously when giving the IR type namesCorey Richardson-1/+6
2014-11-14auto merge of #18893 : bkoropoff/rust/issue-18883, r=alexcrichtonbors-7/+8
This was a simple case of substitutions being applied inconsistently. I haven't investigated why type parameters are actually showing up in the closure type here, but trans needs to handle them correctly in any case.
2014-11-14auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichtonbors-3/+2
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below: [breaking-change] - `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`. - `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead. - `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers. - `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value. - `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that - `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically. - `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead. - The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt` - `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types. - `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
2014-11-14Revert the need for initial values with arithmetic iteratorsBrendan Zabarauskas-1/+1
2014-11-13fix "warning: deprecated syntax, use `for` keyword now"Jorge Aparicio-4/+4
2014-11-12time: Deprecate the library in the distributionAlex Crichton-17/+5
This commit deprecates the entire libtime library in favor of the externally-provided libtime in the rust-lang organization. Users of the `libtime` crate as-is today should add this to their Cargo manifests: [dependencies.time] git = "https://github.com/rust-lang/time" To implement this transition, a new function `Duration::span` was added to the `std::time::Duration` time. This function takes a closure and then returns the duration of time it took that closure to execute. This interface will likely improve with `FnOnce` unboxed closures as moving in and out will be a little easier. Due to the deprecation of the in-tree crate, this is a: [breaking-change] cc #18855, some of the conversions in the `src/test/bench` area may have been a little nicer with that implemented
2014-11-13Remove lots of numeric traits from the preludesBrendan Zabarauskas-0/+1
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-13Deprecate Zero and One traitsBrendan Zabarauskas-1/+1
2014-11-13Move checked arithmetic operators into Int traitBrendan Zabarauskas-3/+1
2014-11-11Fix inconsistent use of substs in trans_unboxing_shimBrian Koropoff-7/+8
Substs were not applied when calling `untuple_arguments_if_necessary`. Just apply them once at the start of the function, rebinding `fty`. Also change the function to take them by reference since we don't need to consume them at all. Closes #18883
2014-11-11librustc: Allow linkage attribute on any statics, not just foreign statics.Luqman Aden-28/+46
2014-11-10Use FnvHashMap instead of HashMap in rustcAriel Ben-Yehuda-103/+100
2014-11-09auto merge of #18743 : nikomatsakis/rust/hrtb-refactor-2, r=pcwaltonbors-8/+8
Various miscellaneous changes pushing towards HRTB support: 1. Update parser and adjust ast to support `for<'a,'b>` syntax, both in closures and trait bounds. Warn on the old syntax (not error, for stage0). 2. Refactor TyTrait representation to include a TraitRef. 3. Purge `once_fns` feature gate and `once` keyword. r? @pcwalton This is a [breaking-change]: - The `once_fns` feature is now officially deprecated. Rewrite using normal closures or unboxed closures. - The new `for`-based syntax now issues warnings (but not yet errors): - `fn<'a>(T) -> U` becomes `for<'a> fn(T) -> U` - `<'a> |T| -> U` becomes `for<'a> |T| -> U`
2014-11-08auto merge of #18730 : bkoropoff/rust/issue-18652, r=eddybbors-1/+0
`FnOnce` environments that fit within an `int` are passed to the closure by value. For some reason there was an assert that this would only happen if there were 1 or 0 free variables, but it can also happen if there are multiple variables that happen to fit. Closes #18652
2014-11-08auto merge of #18729 : bkoropoff/rust/issue-18711, r=cmrbors-4/+3
Closes #18711
2014-11-07Make TyTrait embed a `TraitRef`, so that when we extend TraitRef, it ↵Niko Matsakis-8/+8
naturally carries over to object types. I wanted to embed an `Rc<TraitRef>`, but I was foiled by the current static rules, which prohibit non-Sync values from being stored in static locations. This means that the constants for `ty_int` and so forth cannot be initialized.
2014-11-07auto merge of #18688 : bkoropoff/rust/unboxed-closure-subst-fixes, ↵bors-39/+27
r=nikomatsakis This resolves some issues that remained after adding support for monomorphizing unboxed closures in trans. There were a few places where a set of substitutions for an unboxed closure type were dropped on the floor and later recalculated from scratch based on the def ID, but this failed spectacularly when the closure originated from a different param environment. The substitutions are now plumbed through end-to-end. Closes #18661 There was also a conflict in the meaning of the self param space within the body of the unboxed closure. Trans attempted to insert the unboxed closure type as the self type, but this could conflict with the self type from the param environment when an unboxed closure was used within a default method on a trait. Since the body of an unboxed closure cannot refer to its own self type or value, there's no need for it to actually use the self space. The downstream consumers of the substitutions in trans do not seem to need it either since they look up the type of the closure some other way, so I just stopped setting it. Closes #18685. r? @pcwalton @nikomatsakis
2014-11-06Remove incorrect assert in transBrian Koropoff-1/+0
As an optimization, once unboxed closures receive their environment by value if it fits within the size of an `int`. An assert in this code path assumed that this would only occur if the environment had no more than a single free variable in it, but multiple smaller free variables can easily be packed into the space of an `int`, particularly if any of them are 0-sized. The assert can simply be removed. Closes #18652
2014-11-06Fix panic due to overly long borrow of RefCellBrian Koropoff-4/+3
Closes #18711
2014-11-06Fix handling of unboxed closure type param substitutionsBrian Koropoff-39/+27
- When selecting an implicit trait impl for an unboxed closure, plumb through and use the substitutions from impl selection instead of using those from the current param environment in trans, which may be incorrect. - When generating a function declaration for an unboxed closure, plumb through the substitutions from the param environment of the closure as above. Also normalize the type to avoid generating duplicate declarations due to regions being inconsistently replaced with ReStatic elsewhere. - Do not place the closure type in the self param space when translating the unboxed closure callee, etc. It is not actually used, and doing so conflicts with the self substitution from default trait methods. Closes #18661 Closes #18685
2014-11-06rollup merge of #18644 : luqmana/pefcAlex Crichton-1/+1
2014-11-06rollup merge of #18630 : nikomatsakis/purge-the-barsAlex Crichton-6/+2
2014-11-06rollup merge of #18615 : huonw/simdAlex Crichton-8/+29
2014-11-06rollup merge of #18591 : nick29581/dst-bug-strAlex Crichton-27/+20
2014-11-06Fallout from collection conventionsAlexis Beingessner-40/+40
2014-11-06Support parenthesized paths `Foo(A,B) -> C` that expand to `Foo<(A,B),C>`. ↵Niko Matsakis-6/+2
These paths also bind anonymous regions (or will, once HRTB is fully working). Fixes #18423.
2014-11-05Make trans::adt know that some structs are unsizedNick Cameron-27/+20
2014-11-04librustc: Call return_type only for functions.Luqman Aden-1/+1
2014-11-05Translate SIMD construction as `insertelement`s and a single store.Huon Wilson-8/+29
This almost completely avoids GEPi's and pointer manipulation, postponing it until the end with one big write of the whole vector. This leads to a small speed-up in compilation, and makes it easier for LLVM to work with the values, e.g. with `--opt-level=0`, pub fn foo() -> f32x4 { f32x4(0.,0.,0.,0.) } was previously compiled to define <4 x float> @_ZN3foo20h74913e8b13d89666eaaE() unnamed_addr #0 { entry-block: %sret_slot = alloca <4 x float> %0 = getelementptr inbounds <4 x float>* %sret_slot, i32 0, i32 0 store float 0.000000e+00, float* %0 %1 = getelementptr inbounds <4 x float>* %sret_slot, i32 0, i32 1 store float 0.000000e+00, float* %1 %2 = getelementptr inbounds <4 x float>* %sret_slot, i32 0, i32 2 store float 0.000000e+00, float* %2 %3 = getelementptr inbounds <4 x float>* %sret_slot, i32 0, i32 3 store float 0.000000e+00, float* %3 %4 = load <4 x float>* %sret_slot ret <4 x float> %4 } but now becomes define <4 x float> @_ZN3foo20h74913e8b13d89666eaaE() unnamed_addr #0 { entry-block: ret <4 x float> zeroinitializer }
2014-11-04Implement flexible target specificationCorey Richardson-142/+89
Removes all target-specific knowledge from rustc. Some targets have changed during this, but none of these should be very visible outside of cross-compilation. The changes make our targets more consistent. iX86-unknown-linux-gnu is now only available as i686-unknown-linux-gnu. We used to accept any value of X greater than 1. i686 was released in 1995, and should encompass the bare minimum of what Rust supports on x86 CPUs. The only two windows targets are now i686-pc-windows-gnu and x86_64-pc-windows-gnu. The iOS target has been renamed from arm-apple-ios to arm-apple-darwin. A complete list of the targets we accept now: arm-apple-darwin arm-linux-androideabi arm-unknown-linux-gnueabi arm-unknown-linux-gnueabihf i686-apple-darwin i686-pc-windows-gnu i686-unknown-freebsd i686-unknown-linux-gnu mips-unknown-linux-gnu mipsel-unknown-linux-gnu x86_64-apple-darwin x86_64-unknown-freebsd x86_64-unknown-linux-gnu x86_64-pc-windows-gnu Closes #16093 [breaking-change]
2014-11-03rollup merge of #18506 : nikomatsakis/assoc-type-boundsAlex Crichton-5/+22
2014-11-03rollup merge of #18318 : arielb1/transmute-cleanupAlex Crichton-6/+9
2014-11-03Use a struct rather than a 4-tupleNiko Matsakis-4/+19