Commit Graph

53153 Commits

Author SHA1 Message Date
Niko Matsakis
225fa0faff dump outputs, diff on UI test failure 2016-05-13 15:22:45 -07:00
Niko Matsakis
cb112dc8cf add UI testing framework 2016-05-13 15:22:45 -07:00
bors
33a5c9dfd1 Auto merge of #33355 - luqmana:33202-repr-ice, r=nrc
adt: Allow repr attribute on single variant enum.

Fixes #33202.
2016-05-13 12:16:53 -07:00
Luqman Aden
f3e1d57bc2 Allow repr attribute on single variant enum. 2016-05-13 12:36:57 -04:00
bors
bc5789902b Auto merge of #33531 - antonblanchard:local_stage0_fix, r=alexcrichton
Copy more libraries from local Rust to stage0

When bootstrapping Rust using a previously built toolchain, I noticed
a number of libraries were not copied in. As a result the copied in
rustc fails to execute because it can't find all its dependences.

Add them into the local_stage0.sh script.
2016-05-13 08:46:16 -07:00
bors
edb6f83b89 Auto merge of #33513 - sanxiyn:tab-in-error, r=nikomatsakis
Better handling of tab in error

cc #33240.
2016-05-13 06:26:15 -07:00
bors
a581c82bdc Auto merge of #33541 - eddyb:promote-only-temps, r=arielb1
mir: don't attempt to promote Unpromotable constant temps.

Fixes #33537. This was a non-problem in regular functions, but we also promote in `const fn`s.
There we always qualify temps so you can't depend on `Unpromotable` temps being `NOT_CONST`.
2016-05-13 03:10:46 -07:00
bors
709e5c5fde Auto merge of #33596 - nikomatsakis:issue-33586-regr-assoc-type-path, r=eddyb
re-introduce a cache for ast-ty-to-ty

It turns out that `ast_ty_to_ty` is supposed to be updating the `def`
after it finishes, but at some point in the past it stopped doing
so. This was never noticed because of the `ast_ty_to_ty_cache`, but that
cache was recently removed. This PR fixes the code to update the def
properly, but apparently that is not quite enough to make the operation
idempotent, so for now we reintroduce the cache too.

Fixes #33586.

r? @eddyb
2016-05-13 00:29:22 -07:00
bors
01ed700640 Auto merge of #33450 - SiegeLord:dep_info_no_analysis, r=nrc
Make --emit dep-info work correctly with -Z no-analysis again.

Previously, it would attempt to resolve some external crates that weren't necessary for dep-info output.

Fixes #33231.
2016-05-12 19:52:51 -07:00
bors
4ec5ce5e44 Auto merge of #33282 - alexcrichton:rustbuild-crate-tests, r=brson
rustbuild: Add support for crate tests + doctests

This commit adds support to rustbuild to run crate unit tests (those defined by
`#[test]`) as well as documentation tests. All tests are powered by `cargo test`
under the hood.

Each step requires the `libtest` library is built for that corresponding stage.
Ideally the `test` crate would be a dev-dependency, but for now it's just easier
to ensure that we sequence everything in the right order.

Currently no filtering is implemented, so there's not actually a method of
testing *only* libstd or *only* libcore, but rather entire swaths of crates are
tested all at once.

A few points of note here are:

* The `coretest` and `collectionstest` crates are just listed as `[[test]]`
  entires for `cargo test` to naturally pick up. This mean that `cargo test -p
  core` actually runs all the tests for libcore.
* Libraries that aren't tested all mention `test = false` in their `Cargo.toml`
* Crates aren't currently allowed to have dev-dependencies due to
  rust-lang/cargo#860, but we can likely alleviate this restriction once
  workspaces are implemented.

cc #31590
2016-05-12 14:31:54 -07:00
Niko Matsakis
aa00e3a552 re-introduce a cache for ast-ty-to-ty
It turns out that `ast_ty_to_ty` is supposed to be updating the `def`
after it finishes, but at some point in the past it stopped doing
so. This was never noticed because of the `ast_ty_to_ty_cache`, but that
cache was recently removed. This PR fixes the code to update the def
properly, but apparently that is not quite enough to make the operation
idempotent, so for now we reintroduce the cache too.

