Commit Graph

52498 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Eduard Burtescu
0776399eac Make data-layout mandatory in target specs. 2016-04-19 16:08:45 +03:00
bors
478a33dabc Auto merge of #33002 - mitaa:rdoc-cross-impls, r=alexcrichton
rustdoc: refine cross-crate impl inlining

This changes the current rule that impls within `doc(hidden)` modules aren't inlined, to only inlining impls where the implemented trait and type are reachable in documentation.

fixes #14586
fixes #31948

.. and also applies the reachability checking to cross-crate links.

fixes #28480

r? @alexcrichton
2016-04-19 05:00:10 -07:00
bors
e8c0aeb88b Auto merge of #32985 - caipre:rustdoc-disambiguate-impl-anchors, r=alexcrichton
rustdoc: Disambiguate anchors

Closes https://github.com/rust-lang/rust/issues/32890
2016-04-19 01:49:13 -07:00
bors
14f61c87ff Auto merge of #32866 - davidhewitt:master, r=apasel422
Implement `From<Vec<T>>` and `Into<Vec<T>>` for `VecDeque<T>`
2016-04-18 21:05:58 -07:00
bors
d36ad55aa5 Auto merge of #32755 - alexcrichton:rustbuild-start-test, r=brson
rustbuild: Add support for compiletest test suites

This commit adds support in rustbuild for running all of the compiletest test
suites as part of `make check`. The `compiletest` program was moved to
`src/tools` (like `rustbook` and others) and is now just compiled like any other
old tool. Each test suite has a pretty standard set of dependencies and just
tweaks various parameters to the final compiletest executable.

Note that full support is lacking in terms of:

* Once a test suite has passed, that's not remembered. When a test suite is
  requested to be run, it's always run.
* The arguments to compiletest probably don't work for every possible
  combination of platforms and testing environments just yet. There will likely
  need to be future updates to tweak various pieces here and there.
* Cross compiled test suites probably don't work just yet, support for that will
  come in a follow-up patch.
2016-04-18 17:53:58 -07:00
Alex Crichton
b325baf0ae rustbuild: Add support for compiletest test suites
This commit adds support in rustbuild for running all of the compiletest test
suites as part of `make check`. The `compiletest` program was moved to
`src/tools` (like `rustbook` and others) and is now just compiled like any other
old tool. Each test suite has a pretty standard set of dependencies and just
tweaks various parameters to the final compiletest executable.

Note that full support is lacking in terms of:

* Once a test suite has passed, that's not remembered. When a test suite is
  requested to be run, it's always run.
* The arguments to compiletest probably don't work for every possible
  combination of platforms and testing environments just yet. There will likely
  need to be future updates to tweak various pieces here and there.
* Cross compiled test suites probably don't work just yet, support for that will
  come in a follow-up patch.
2016-04-18 16:30:01 -07:00
bors
b324fa7204 Auto merge of #33081 - steveklabnik:rollup, r=steveklabnik
Rollup of 6 pull requests

- Successful merges: #32558, #32906, #33007, #33008, #33035, #33058
- Failed merges: #32912
2016-04-18 12:03:14 -07:00
Steve Klabnik
ec44ddc33a Rollup merge of #33058 - Manishearth:fx-E0102, r=GuillaumeGomez
Update E0102's example (fixes #33057)

r? @GuillaumeGomez
2016-04-18 14:50:35 -04:00
Steve Klabnik
31374d8030 Rollup merge of #33035 - jbranchaud:use-consistent-variable-names-in-ownership, r=GuillaumeGomez
Use `v` instead of `v1` for consistency

The code examples and previous paragraphs all use `v` and `v2`
2016-04-18 14:50:35 -04:00
Steve Klabnik
aceeca49c8 Rollup merge of #33008 - sanmai-NL:patch-1, r=steveklabnik
grammar: fix

Reading this, one item stood out a bit. Small improvements here.

