Commit Graph

53249 Commits

Author SHA1 Message Date
Steven Burns
04baf2593e Generic encoded enums no longer crash on reference/pointer types 2016-05-12 22:01:49 -06: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
Björn Steinbrink
8ad6d27f87 [MIR] Enhance the SimplifyCfg pass to merge consecutive blocks 2016-05-13 01:46:52 +02:00
Jonas Schievink
96b178b131 Some simple improvements to MIR pretty printing
In short, this PR changes the MIR printer so that it:

* places an empty line between the MIR for each item
* does *not* write an empty line before the first BB when there are no
  var decls
* aligns the "// Scope" comments 50 chars in (makes the output more
  readable)
* prints the scope comments as "// scope N at ..." instead of "//
  Scope(N) at ..."
* prints a prettier scope tree:
 * no more unbalanced delimiters!
 * no more "Parent" entry (these convey no useful information)
 * drop the "Scope()" and just print scope IDs
 * no braces when the scope is empty
2016-05-13 00:20:59 +02:00
Tshepang Lekhonkhobe
226cb9c9bd doc: to_string not needed since we gots coercion 2016-05-12 23:52:05 +02: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
Tshepang Lekhonkhobe
a181d2fad4 doc: line these comments up
Looks more nice, and same is done with prior examples
2016-05-12 23:25:34 +02:00
Dan Fockler
1e901de9e8 Add error explanations for E0374, E0375, E0376 on issue #33383 2016-05-12 14:20:45 -07:00
Haiko Schol
d4bff0cdda doc: Fix comment in std::string::String example code 2016-05-12 21:49:14 +02:00
Oliver Middleton
538de73f5b rustdoc: Fix missing type parameters on impls 2016-05-12 20:08:33 +01:00
Björn Steinbrink
0eeb14eaba Improve derived implementations for enums with lots of fieldless variants
A number of trait methods like PartialEq::eq or Hash::hash don't
actually need a distinct arm for each variant, because the code within
the arm only depends on the number and types of the fields in the
variants. We can easily exploit this fact to create less and better
code for enums with multiple variants that have no fields at all, the
extreme case being C-like enums.

For nickel.rs and its by now infamous 800 variant enum, this reduces
optimized compile times by 25% and non-optimized compile times by 40%.
Also peak memory usage is down by almost 40% (310MB down to 190MB).

To be fair, most other crates don't benefit nearly as much, because
they don't have as huge enums. The crates in the Rust distribution that
I measured saw basically no change in compile times (I only tried
optimized builds) and only 1-2% reduction in peak memory usage.
2016-05-12 21:05:13 +02: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
Steven Fackler
9393e52d4d Don't use env::current_exe with libbacktrace
If the path we give to libbacktrace doesn't actually correspond to the
current process, libbacktrace will segfault *at best*.

cc #21889
2016-05-12 09:13:58 -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
Stefan Schindler
91e43acf1f Use the correct word in the explanation 2016-05-12 17:38:20 +02:00
Alex Burka
b9fce76f47 fix tidy 2016-05-12 10:59:37 -04:00
ggomez
5f2099d4af Add more details and examples in error code 2016-05-12 16:42:43 +02:00
Alex Burka
df4fe5fbd4 update "reason" for fnbox feature gate
It isn't "newly introduced" anymore.
2016-05-12 10:40:10 -04: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
843b174e93 typeck: if a private field exists, also check for a public method
For example, `Vec::len` is both a field and a method, and usually
encountering `vec.len` just means that the parens were forgotten.

Fixes: #26472
2016-05-12 07:53:17 +02: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
Seo Sanghyeon
a7902b12e8 Tighten span for E0063 2016-05-12 13:42:57 +09:00
Corey Farwell
6458b0454f Cleanup formatting and wording for std::env::temp_dir docs. 2016-05-12 00:05:25 -04: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
Masood Malekghassemi
f52b655621 Plumb inference obligations through selection 2016-05-11 17:29:23 -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
Simonas Kazlauskas
d3218fae7b Check the constants’ parameter environment 2016-05-12 01:10:34 +03:00
Masood Malekghassemi
ec7c483d67 Don't mutate the inference context when assembling 2016-05-11 14:56:52 -07:00
Masood Malekghassemi
8628ccec8f Add inferred obligation storage to all Vtable variants and SelectionContext 2016-05-11 14:40:24 -07:00
Simonas Kazlauskas
5af829b0d0 Gen right parameter envirnoment for assoc consts 2016-05-12 00:33:01 +03:00
Simonas Kazlauskas
fd70788e6d Do not use const Rib for associated constants 2016-05-12 00:31:43 +03:00
Michael Woerister
802bb578e4 trans: Use CrateContext::empty_substs_for_def_id() instead of Substs::empty() where appropriate. 2016-05-11 17:11:20 -04:00
Nick Cameron
3e14f011ec save-analysis: give better text info in value fields 2016-05-11 13:50:23 -07:00
Nick Cameron
a0a987722e save-analysis: attempt number 2 at a JSON version 2016-05-11 13:50:23 -07:00
Björn Steinbrink
49b2cdf47c [MIR trans] Optimize trans for biased switches
Currently, all switches in MIR are exhausitive, meaning that we can have
a lot of arms that all go to the same basic block, the extreme case
being an if-let expression which results in just 2 possible cases, be
might end up with hundreds of arms for large enums.

To improve this situation and give LLVM less code to chew on, we can
detect whether there's a pre-dominant target basic block in a switch
and then promote this to be the default target, not translating the
corresponding arms at all.

In combination with #33544 this makes unoptimized MIR trans of
nickel.rs as fast as using old trans and greatly improves the times for
optimized builds, which are only 30-40% slower instead of ~300%.

cc #33111
2016-05-11 22:18:46 +02:00
billyevans
bf09a9eda0 Add detailed error explanation for E0505
Part of #32777
2016-05-11 20:58:19 +01:00
Amanieu d'Antras
5cbfa1285d Fix typo in std::sync::Once documentation 2016-05-11 20:42:26 +01:00
Amanieu d'Antras
c91b104884 Export OnceState from libstd 2016-05-11 20:30:20 +01: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
Masood Malekghassemi
4e5a2e01cf Remove unification despite ambiguity in projection 2016-05-11 11:47:09 -07:00
Michael Woerister
64bc3c266c trans: Make collector handle the drop_in_place() intrinsic. 2016-05-11 14:30:33 -04:00
James Miller
f4dd4be86a Add test for collecting items in statics 2016-05-11 13:59:14 -04:00
James Miller
dace30659f Inspect MIR for statics in item collection 2016-05-11 13:58:52 -04:00
Michael Woerister
85b155f6f1 trans: Don't try to place declarations during codegen unit partitioning. 2016-05-11 13:58:23 -04:00