Fixes #33425.
2016-05-12 14:23:26 -04:00
Pavel Sountsov
215b2603f1 Fix the sed invocation to also work with BSD sed. 2016-05-12 09:32:17 -07:00
Alex Crichton
bb9062a296 rustbuild: Add support for crate tests + doctests
This commit adds support to rustbuild to run crate unit tests (those defined by
`#[test]`) as well as documentation tests. All tests are powered by `cargo test`
under the hood.

Each step requires the `libtest` library is built for that corresponding stage.
Ideally the `test` crate would be a dev-dependency, but for now it's just easier
to ensure that we sequence everything in the right order.

Currently no filtering is implemented, so there's not actually a method of
testing *only* libstd or *only* libcore, but rather entire swaths of crates are
tested all at once.

A few points of note here are:

* The `coretest` and `collectionstest` crates are just listed as `[[test]]`
  entires for `cargo test` to naturally pick up. This mean that `cargo test -p
  core` actually runs all the tests for libcore.
* Libraries that aren't tested all mention `test = false` in their `Cargo.toml`
* Crates aren't currently allowed to have dev-dependencies due to
  rust-lang/cargo#860, but we can likely alleviate this restriction once
  workspaces are implemented.

cc #31590
2016-05-12 08:52:20 -07:00
bors
e88defe718 Auto merge of #33338 - birkenfeld:issue-25356, r=jseyfried
typeck: limit number of candidates shown for a single error

No idea if 10/11 is a good limit. Are there any other such limits in rustc currently?

Fixes: #25356
2016-05-12 04:01:55 -07:00
Seo Sanghyeon
c331032755 Better handling of tab in error 2016-05-12 16:28:13 +09:00
bors
992bb1332f Auto merge of #33306 - vadixidav:master, r=alexcrichton
add implementation of Ord for Cell<T> and RefCell<T> where T: Ord

Raised this in issue #33305.
2016-05-12 00:18:15 -07:00
Georg Brandl
6ab93d7430 typeck: limit number of candidates shown for a single error
Limit of 4 taken consistent with limit for "similar impl candidates"
in rustc::traits::error_reporting.

Fixes: #25356
2016-05-12 07:39:10 +02:00
bors
ed1ece6fd8 Auto merge of #33169 - swgillespie:issue32829, r=eddyb
const_fn: Check the terminating expression of a block for blocks in a const initializer

In a const or static initializer, the `CheckBlock` check ensures that blocks in the initializer expression are only in tail positions or in items. In this case, it didn't check the terminating expression of a block, which resulted in an ICE later in the compiler pipeline if the trailing expression was itself a block. This change fixes the ICE and ensures that the proper error is emitted. This fixes the ICE in #32829 .
2016-05-11 19:48:54 -07:00
bors
22ac88f1a4 Auto merge of #33562 - GuillaumeGomez:rollup, r=steveklabnik
Rollup of 3 pull requests

- Successful merges: #33401, #33489, #33558
- Failed merges: #33342, #33475, #33517
2016-05-11 16:34:54 -07:00
Guillaume Gomez
10f9f30139 Rollup merge of #33558 - bnewbold:trivial-book-tweaks, r=steveklabnik
trivial tweaks to documentation (book)

These are small things I found while reading through The Book. The `<hash>` and `panic!` lines are simply to improve readability, while I believe the proceeding/following distinction is a bug (but might be a English dialect distinction?).

I've read `rust/CONTRIBUTING`, i'm not sure if there is anything I need to do other than submit this PR.

r? @steveklabnik
2016-05-11 21:30:20 +02:00
Guillaume Gomez
3bb96abce5 Rollup merge of #33489 - GuillaumeGomez:howto, r=alexcrichton
Improve help for make command

r? @steveklabnik
2016-05-11 21:30:19 +02:00
Guillaume Gomez
521c0ae1e8 Rollup merge of #33401 - GuillaumeGomez:index_indication, r=pnkfelix
Add rustc_on_unimplemented for Index implementation on slice

Reopening of #31071.

It also extends the possibility of `#[rustc_on_unimplemented]` by providing a small type filter in order to find the ones which corresponds the most.

r? @pnkfelix
2016-05-11 21:30:19 +02:00
bors
700279f4bf Auto merge of #33561 - alexcrichton:fix-nightiles, r=brson
mk: Fix dependencies of unwind crate on musl