1. ‘Compile-time’ is not a noun, ‘compilation time’ was meant;
1. Mathematical formulas are best not rendered as code;
1. Use the same tense as in other items.
2016-04-18 14:50:35 -04:00
Steve Klabnik
d3d9bd0e47 Rollup merge of #33007 - notriddle:master, r=steveklabnik
Do not use "bind" to refer to both referencing and to assignment

See https://users.rust-lang.org/t/difference-between-four-references/5406/7
2016-04-18 14:50:35 -04:00
Steve Klabnik
108a9e43e3 Rollup merge of #32906 - jocki84:jocki84-book-size, r=steveklabnik
Reword explanation of 'size' types.

Do not reference machine 'pointers' in explanation of 'size' types.

I think the number of elements that can be directly addressed is a fundamental feature of a machine architecture in its own right. The fact that it coincides with the ‘size’ of a pointer should be viewed as an ‘implementation detail’ ;)
2016-04-18 14:50:34 -04:00
Steve Klabnik
5d0dca363f Rollup merge of #32558 - sanxiyn:rustdoc-self-link, r=steveklabnik
Avoid linking to itself in implementors section of trait page

Fix #32474.
2016-04-18 14:50:34 -04:00
David Hewitt
1861951fd9 Added From<VecDeque<T>> for Vec<T> and From<Vec<T>> for VecDeque<T> 2016-04-18 18:53:59 +01:00
bors
d00782494b Auto merge of #33042 - alexcrichton:clean-doc, r=nikomatsakis
rustbuild: Clean more as part of `make clean`

Clean out old documentation as well as the new test/tools directories. Should
prevent a problem that happened this morning where a PR bounced and then it left
docs with "broken links" so all future PRs bounced.
2016-04-18 09:53:13 -07:00
Manish Goregaokar
f089cf9b2f
Update E0102's example (fixes #33057) 2016-04-18 18:35:43 +05:30
bors
63760acf31 Auto merge of #33064 - jseyfried:improve_resolve_performance, r=eddyb
resolve: Improve performance

This fixes #33061 by speeding up searchs through all traits in scope, a bottleneck in `resolve`.

According to my measurements, this PR improves resolution performance by a factor of 3.4x on `librustc`, which almost completely reverses the 3.75x performance regression reported in #33061.

r? @eddyb
2016-04-17 19:11:20 -07:00
Jeffrey Seyfried
6ae80273a0 resolve: improve performance 2016-04-18 02:01:57 +00:00
Nick Platt
894caf8364 rustdoc: Disambiguate anchors for assoc item impls 2016-04-17 21:41:55 -04:00
Jeffrey Seyfried
1e134a47d3 Update outdated comment 2016-04-18 00:26:18 +00:00
mitaa
77b409a674 Reachability check cross-crate links 2016-04-18 01:56:01 +02:00
mitaa
cfad7ad947 Perform doc-reachability check for inlined impls
This changes the current rule that impls within `doc(hidden)` modules
aren't inlined, to only inlining impls where the implemented
trait and type are reachable in documentation.
2016-04-18 01:55:54 +02:00
Jeffrey Seyfried
b01e63009f Refactor the per-module node map module_children into a per-resolver map. 2016-04-17 23:48:13 +00:00
Jeffrey Seyfried
5b12832012 Make import resolution and error resolution reporting deterministic.
These tasks used to depend on the iteration order of `module_children`.
2016-04-17 23:48:11 +00:00
Jeffrey Seyfried
5f47915554 Refactor is_prelude to only apply to glob imports 2016-04-17 23:47:12 +00:00
bors
ed7c56796e Auto merge of #33034 - tbu-:pr_doc_mutex_lock, r=nagisa
Add a comment about locking a `Mutex` multiple times

Fixes #32260.
2016-04-17 14:00:56 -07:00
Tobias Bucher
df748bf293 Add a comment about locking a Mutex multiple times
Fixes #32260.
2016-04-17 21:30:52 +02:00