Commit graph

65325 commits

Author SHA1 Message Date
bors e72580cf09 Auto merge of #42807 - arielb1:consistent-coercion, r=eddyb
Coerce fields to the expected field type

Fully fixes #31260.

This needs a crater run. I was supposed to do this last month but it slipped. Let's get this done.
2017-06-30 13:39:25 +00:00
bors 919c4a6707 Auto merge of #42782 - cuviper:iterator_for_each, r=alexcrichton
Add `Iterator::for_each`

This works like a `for` loop in functional style, applying a closure to
every item in the `Iterator`.  It doesn't allow `break`/`continue` like
a `for` loop, nor any other control flow outside the closure, but it may
be a more legible style for tying up the end of a long iterator chain.

This was tried before in #14911, but nobody made the case for using it
with longer iterators.  There was also `Iterator::advance` at that time
which was more capable than `for_each`, but that no longer exists.

The `itertools` crate has `Itertools::foreach` with the same behavior,
but thankfully the names won't collide.  The `rayon` crate also has a
`ParallelIterator::for_each` where simple `for` loops aren't possible.

> I really wish we had `for_each` on seq iterators. Having to use a
> dummy operation is annoying.  - [@nikomatsakis][1]

[1]: https://github.com/nikomatsakis/rayon/pull/367#issuecomment-308455185
2017-06-30 09:15:21 +00:00
bors 4c5b437176 Auto merge of #42930 - arielb1:llvm-next, r=alexcrichton
Rebase LLVM on top of LLVM 4.0.1

Fixes #42893.

Please don't backport this to beta as-is - I'm not sure I want rust-lang/llvm#84 to sneak to beta before it gets sufficient testing.

r? @alexcrichton
2017-06-30 06:17:52 +00:00
bors a4c68c62f0 Auto merge of #42924 - pnkfelix:mir-dataflow, r=arielb1
Shift mir-dataflow from `rustc_borrowck` to `rustc_mir` crate.

Shift mir-dataflow from `rustc_borrowck` to `rustc_mir` crate.

Turn `elaborate_drops` and `rustc_peek` implementations into MIR passes that also live in `rustc_mir` crate.

Rewire things so `rustc_driver` uses the `ElaborateDrops` from `rustc_mir` crate.

(This PR is another baby step for mir-borrowck; it is a piece of work that other people want to rebase their stuff on top of, namely developers who are doing other dataflow analyses on top of MIR.)

I have deliberately architected this PR in an attempt to minimize the number of actual code changes. The majority of the diff should be little more than changes to mod and use declarations, as well as a few visibility promotions to pub(crate) when a declaration was moved downward in the module hierarchy.

