Commit Graph

58521 Commits

Author SHA1 Message Date
whitequark 42754ce710 Add profiling support, through the rustc -Z profile flag.
When -Z profile is passed, the GCDAProfiling LLVM pass is added
to the pipeline, which uses debug information to instrument the IR.
After compiling with -Z profile, the $(OUT_DIR)/$(CRATE_NAME).gcno
file is created, containing initial profiling information.
After running the program built, the $(OUT_DIR)/$(CRATE_NAME).gcda
file is created, containing branch counters.

The created *.gcno and *.gcda files can be processed using
the "llvm-cov gcov" and "lcov" tools. The profiling data LLVM
generates does not faithfully follow the GCC's format for *.gcno
and *.gcda files, and so it will probably not work with other tools
(such as gcov itself) that consume these files.
2017-05-01 09:16:20 +00:00
bors 06fb4d2564 Auto merge of #41651 - arielb1:missing-adjustment-2, r=eddyb
refactor the handling of lvalue ops

I think I got the code into a "mostly sane" situation.

Fixes #41604.

beta-nominating because fixes regression in #41578. I think I can do a smaller fix, but the previous code is too fragile.

r? @eddyb
2017-04-30 13:38:12 +00:00
Ariel Ben-Yehuda b7b3c232f7 refactor the handling of lvalue ops
Fixes #41604.
2017-04-30 15:49:04 +03:00
bors c0f86f5927 Auto merge of #41602 - hsivonen:explainnonnull, r=steveklabnik
Explain why zero-length slices require a non-null pointer