The libunwind.a library was accidentally only being included for the standard
library, not the new unwind crate which implements an unwinder.
2016-05-11 12:07:06 -07:00
Alex Crichton
3e12c78172 mk: Fix dependencies of unwind crate on musl
The libunwind.a library was accidentally only being included for the standard
library, not the new unwind crate which implements an unwinder.
2016-05-11 10:47:56 -07:00
bnewbold
8e8f3911aa trivial fixes to documentation (book) 2016-05-11 11:53:25 -04:00
ggomez
4a3acfd937 Update to eddyb's PR 2016-05-11 17:01:15 +02:00
bors
e37f8593e4 Auto merge of #33556 - steveklabnik:rollup, r=steveklabnik
Rollup of 9 pull requests

- Successful merges: #33129, #33260, #33345, #33386, #33522, #33524, #33528, #33539, #33542
- Failed merges: #33342, #33475, #33517
2016-05-11 07:03:12 -07:00
Steve Klabnik
403970f96c Rollup merge of #33542 - GuillaumeGomez:move_since, r=steveklabnik
Improve "since" tag placement

Continuation of #33431.

r? @steveklabnik
2016-05-11 09:27:44 -04:00
Steve Klabnik
4b8e7cb504 Rollup merge of #33539 - nikomatsakis:static-error, r=pnkfelix
fix DFS for region error reporting

This was causing terrible error reports, because the algorithm was incorrectly identifying the constraints.

r? @eddyb
2016-05-11 09:27:44 -04:00
Steve Klabnik
130e76b46a Rollup merge of #33528 - cramertj:E0061typeo, r=jseyfried
E0061 typo fix

Fixed silly typo.
2016-05-11 09:27:44 -04:00
Steve Klabnik
8c6796f0a7 Rollup merge of #33524 - briangreenery:briangreenery-fast-and-loose, r=steveklabnik
doc: Fix tiny typo in vec-alloc.md

Change `fast an loose` to `fast and loose`.
2016-05-11 09:27:44 -04:00
Steve Klabnik
30df9d0201 Rollup merge of #33522 - mbrubeck:inline-rawvec-cap, r=nagisa
Inline RawVec::cap

This was showing up in a Servo profile.
2016-05-11 09:27:43 -04:00
Steve Klabnik
4fe787134a Rollup merge of #33386 - cramertj:E0504, r=steveklabnik
Add detailed error explanation for E0504

Part of #32777
2016-05-11 09:27:43 -04:00
Steve Klabnik
3b75f4b56e Rollup merge of #33345 - birkenfeld:issue-31754, r=pnkfelix
middle: reset loop labels while visiting closure

This should fix #31754 and follow-up #25343.  Before the latter, the closure was visited twice in the context of the enclosing fn, which made even a single closure with a loop label emit a warning.

With this change, the closure is still visited within the context of the main fn (which is intended, since it is not a separate item) but resets the found loop labels while being visited.

Fixes: #31754

Note: I amended the test file from #25343, but I don't know if the original or amended test are effective, since as far as I could see, compiletest's run-pass tests do not check for zero warnings emitted?

/cc @Manishearth
2016-05-11 09:27:43 -04:00
Steve Klabnik
82c4f5915b Rollup merge of #33260 - mrmiywj:help-on-pattern-guard, r=guillaumegomez
add help on pattern guard
2016-05-11 09:27:42 -04:00
Steve Klabnik
c5e0099a20 Rollup merge of #33129 - GuillaumeGomez:fmt_doc, r=steveklabnik
Doc improvement on std::fmt module

Part of #29355.

r? @steveklabnik
2016-05-11 09:27:42 -04:00
Guillaume Gomez
e6c0ff65ed Create Weight enum
Add more comments for the global understanding
2016-05-11 13:24:24 +02:00
ggomez
61e6169ffe Improve weight algorithm and tests 2016-05-11 13:24:22 +02:00
Guillaume Gomez
b8fad79a07 Improve error message for Index trait on slices 2016-05-11 13:22:01 +02:00
ggomez
e9797d4be5 Extend rustc_on_unimplemented flag: if a message is available at an impl, this message will be displayed instead 2016-05-11 13:18:57 +02:00
bors
c049541741 Auto merge of #33239 - eddyb:mir-temp-drops, r=arielb1
mir: drop temps outside-in by scheduling the drops inside-out.