(I have no problem with other PR's that move declarations around to try to clean this up; my goal was to ensure that the diff here was as small as possible, to make the review nearly trivial.)
2017-06-30 03:56:33 +00:00
bors 5eef7c7966 Auto merge of #42902 - petrochenkov:keydcrate, r=jseyfried
Make `$crate` a keyword

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

r? @jseyfried or @nrc
2017-06-29 23:48:17 +00:00
bors 3bfc18a961 Auto merge of #42900 - sfackler:jemalloc-tweak, r=alexcrichton
Stop disabling fill in jemalloc

The underlying bug has been fixed for over 2 years!

r? @alexcrichton
2017-06-29 20:04:14 +00:00
bors 686ec28cea Auto merge of #42527 - qnighy:unsized-tuple-coercions, r=arielb1
Unsized tuple coercions

Part of #18469. Fixes #32702.

#37685 and #34451 might also be related.

This PR does the following:

- Introduce explicit `Sized` constraints on tuple initializers, similar to that of record-struct initializers. Not much relevant to the main contribution but I noticed this when making tests for unsized tuple coercions.
- Implement `(.., T): Unsize<(.., U)>` where `T: Unsize<U>`.
- Assume `(.., T)` is MaybeUnsizedUnivariant.
- Modify `src/librustc/ty/util.rs` and `src/librustc_trans/glue.rs` so that tuples and structs are uniformly traversed when translating.
2017-06-29 15:04:31 +00:00
Masaki Hara 94862c601b
Correct comments about unsizing regarding #40319. 2017-06-29 21:25:35 +09:00
Masaki Hara 141265dfe8
Give a tracking-issue number for unsized tuple coercion. 2017-06-29 21:25:35 +09:00
Masaki Hara 03660b6476
Move unsized_tuple_coercion behind a feature gate. 2017-06-29 21:25:35 +09:00
Masaki Hara b0bf1b4682
Split dst-dtor-{1,2} tests into four. 2017-06-29 21:23:33 +09:00
Masaki Hara 23d1521684
Add unsized tuple coercions. 2017-06-29 21:23:33 +09:00
Masaki Hara 17fca8b460
Check explicitly that tuple initializer is Sized. 2017-06-29 21:23:33 +09:00
petrochenkov b33fd6d759 Change some terminology around keywords and reserved identifiers 2017-06-29 15:19:53 +03:00
Vadim Petrochenkov e03948ef3e Make $crate a keyword 2017-06-29 15:19:52 +03:00
bors d0e0f53376 Auto merge of #42887 - GuillaumeGomez:remove-err-methods, r=nikomatsakis
Remove err methods

To be merged after #42519.

cc @Susurrus @QuietMisdreavus
2017-06-29 11:13:39 +00:00
bors 7acce3724d Auto merge of #42964 - arielb1:rollup, r=arielb1
Rollup of 12 pull requests

- Successful merges: #42219, #42831, #42832, #42884, #42886, #42901, #42919, #42920, #42946, #42953, #42955, #42958
- Failed merges:
2017-06-29 08:40:39 +00:00
Ariel Ben-Yehuda d3329d7102 Rollup merge of #42958 - aidanhs:aphs-better-stamping, r=Mark-Simulacrum
Better timestamps in builds

r? @Mark-Simulacrum
2017-06-29 08:40:13 +00:00
Ariel Ben-Yehuda b0ed6d11e1 Rollup merge of #42955 - matklad:doc-path, r=steveklabnik
Document that `/` works as separator on Windows

Hi Whenever I see code like `Path::new("./src/bin/main.rs")` or `path.ends_with("foo/bar")`, I wonder if it will work on Windows as I expect. Unfortunately, reading the current docs does not help to answer this question, because all examples are Unix-specific.

However, I believe that using `/` is fine, because both Windows itself [and Rust stdlib](47faf1d519/src/libstd/sys/windows/path.rs (L26)) do treat it as a file separator, and because it is [actually used](abf01e1edd/tests/git.rs (L579)) in Cargo. So looks like we can just document it?

r? @steveklabnik

cc @retep998 I don't actually program for windows that much, so I might be totally wrong, and perhaps we should advise to always use (allocating) `.join` method to construct paths of more than one component?
2017-06-29 08:40:12 +00:00
Ariel Ben-Yehuda 4f121542e9 Rollup merge of #42953 - estebank:fix-20729, r=petrochenkov
Move type parameter shadowing test to `ui`

Fix #20729.
2017-06-29 08:40:10 +00:00
Ariel Ben-Yehuda 486aca787a Rollup merge of #42946 - AndiDog:patch-1, r=GuillaumeGomez
compile-error.md: Fix link reference

Was a copy-paste mistake, I guess
2017-06-29 08:40:09 +00:00
Ariel Ben-Yehuda 647a36da73 Rollup merge of #42920 - behnam:cmp, r=BurntSushi
[libcore/cmp] Expand Ord/PartialOrd Derivable doc for enum types

Expand Derivable docblock section for `Ord` and `PartialOrd` to cover
`enum` types, in addition to the existing language explaining it for
`struct` types.
2017-06-29 08:40:08 +00:00
Ariel Ben-Yehuda bfe0098b66 Rollup merge of #42919 - zackmdavis:once_again_we_heard_you_the_first_time, r=eddyb
make lint on-by-default/implied-by messages appear only once

From review discussion on #38103 (https://github.com/rust-lang/rust/pull/38103#discussion_r94845060).

![we_heard](https://user-images.githubusercontent.com/1076988/27564103-6284b78e-5a8a-11e7-9d35-f7f297ca9573.png)

r? @nikomatsakis
2017-06-29 08:40:07 +00:00
Ariel Ben-Yehuda ea762f2bff Rollup merge of #42901 - alexcrichton:alloc-one, r=sfackler
std: Fix implementation of `Alloc::alloc_one`

This had an accidental `u8 as *mut T` where it was intended to have just a
normal pointer-to-pointer cast.

Closes #42827
2017-06-29 08:40:06 +00:00
Ariel Ben-Yehuda effd1e040e Rollup merge of #42886 - durka:pplmm-mwe, r=petrochenkov
syntax: allow negative integer literal expression to be interpolated as pattern

Fixes #42820.

r? @jseyfried
2017-06-29 08:40:05 +00:00
Ariel Ben-Yehuda 4bae0d8b7f Rollup merge of #42884 - stepancheg:set-env-run-pass, r=alexcrichton
Move global vars changing tests into run-pass

Should fix race #42795
2017-06-29 08:40:04 +00:00
Ariel Ben-Yehuda 5682494cf8 Rollup merge of #42832 - rthomas:doc-fmt, r=steveklabnik
Update docs for std::fmt::format #29355.

This rewords and removes the `Arguments` section from the docs for
fmt::format.

r? @steveklabnik
2017-06-29 08:40:03 +00:00
Ariel Ben-Yehuda 8b32c511e7 Rollup merge of #42831 - rthomas:master, r=QuietMisdreavus
Update docs for fmt::write.

#29355

I reworded it slightly to make it more clear that the function only take
two arguments - the output and the Arguments struct that can be
generated from the format_args! macro.

r? @steveklabnik
2017-06-29 08:40:02 +00:00
Ariel Ben-Yehuda bea4e60327 Rollup merge of #42219 - pwoolcoc:add-allow-fail-to-libtest, r=GuillaumeGomez
add `allow_fail` test attribute

This change allows the user to add an `#[allow_fail]` attribute to
tests that will cause the test to compile & run, but if the test fails
it will not cause the entire test run to fail. The test output will
show the failure, but in yellow instead of red, and also indicate that
it was an allowed failure.

Here is an example of the output: http://imgur.com/a/wt7ga
2017-06-29 08:40:01 +00:00
Guillaume Gomez 5acc1deaf8 Improve long error explanations for E0620 and E0621 2017-06-29 09:51:11 +02:00
Guillaume Gomez ff0fb9d906 Remove unused methods 2017-06-29 09:48:17 +02:00
Guillaume Gomez 05ac25affa Add E0620 2017-06-29 09:48:17 +02:00
Guillaume Gomez 09f42fb9cc Add E0619 2017-06-29 09:48:17 +02:00
bors dc2003b7cc Auto merge of #42848 - ids1024:redox-fix, r=sfackler
Fix Redox build, broken in ecbb896b9e
2017-06-29 06:20:17 +00:00
bors 0816b94f02 Auto merge of #42642 - venkatagiri:issue_42312, r=nikomatsakis
rustc_typeck: enforce argument type is sized

closes #42312

r? @nikomatsakis
2017-06-29 02:30:53 +00:00
bors c28cbfb127 Auto merge of #42797 - arielb1:ex-falso-ice, r=nikomatsakis
avoid translating roots with predicates that do not hold

Finally I got around to doing this.

Fixes #37725.

r? @nikomatsakis
2017-06-28 23:58:11 +00:00
Aidan Hobson Sayers 984e76468b Record some details to help with possible bad clocks 2017-06-28 23:36:34 +01:00
Esteban Küber 5ed38946be Move type parameter shadowing test to ui 2017-06-28 15:11:05 -07:00
Aidan Hobson Sayers b689e46c62 Stamp the whole build script 2017-06-28 22:54:05 +01:00
Ariel Ben-Yehuda a6ca302097 add comments 2017-06-28 23:50:24 +03:00
Venkata Giri Reddy 5ed21f5d47 rustc_typeck: use body-id of type-checking item in need_type_info 2017-06-28 20:19:52 +00:00
bors 69c65d2961 Auto merge of #42850 - estebank:unwanted-return-rotj, r=nikomatsakis
Detect missing `;` on methods with return type `()`

 - Point out the origin of a type requirement when it is the return type
   of a method
 - Point out possibly missing semicolon when the return type is `()` and
   the implicit return makes sense as a statement
 - Suggest changing the return type of methods with default return type
 - Don't suggest changing the return type on `fn main()`
 - Don't suggest changing the return type on impl fn
 - Suggest removal of semicolon (instead of being help)
2017-06-28 20:16:13 +00:00
Aleksey Kladov 40dec0984e Document that / works as separator on Windows 2017-06-28 23:14:06 +03:00
Venkata Giri Reddy 74cb315a10 rustc_typeck: enforce argument type is sized 2017-06-28 17:54:18 +00:00
Venkata Giri Reddy 6db48380ce rustc_typeck: remove old-style WF obligation 2017-06-28 17:54:17 +00:00
bors 47faf1d519 Auto merge of #42819 - scottmcm:swap-nonoverlapping, r=sfackler
Reuse the mem::swap optimizations to speed up slice::rotate

This is most helpful for compound types where LLVM didn't vectorize the loop.  Highlight: bench slice::rotate_medium_by727_strings gets 38% faster.

Exposes the swapping logic from PR https://github.com/rust-lang/rust/pull/40454 as `pub unsafe fn ptr::swap_nonoverlapping` under library feature `swap_nonoverlapping` https://github.com/rust-lang/rust/issues/42818.

(The new method seemed plausible, and was the simplest way to share the logic.  I'm not attached to it, though, so let me know if a different way would be better.)
2017-06-28 14:33:00 +00:00
Felix S. Klock II 13cd022060 Shift mir-dataflow from rustc_borrowck to rustc_mir crate.
Turn `elaborate_drops` and `rustc_peek` implementations into MIR
passes that also live in `rustc_mir` crate.

Rewire things so `rustc_driver` uses the `ElaborateDrops` from
`rustc_mir` crate.
2017-06-28 13:59:12 +02:00
bors c16930762a Auto merge of #42745 - sfackler:1.19-stabilization, r=alexcrichton
1.19 stabilization

r? @alexcrichton
2017-06-28 11:55:37 +00:00
Andreas Sommer 4fb67dcf8f Fix link reference 2017-06-28 10:55:57 +02:00
bors 6b52a1162e Auto merge of #42931 - arielb1:statement-visitor, r=eddyb
re-add the call to `super_statement` in EraseRegions

The move gathering code is sensitive to type-equality - that is rather
un-robust and I plan to fix it eventually, but that's a more invasive
change. And we want to fix the visitor anyway.

Fixes #42903.

r? @eddyb
2017-06-28 08:47:29 +00:00