In reference to [a thread on Discourse](https://users.rust-lang.org/t/why-does-std-slice-from-raw-parts-require-a-non-null-pointer-for-zero-length-slices/10534), explain why `from_raw_parts` requires a non-null pointer for zero-length slices.

r? @steveklabnik
2017-04-30 07:58:10 +00:00
bors 78f6318136 Auto merge of #41643 - frewsxcv:rollup, r=frewsxcv
Rollup of 6 pull requests

- Successful merges: #41449, #41509, #41608, #41613, #41636, #41637
- Failed merges:
2017-04-30 05:25:47 +00:00
Corey Farwell 43cb7c4212 Rollup merge of #41637 - eddyb:used-not-dead, r=petrochenkov
Don't ever warn about #[used] items being dead code.

Fixes #41628 by whitelisting `#[used]` items in `rustc::middle::dead`.
2017-04-29 23:44:31 -04:00
Corey Farwell eab2af9af5 Rollup merge of #41636 - moosingin3space:fix/process-exit-in-forget-doc, r=sfackler
process:exit -> process::exit in mem::forget docs

The documentation in mem::forget says "...or call `process:exit`..."
instead of `process::exit`.

r? @steveklabnik
2017-04-29 23:44:30 -04:00
Corey Farwell b14694071c Rollup merge of #41608 - cuviper:distcheck-rust-src, r=alexcrichton
Add a distcheck for rust-src completeness

This is for the last commit of #41546.  For some reason, @bors only saw the first two commits, and wouldn't approve the last even when explicitly directed so.

r? @alexcrichton
2017-04-29 23:44:28 -04:00
Corey Farwell 3c1070689b Rollup merge of #41509 - froydnj:float-stack-reduction, r=nagisa
reduce stack requirements for floating-point formatting

Doing this speeds up float formatting by ~10% or so, and also makes the formatting code more suitable for embedded environments where stack space is at a premium.
2017-04-29 23:44:27 -04:00
Corey Farwell ab99c9beb5 Rollup merge of #41449 - Eh2406:master, r=aturon
FromIterator and Extend Cow for String

This is a quick draft to start working on [#41351](https://github.com/rust-lang/rust/issues/41351).
I don't think I got the stable attributes correct, but it is good enuf to start a conversation.
2017-04-29 23:44:27 -04:00
bors ba5b911340 Auto merge of #41593 - achernyak:def_span, r=eddyb
query for def_span

Resolves `fn def_span(&self, sess: &Session, def: DefId) -> Span;` of  #41417.

I had to change the query name to `def_sess_span` since `ty::TyCtxt` already has a method `def_span` implemented.

This also will probably have merge conflicts with  #41534 but I will resolves those once it's merged and wanted to start a code review on this one now.

r? @eddyb
2017-04-30 02:48:11 +00:00
bors afa1240e57 Auto merge of #41544 - alexcrichton:bump-bootstrap, r=brson
Update stage0 bootstrap compiler

We've got a freshly minted beta compiler, let's update to use that on nightly!
This has a few other changes associated with it as well

* A bump to the rustc version number (to 1.19.0)
* Movement of the `cargo` and `rls` submodules to their "proper" location in
  `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude`
  option this can work.
* Updates of the `cargo` and `rls` submodules to their master branches.
* Tweak to the `src/stage0.txt` format to be more amenable for Cargo version
  numbers. On the beta channel Cargo will bootstrap from a different version
  than rustc (e.g. the version numbers are different), so we need different
  configuration for this.
* Addition of `dev` as a readable key in the `src/stage0.txt` format. If present
  then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead
  of `static.rust-lang.org`. This is added to accomodate our updated release
  process with Travis and AppVeyor.
2017-04-29 20:38:15 +00:00
Eduard-Mihai Burtescu c054b2a761 Don't ever warn about #[used] items being dead code. 2017-04-29 23:18:15 +03:00
Alex Crichton 5daf557a77 Update stage0 bootstrap compiler
We've got a freshly minted beta compiler, let's update to use that on nightly!
This has a few other changes associated with it as well

* A bump to the rustc version number (to 1.19.0)
* Movement of the `cargo` and `rls` submodules to their "proper" location in
  `src/tools/{cargo,rls}`. Now that Cargo workspaces support the `exclude`
  option this can work.
* Updates of the `cargo` and `rls` submodules to their master branches.
* Tweak to the `src/stage0.txt` format to be more amenable for Cargo version
  numbers. On the beta channel Cargo will bootstrap from a different version
  than rustc (e.g. the version numbers are different), so we need different
  configuration for this.
* Addition of `dev` as a readable key in the `src/stage0.txt` format. If present
  then stage0 compilers are downloaded from `dev-static.rust-lang.org` instead
  of `static.rust-lang.org`. This is added to accomodate our updated release
  process with Travis and AppVeyor.
2017-04-29 12:11:14 -07:00
Nathan Moos 087b838dd2 process:exit -> process::exit in mem::forget docs
The documentation in mem::forget says "...or call `process:exit`..."
instead of `process::exit`.

r? @steveklabnik
2017-04-29 14:56:35 -04:00
achernyak d3b7af0e26 removed custom functions and comment 2017-04-29 13:11:01 -05:00
achernyak 00d02cf910 chaned dep nodes impl 2017-04-29 11:04:55 -05:00
bors b4d3ed64ec Auto merge of #39291 - Freyskeyd:check_context_E0423, r=petrochenkov
Checker:: Execute levenshtein before other context checking

As explain [here]() i think it's better to check for a miss typing before checking context dependent help.

```rust
struct Handle {}

struct Something {
     handle: Handle
}

fn main() {
     let handle: Handle = Handle {};

     let s: Something = Something {
         // Checker detect an error and propose a solution with `Handle { /* ... */ }`
         // but it's a miss typing of `handle`
         handle: Handle
    };
}
```

Ping: @nagisa for #39226

Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2017-04-29 15:18:52 +00:00
achernyak ad1959e8e4 added dep nodes and comment 2017-04-29 09:56:01 -05:00
bors e326e86b47 Auto merge of #41588 - cengizIO:master, r=nikomatsakis
use diff crate for compile-fail test diagnostics #41474

Hello!

This fixes #41474

We were using a custom implementation to dump the differences between expected and actual outputs of compile-fail tests.

I removed this internal implementation and added `diff` crate as a new dependency to `compile-fail`.

Again, huge thanks to @nikomatsakis for guiding.
2017-04-29 12:59:45 +00:00
bors 12e76e24cc Auto merge of #41623 - alexcrichton:update-sccache, r=TimNN
ci: Update sccache build

Pulls in mozilla/sccache@ef0d77543 to fix #40240 again after the builds included
in #41447 forgot to include the mio fixed included in #41076.

Closes #40240
2017-04-29 08:36:57 +00:00
Alex Crichton aa891a57a1 ci: Update sccache build
Pulls in mozilla/sccache@ef0d77543 to fix #40240 again after the builds included
in #41447 forgot to include the mio fixed included in #41076.

Closes #40240
2017-04-29 00:29:54 -07:00
bors b9e9a03462 Auto merge of #41564 - gaurikholkar:master, r=nikomatsakis
Disable ref hint for pattern in let and adding ui tests #40402

A fix to #40402

The `to prevent move, use ref e or ref mut e ` has been disabled.
```
fn main() {
    let v = vec![String::from("oh no")];

    let e = v[0];
}
```
now gives
```
error[E0507]: cannot move out of indexed content
 --> example.rs:4:13
  |
4 |     let e = v[0];
  |             ^^^^ cannot move out of indexed content

error: aborting due to previous error
```
I have added ui tests for the same and also modified a compile-fail test.
2017-04-29 06:16:22 +00:00
bors 95467d33cb Auto merge of #41577 - Keruspe:master, r=alexcrichton
rustbuild improvements

Properly hook up cargo and rls in the build phase, and install them, when extended build is enabled.
2017-04-29 03:56:09 +00:00
Artem Chernyak 2f73b173cb Merge branch 'master' into def_span 2017-04-28 22:44:34 -05:00
achernyak ba90718bb4 found the stack overflow culprit 2017-04-28 22:42:05 -05:00
Eh2406 0e2571b4ad FromIterator and Extend Cow for String 2017-04-28 22:30:12 -04:00
bors 810ed98d08 Auto merge of #41542 - petrochenkov:objpars2, r=nikomatsakis
syntax: Parse trait object types starting with a lifetime bound

Fixes https://github.com/rust-lang/rust/issues/39085

This was originally implemented in https://github.com/rust-lang/rust/pull/40043, then reverted, then there was some [agreement](https://github.com/rust-lang/rust/issues/39318#issuecomment-289108720) that it should be supported.
(This is hopefully the last PR related to bound parsing.)
2017-04-28 22:28:11 +00:00
achernyak 93ac5dff2a review updateds 2017-04-28 16:29:05 -05:00
Nathan Froyd b2c3102e62 fmt: use mem::uninitialized for float formatting buffers
Spending time to initialize these is just wasted work, as we'll
overwrite them soon anyway.

Fixes #41259.
2017-04-28 16:08:37 -04:00
Nathan Froyd 2499d819d4 fmt: use the minimum parts array size
The comments for flt2dec::to_shortest_str says that we only need a slice
of length 5 for the parts array.  Initializing a 16-part array is just
wasted effort and wasted stack space.  Other functions in the flt2dec
module have similar comments, so we adjust the parts arrays passed to
those functions accordingly.
2017-04-28 15:33:17 -04:00
Nathan Froyd a21f61685d fmt: reduce the stack space required by float formatting
For the two major entry points for float formatting, we split the exact
case and the shortest cases into separate functions.  We mark the
separate functions as #[inline(never) so the exact cases won't bloat
stack space in their callers unnecessarily.  The shortest cases are
marked so for similar reasons.

Fixes #41234.
2017-04-28 15:27:08 -04:00
Nathan Froyd 5a0078520e num: add minimal benchmarks for full floating-point formatting
We have benchmarks for the floating-point formatting algorithms
themselves, but not for the surrounding machinery like Formatter and
translating to the flt2dec::Part slices.
2017-04-28 15:24:09 -04:00
bors 128aa262e8 Auto merge of #41368 - nikomatsakis:incr-comp-dep-tracking-map, r=eddyb
make *most* maps private

Currently we access the `DepTrackingMap` fields directly rather than using the query accessors. This seems bad. This branch removes several such uses, but not all, and extends the macro so that queries can hide their maps (so we can prevent regressions). The extension to the macro is kind of ugly :/ but couldn't find a simple way to do it otherwise (I guess I could use a nested macro...). Anyway I figure it's only temporary.

r? @eddyb
2017-04-28 18:53:24 +00:00
Freyskeyd 0d7e6cf900
refac Move levenchstein before context dependent check
Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
2017-04-28 20:40:11 +02:00
bors ad1461efb9 Auto merge of #41575 - alexcrichton:android-qemu-server, r=TimNN
travis: Parallelize tests on Android

Currently our slowest test suite on android, run-pass, takes over 5 times longer
than the x86_64 component (~400 -> ~2200s). Typically QEMU emulation does indeed
add overhead, but not 5x for this kind of workload. One of the slowest parts of
the Android process is that *compilation* happens serially. Tests themselves
need to run single-threaded on the emulator (due to how the test harness works)
and this forces the compiles themselves to be single threaded.

Now Travis gives us more than one core per machine, so it'd be much better if we
could take advantage of them! The emulator itself is still fundamentally
single-threaded, but we should see a nice speedup by sending binaries for it to
run much more quickly.

It turns out that we've already got all the toos to do this in-tree. The
qemu-test-{server,client} that are in use for the ARM Linux testing are a
perfect match for the Android emulator. This commit migrates the custom adb
management code in compiletest/rustbuild to the same qemu-test-{server,client}
implementation that ARM Linux uses.

This allows us to lift the parallelism restriction on the compiletest test
suites, namely run-pass. Consequently although we'll still basically run the
tests themselves in single threaded mode we'll be able to compile all of them in
parallel, keeping the pipeline much more full hopefully and using more cores for
the work at hand. Additionally the architecture here should be a bit speedier as
it should have less overhead than adb which is a whole new process on both the
host and the emulator!

Locally on an 8 core machine I've seen the run-pass test suite speed up from
taking nearly an hour to only taking 5 minutes. I don't think we'll see quite a
drastic speedup on Travis but I'm hoping this change can place the Android tests
well below 2 hours instead of just above 2 hours.

Because the client/server here are now repurposed for more than just QEMU,
they've been renamed to `remote-test-{server,client}`.

Note that this PR does not currently modify how debuginfo tests are executed on
Android. While parallelizable it wouldn't be quite as easy, so that's left to
another day. Thankfull that test suite is much smaller than the run-pass test
suite.
2017-04-28 16:10:08 +00:00
achernyak 932d251698 query for def_span 2017-04-28 10:59:57 -05:00
Niko Matsakis d7d3f197f6 introduce ability to if we have typeck-tables for a given def-id
And use this in save-analysis, which used to read the map directly.
This is an attempt to sidestep the failure occuring on homu that I
cannot reproduce.
2017-04-28 10:02:06 -04:00
bors 2971d491b9 Auto merge of #41508 - michaelwoerister:generic-path-remapping, r=alexcrichton
Implement a file-path remapping feature in support of debuginfo and reproducible builds

This PR adds the `-Zremap-path-prefix-from`/`-Zremap-path-prefix-to` commandline option pair and is a more general implementation of #41419. As opposed to the previous attempt, this implementation should enable reproducible builds regardless of the working directory of the compiler.

This implementation of the feature is more general in the sense that the re-mapping will affect *all* paths the compiler emits, including the ones in error messages.

r? @alexcrichton
2017-04-28 12:09:37 +00:00
Michael Woerister 8ea050d89d Disable path remapping test on Windows. 2017-04-28 13:30:07 +02:00
gaurikholkar ab5d16a6b2 Adding documentation, indentation fixes 2017-04-28 03:58:04 -07:00
Niko Matsakis 2cca2567d9 make `ty` and `impl_trait_ref` private
This requires copying out the cycle error to avoid a cyclic borrow.  Is
this a problem? Are there paths where we expect cycles to arise and not
result in errors? (In such cases, we could add a faster way to test for
cycle.)
2017-04-28 05:49:52 -04:00
Niko Matsakis 1ac7eb8649 allow maps to be made private or public
Didn't get around to removing all public access.
2017-04-28 05:49:50 -04:00
Henri Sivonen e36f59e1a2 Explain why zero-length slices require a non-null pointer 2017-04-28 12:25:02 +03:00
Marc-Antoine Perennou a8c6ba9c6e rustbuild: only build cargo for host
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-04-28 10:48:49 +02:00
gaurikholkar 5436f859e4 Disable ref hint for pattern in let and adding ui-tests. 2017-04-28 01:31:42 -07:00
Niko Matsakis d26a7a48fe do not access `typeck_tables` map directly 2017-04-28 04:15:03 -04:00
Niko Matsakis b11da34afb do not access `associated_item` map directly 2017-04-28 04:15:03 -04:00
Niko Matsakis f35ff22fe8 do not access `inherited_impls` map directly 2017-04-28 04:15:03 -04:00
Corey Farwell d21c9b921d Rollup merge of #41583 - arielb1:cross-constant, r=eddyb
don't ICE on cross-crate associated const type mismatch

Fixes #41549.

r? @eddyb
2017-04-28 00:29:37 -04:00