It was backwards all along, but only noticeable with multiple drops in one rvalue scope. Fixes #32433.
2016-05-11 03:15:05 -07:00
Eduard Burtescu
e940de64ca mir: drop temps outside-in by scheduling the drops inside-out. 2016-05-11 10:46:36 +03:00
Sean Gillespie
94a055263e Add regression test for ICE in constant blocks 2016-05-10 23:48:12 -07:00
Alex Crichton
8d65591cf2 rustbuild: Tighten dependencies of build scripts
Ensure that `rerun-if-changed` is printed for all build scripts to ensure that
they've all got the right list of dependencies.
2016-05-10 23:41:19 -07:00
bors
c7ab8840c8 Auto merge of #33425 - eddyb:rift, r=nikomatsakis
Split the type context into a global and a local (inference-only) one.

After this change, each `InferCtxt` creates its own local type interner for types with inference by-products.
Most of the code which handles both a global and a local interner uses `'gcx` and `'tcx` for them.
A reference to the type context in that situation (e.g. `infcx.tcx`) is `TyCtxt<'a, 'gcx, 'tcx>`.
The global type context which used to be `&'a TyCtxt<'tcx>` is now `TyCtxt<'a, 'tcx, 'tcx>`.

In order to minimize the number of extra lifetime parameters, many functions became methods.
Where possible (some inherent impls), lifetime parameters were added on the impl, not each method.

As inference by-products no longer escape their inference contexts, memory usage is lower.
Example of `-Z time-passes` excerpt for `librustc`, stage1 (~100MB gains):
Before "rustc: Split local type contexts interners from the global one.":
```
time: 0.395; rss: 335MB item-types checking
time: 15.392; rss: 472MB        item-bodies checking
time: 0.000; rss: 472MB drop-impl checking
time: 1.140; rss: 478MB const checking
time: 0.139; rss: 478MB privacy checking
time: 0.024; rss: 478MB stability index
time: 0.072; rss: 478MB intrinsic checking
time: 0.038; rss: 478MB effect checking
time: 0.255; rss: 478MB match checking
time: 0.128; rss: 484MB liveness checking
time: 1.372; rss: 484MB rvalue checking
time: 1.404; rss: 597MB MIR dump
time: 0.809; rss: 599MB MIR passes
```
After:
```
time: 0.467; rss: 337MB item-types checking
time: 17.443; rss: 395MB        item-bodies checking
time: 0.000; rss: 395MB drop-impl checking
time: 1.423; rss: 401MB const checking
time: 0.141; rss: 401MB privacy checking
time: 0.024; rss: 401MB stability index
time: 0.116; rss: 401MB intrinsic checking
time: 0.038; rss: 401MB effect checking
time: 0.382; rss: 401MB match checking
time: 0.132; rss: 407MB liveness checking
time: 1.678; rss: 407MB rvalue checking
time: 1.614; rss: 503MB MIR dump
time: 0.957; rss: 512MB MIR passes
```

**NOTE**: Functions changed to methods weren't re-indented to keep this PR easier to review.
Once approved, the changes will be mechanically performed.
However, indentation changes of function arguments are there - and I believe there's a way to hide whitespace-only changes in diffs on GitHub.
2016-05-10 23:40:09 -07:00
Eduard Burtescu
42eb7032fa Fixup indentation after methodification. 2016-05-11 08:48:12 +03:00
bors
80ec1b9f10 Auto merge of #33512 - birkenfeld:issue-25944, r=sanxiyn
rustdoc: remove artificial indentation of doctest code

The indentation makes the examples look nicer when printed (when is this done?), but breaks tests using multi-line string literals.

Fixes: #25944
2016-05-10 20:14:46 -07:00
Pavel Sountsov
ba04a52b96 Also rename the print_from_ast. 2016-05-10 19:21:44 -07:00
Eduard Burtescu
a1c170fc35 rustc: Split local type contexts interners from the global one. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
31a07b0ce6 rustc_typeck: Generalize over 'tcx != 'gcx. 2016-05-11 04:14:58 +03:00