Commit Graph

52586 Commits

Author SHA1 Message Date
bors
a264f5b7e8 Auto merge of #33089 - nrc:hir-name-res, r=eddyb
Move def id collection and extern crate handling to before AST->HIR lowering

r? @jseyfried, @eddyb, or @nikomatsakis
2016-04-22 03:41:29 -07:00
Johannes Oertel
241a3e4689 Implement append for b-trees.
The algorithm implemented here is linear in the size of the two b-trees. It
firsts creates a `MergeIter` from the two b-trees and then builds a new b-tree
by pushing key-value pairs from the `MergeIter` into nodes at the right heights.

Three functions for stealing have been added to the implementation of `Handle` as
well as a getter for the height of a `NodeRef`.

The docs have been updated with performance information about `BTreeMap::append` and
the remark about B has been removed now that it is the same for all instances of `BTreeMap`.
2016-04-22 12:30:43 +02:00
Jonathan Turner
fd0632fad6 Fix for filepath for cfail tests in windows 2016-04-21 18:24:44 -07:00
bors
887e947178 Auto merge of #33079 - bluss:split-iter, r=alexcrichton
Split core::iter module implementation into parts

Split core::iter module implementation into parts

split iter.rs into a directory of (implementation private) modules.

+ mod (adaptor structs whose private fields need to be available both for them and Iterator
  + iterator (Iterator trait)
  + traits (FromIterator, etc; all traits but Iterator itself)
  + range (range related)
  + sources (Repeat, Once, Empty)
2016-04-21 16:17:55 -07:00
bors
b5ba5923f8 Auto merge of #33074 - mitaa:rdoc-irlst, r=alexcrichton
rustdoc: Fix the strip-hidden `ImplStripper`

Instead of stripping impls which reference *stripped* items, we keep impls which reference *retained* items. We do this because when we strip an item we immediately return, and do not recurse into it - leaving the contained items non-stripped from the point of view of the `ImplStripper`.

fixes #33069

r? @alexcrichton
2016-04-21 10:52:15 -07:00
Niko Matsakis
399149ac7e fix transmute-from-fn-item-types-lint
This test was relying on buggy behavior.
2016-04-21 04:51:29 -04:00
Niko Matsakis
906cc48d48 add serialize as a dep for compiletest 2016-04-21 04:42:25 -04:00
Niko Matsakis
7aa594791d fix broken test revealed by compiletest 2016-04-21 04:42:25 -04:00
Niko Matsakis
6ce5e770d2 move json.rs file 2016-04-21 04:42:25 -04:00
Niko Matsakis
28a3c88157 pacify the merciless acrichto (somewhat)
Also add a comment or two to pacify the merciless self-critic, who hates
a closure without a comment.
2016-04-21 04:42:25 -04:00
Niko Matsakis
bf624c413f improve tidy to give you file that failed
the current tidy panics give you no idea why it failed
2016-04-21 04:42:25 -04:00
Niko Matsakis
01d2b4ab6b port compiletest to use JSON output
This uncovered a lot of bugs in compiletest and also some shortcomings
of our existing JSON output. We had to add information to the JSON
output, such as suggested text and macro backtraces. We also had to fix
various bugs in the existing tests.

Joint work with jntrnr.
2016-04-21 04:42:24 -04:00
Steven Fackler
c6480e8b6b Remove IPV6_V6ONLY functionality
These settings can only be adjusted before bind time, which doesn't make
sense in the current set of functionality. These methods are stable, but
haven't hit a stable release yet.

Closes #33052

[breaking-change]
2016-04-20 21:42:19 -07:00
bors
6e03608209 Auto merge of #33030 - nagisa:mir-unrequire-end-block, r=nikomatsakis
MIR: Do not require END_BLOCK to always exist

Basically, all this does, is removing restriction for END_BLOCK to exist past the first invocation of RemoveDeadBlocks pass. This way for functions whose CFG does not reach the `END_BLOCK` end up not containing the block.

As far as the implementation goes, I’m not entirely satisfied with the `BasicBlock::end_block`. I had hoped to make `new` a `const fn` and then just have a `const END_BLOCK` private to mir::build, but it turns out that constant functions don’t yet support conditionals nor a way to assert.
2016-04-20 21:25:26 -07:00
Tang Chenglong
77145b3923 docs: Highlight a keyword 2016-04-21 09:53:30 +08:00
bors
95545e7adc Auto merge of #33011 - alexcrichton:pkg-everything, r=brson
rustbuild: Package librustc & co for cross-hosts

Currently the `rust-std` package produced by rustbuild only contains the
standard library plus libtest, but the makefiles actually produce a `rust-std`
package with all known target libraries (including libsyntax, librustc, etc).
Tweak the behavior so the dependencies of the `dist-docs` step in rustbuild
depend on the compiler libraries as well (so that they're all packaged).

Closes #32984
2016-04-20 14:58:20 -07:00
Tamir Duberstein
2872c23618 librustc: remove outdated workaround
Fixed upstream: https://github.com/llvm-mirror/llvm/commit/ca07e256f62f
2016-04-20 16:17:26 -04:00
Matt Brubeck
4d7b930d88 Enable vfp3-d16 for ARMv7 Android target
Android's [armeabi-v7a ABI][1] guarantees at least VFPv3-d16 hardware FPU
support, so Rust should include this in the default features for the
arm-linux-androideabi target.

[1]: https://developer.android.com/ndk/guides/abis.html
2016-04-20 12:51:01 -07:00
bors
a0c3259803 Auto merge of #32968 - alexcrichton:update-suport, r=brson
doc: Update our tier support

This modifies our listing of tiered platforms a few ways:

* All lists are alphabetized based on target now
* Lots of targets are moved up to "Tier 2" as we're gating on all these builds
  and official releases are provided (and installable via rustup).
* A few targets now list having a compiler + cargo now as well.

No more platforms have been moved up to Tier 1 at this time, however. The only
real candidate is ``x86_64-unknown-linux-musl`, but that's not *quite* to a tier
1 level of quality just yet so let's hold off for another release or so to iron
it out a bit.
2016-04-20 12:28:34 -07:00
bors
92e3fb3ebe Auto merge of #31709 - ranma42:target_feature-from-llvm, r=alexcrichton
Compute `target_feature` from LLVM

This is a work-in-progress fix for #31662.

The logic that computes the target features from the command line has been replaced with queries to the `TargetMachine`.
2016-04-20 09:57:57 -07:00
bors
6ece1447f0 Auto merge of #32939 - eddyb:layout, r=nikomatsakis
Compute LLVM-agnostic type layouts in rustc.

Layout for monomorphic types, and some polymorphic ones (e.g. `&T` where `T: Sized`),
can now be computed by rustc without involving LLVM in the actual process.

This gives rustc the ability to evaluate `size_of` or `align_of`, as well as obtain field offsets.
MIR-based CTFE will eventually make use of these layouts, as will MIR trans, shortly.

Layout computation also comes with a `[breaking-change]`, or two:
* `"data-layout"` is now mandatory in custom target specifications, reverting the decision from #27076.
This string is needed because it describes endianness, pointer size and alignments for various types.
We have the first two and we could allow tweaking alignments in target specifications.
Or we could also extract the data layout from LLVM and feed it back into rustc.
However, that can vary with the LLVM version, which is fragile and undermines stability.
For built-in targets, I've added a check that the hardcoded data-layout matches LLVM defaults.
* `transmute` calls are checked in a stricter fashion, which fixes #32377

To expand on `transmute`, there are only 2 allowed patterns: between types with statically known sizes and between pointers with the same potentially-unsized "tail" (which determines the type of unsized metadata they use, if any).
If you're affected, my suggestions are:
* try to use casts (and raw pointer deref) instead of transmutes
* *really* try to avoid `transmute` where possible
* if you have a structure, try working on individual fields and unpack/repack the structure instead of transmuting it whole, e.g. `transmute::<RefCell<Box<T>>, RefCell<*mut T>>(x)` doesn't work, but `RefCell::new(Box::into_raw(x.into_inner()))` does (and `Box::into_raw` is just a `transmute`)
2016-04-20 07:27:59 -07:00
Seo Sanghyeon
f5326858b7 Show previous definition of duplicate impl item 2016-04-20 22:00:33 +09:00
bors
133f60f820 Auto merge of #32951 - LukasKalbertodt:collection_contains_rfc1552, r=brson
Add `contains` to `VecDeque` and `LinkedList` (+ tests)

This implements [RFC 1552](https://github.com/rust-lang/rfcs/blob/master/text/1552-contains-method-for-various-collections.md). Tracking issue: #32630

Sorry for the late response. This is my first contribution, so please tell me if anything isn't optimal!
2016-04-20 04:58:44 -07:00
bors
9bba2907ee Auto merge of #32942 - alexcrichton:bootstrap-from-previous, r=brson
mk: Bootstrap from stable instead of snapshots

This commit removes all infrastructure from the repository for our so-called
snapshots to instead bootstrap the compiler from stable releases. Bootstrapping
from a previously stable release is a long-desired feature of distros because
they're not fans of downloading binary stage0 blobs from us. Additionally, this
makes our own CI easier as we can decommission all of the snapshot builders and
start having a regular cadence to when we update the stage0 compiler.

A new `src/etc/get-stage0.py` script was added which shares some code with
`src/bootstrap/bootstrap.py` to read a new file, `src/stage0.txt`, which lists
the current stage0 compiler as well as cargo that we bootstrap from. This script
will download the relevant `rustc` package an unpack it into `$target/stage0` as
we do today.

One problem of bootstrapping from stable releases is that we're not able to
compile unstable code (e.g. all the `#![feature]` directives in libcore/libstd).
To overcome this we employ two strategies:

* The bootstrap key of the previous compiler is hardcoded into `src/stage0.txt`
  (enabled as a result of #32731) and exported by the build system. This enables
  nightly features in the compiler we download.
* The standard library and compiler are pinned to a specific stage0, which
  doesn't change, so we're guaranteed that we'll continue compiling as we start
  from a known fixed source.

The process for making a release will also need to be tweaked now to continue to
cadence of bootstrapping from the previous release. This process looks like:

1. Merge `beta` to `stable`
2. Produce a new stable compiler.
3. Change `master` to bootstrap from this new stable compiler.
4. Merge `master` to `beta`
5. Produce a new beta compiler
6. Change `master` to bootstrap from this new beta compiler.

Step 3 above should involve very few changes as `master` was previously
bootstrapping from `beta` which is the same as `stable` at that point in time.
Step 6, however, is where we benefit from removing lots of `#[cfg(stage0)]` and
get to use new features. This also shouldn't slow the release too much as steps
1-5 requires little work other than waiting and step 6 just needs to happen at
some point during a release cycle, it's not time sensitive.

Closes #29555
Closes #29557
2016-04-20 01:16:55 -07:00
Andrea Canciani
ce99a5e5d8 Check that the feature strings are well-formed
Assert that the feature strings are NUL terminated, so that they will
be well-formed as C strings.

This is a safety check to ease the maintaninace and update of the
feature lists.
2016-04-20 09:09:30 +02:00
Andrea Canciani
deaa2fe753 Make the feature whitelists constants
This simplifies the code a bit and makes the types nicer, too.
2016-04-20 09:08:25 +02:00
bors
3dd88f60de Auto merge of #32903 - alexcrichton:fix-rpath, r=brson
rustbuild: Fix --enable-rpath usage

This commit fixes the `--enable-rpath` configure flag in rustbuild to work
despite the compile-time directories being different than the runtime
directories. This unfortunately means that we can't use `-C rpath` out of the
box but hopefully the portability story here isn't too bad as
`src/librustc_back/rpath.rs` isn't *too* complicated.

Closes #32886
2016-04-19 22:53:17 -07:00
bors
9cf6fba955 Auto merge of #31253 - ranma42:improve-unicode-iter-offset, r=brson
Improve computation of offset in `EscapeUnicode`

Unify the computation of `offset` and use `leading_zeros` instead of manually scanning the bits.
This PR removes some duplicated code and makes it a little simpler .
The computation of `offset` is also faster, but it is unlikely to have an impact on actual code.

(split from #31049)
2016-04-19 19:17:08 -07:00
Nick Cameron
0be3c8c569 rebasing 2016-04-20 10:16:10 +12:00
Nick Cameron
1d5a29cf0e debugging, misc fixes 2016-04-20 10:14:16 +12:00
Nick Cameron
744be0b5aa HIR visitor for DefCollector
So that we can work with inlined HIR from metadata.
2016-04-20 10:13:35 +12:00
Nick Cameron
0c37d4bb1d refactoring 2016-04-20 10:13:35 +12:00
Nick Cameron
84c3f898f9 def_collector and crate reader operate on AST instead of HIR
And move extern crate reading earlier in the driver
2016-04-20 10:13:35 +12:00
Nick Cameron
6af7acab1c Separate def collection and hir map making even further 2016-04-20 10:13:35 +12:00
Nick Cameron
d6bcc04c52 Move DefCollector to its own module. 2016-04-20 10:13:35 +12:00
Nick Cameron
f61b404467 Split up NodeCollector so that defs are collected separately from nodes for the HIR map. 2016-04-20 10:13:35 +12:00
Nick Cameron
c99b73a767 Trivial refactoring 2016-04-20 10:13:35 +12:00
Andrea Canciani
1ad85610e4 Add test for target_feature
This test checks that all of the x86 architectures (both `x86` and
`x86_64`) have the `sse2` feature. This is currently true for all of
the targets whose target CPU is `pentium4` (or better), but it might
fail on other targets (for example on `i586`).
2016-04-19 23:24:28 +02:00
Simonas Kazlauskas
d1180afbd9 Generate block containing return lazily instead 2016-04-20 00:13:30 +03:00
Alex Crichton
02538d463a mk: Bootstrap from stable instead of snapshots
This commit removes all infrastructure from the repository for our so-called
snapshots to instead bootstrap the compiler from stable releases. Bootstrapping
from a previously stable release is a long-desired feature of distros because
they're not fans of downloading binary stage0 blobs from us. Additionally, this
makes our own CI easier as we can decommission all of the snapshot builders and
start having a regular cadence to when we update the stage0 compiler.

A new `src/etc/get-stage0.py` script was added which shares some code with
`src/bootstrap/bootstrap.py` to read a new file, `src/stage0.txt`, which lists
the current stage0 compiler as well as cargo that we bootstrap from. This script
will download the relevant `rustc` package an unpack it into `$target/stage0` as
we do today.

One problem of bootstrapping from stable releases is that we're not able to
compile unstable code (e.g. all the `#![feature]` directives in libcore/libstd).
To overcome this we employ two strategies:

* The bootstrap key of the previous compiler is hardcoded into `src/stage0.txt`
  (enabled as a result of #32731) and exported by the build system. This enables
  nightly features in the compiler we download.
* The standard library and compiler are pinned to a specific stage0, which
  doesn't change, so we're guaranteed that we'll continue compiling as we start
  from a known fixed source.

The process for making a release will also need to be tweaked now to continue to
cadence of bootstrapping from the previous release. This process looks like:

1. Merge `beta` to `stable`
2. Produce a new stable compiler.
3. Change `master` to bootstrap from this new stable compiler.
4. Merge `master` to `beta`
5. Produce a new beta compiler
6. Change `master` to bootstrap from this new beta compiler.

Step 3 above should involve very few changes as `master` was previously
bootstrapping from `beta` which is the same as `stable` at that point in time.
Step 6, however, is where we benefit from removing lots of `#[cfg(stage0)]` and
get to use new features. This also shouldn't slow the release too much as steps
1-5 requires little work other than waiting and step 6 just needs to happen at
some point during a release cycle, it's not time sensitive.

Closes #29555
Closes #29557
2016-04-19 10:56:49 -07:00
Alex Crichton
cbe6292c58 mk: Force system python for LLDB tests on OSX
Force usage of /usr/bin/python whenever we run LLDB tests on OSX because it
looks like no other Python will work.
2016-04-19 09:57:00 -07:00
Alex Crichton
ede8944ea7 rustbuild: Run all markdown documentation tests
This commit adds support to rustbuild to run all documentation tests, basically
running `rustdoc --test` over all our documentation. This also includes support
for running the error index tests.
2016-04-19 09:52:56 -07:00
Alex Crichton
9db6a41687 etc: Add debugger.Terminate() to lldb_batchmode.py
Right now on the most recent version of LLDB installed on OSX we'll segfault on
all the LLDB tests if this isn't called (unfortunately). Hopefully we've updated
LLDB on the bots to actually get this working everywhere!

Closes #32994
2016-04-19 09:39:04 -07:00
Andrea Canciani
5879ee1eca Distinguish different vfp? features
The different generations of ARM floating point VFP correspond to the
LLVM CPU features named `vfp2`, `vfp3`, and `vfp4`; they are now
exposed in Rust under the same names.

This commit fixes some crashes that would occour when checking if the
`vfp` feature exists (the crash occurs because the linear scan of the
LLVM feature goes past the end of the features whenever it searches
for a feature that does not exist in the LLVM tables).
2016-04-19 17:48:51 +02:00
Andrea Canciani
f942c28900 Do not intern NUL terminators
The C representation needed by LLVM requires strings to be
NUL-terminated, but on the Rust side they should not contain unwanted
NULs.
2016-04-19 17:44:36 +02:00
bors
c2aaad4e22 Auto merge of #33060 - jseyfried:cleanup_resolve, r=nrc
resolve: miscellaneous clean-ups

This PR consists of some small, miscellaneous clean-ups in `resolve`.
r? @eddyb
2016-04-19 08:02:59 -07:00
Eduard Burtescu
c7d564d8c9 Check transmutes between types without statically known sizes. 2016-04-19 17:03:30 +03:00
Eduard Burtescu
24ca1ec07d Guard against rustc::layout diverging from rustc_trans. 2016-04-19 16:08:45 +03:00
Eduard Burtescu
fe48a4af84 Compute LLVM-agnostic type layouts in rustc.
# Conflicts:
#	src/librustc/ty/layout.rs
2016-04-19 16:08:45 +03:00
Eduard Burtescu
efd0ea5b20 Parse data-layout specifications. 2016-04-19 16:08:45 +03:00