Commit Graph

64757 Commits

Author SHA1 Message Date
bors
f09576c4a4 Auto merge of #42443 - tommyip:better_closure_msg, r=nikomatsakis
Better closure error message

Use tracked data introduced in #42196 to provide a better closure
error message by showing why a closure implements `FnOnce`.

```
error[E0525]: expected a closure that implements the `Fn` trait, but
this closure only implements `FnOnce`
 --> $DIR/issue_26046.rs:4:19
  |
4 |       let closure = move || {
  |  ___________________^
5 | |         vec
6 | |     };
  | |_____^
  |
note: closure is `FnOnce` because it moves the variable `vec` out of
its environment
 --> $DIR/issue_26046.rs:5:9
  |
5 |         vec
  |         ^^^

error: aborting due to previous error(s)
```

Fixes #26046

r? @nikomatsakis
cc @doomrobo
2017-06-08 08:37:48 +00:00
bors
76eea743b4 Auto merge of #42481 - brson:wingnu, r=alexcrichton
Fix setting PATH during linkage on windows-gnu

This makes the behavior almost exactly the same as before the VS2017 patch, except that on MSVC builds the host bin path is no longer added to PATH. I am not sure that's actually necessary on any platform.

r? @alexcrichton

Fixes https://github.com/rust-lang/rust/issues/42422
2017-06-08 06:02:04 +00:00
bors
e1fa8de0fb Auto merge of #42522 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests

- Successful merges: #42470, #42490, #42497, #42510, #42512
- Failed merges:
2017-06-08 03:46:16 +00:00
Corey Farwell
13ae42fb20 Rollup merge of #42512 - Keruspe:master, r=alexcrichton
update git2

Fixes build with libressl
2017-06-07 21:58:46 -04:00
Corey Farwell
a04eefb66a Rollup merge of #42510 - mbrubeck:docs, r=QuietMisdreavus
Update step_by docs to say iterator instead of range

None
2017-06-07 21:58:45 -04:00
Corey Farwell
aa536f4be3 Rollup merge of #42497 - qnighy:just-use-try-in-three-places, r=eddyb
Replace some matches with try.

This patch just replaces `match`es with `?` in the compiler, which I came across when I'm reading the parser.
2017-06-07 21:58:45 -04:00
Corey Farwell
3ce88c7c8d Rollup merge of #42490 - gaurikholkar:master, r=eddyb
Changing error message from `contains interior mutability` to `may contain interior mutability`

Fixes #40313 . I have changed the message from `contains interior mutability` to `may contain interior mutability` for the following example
```
use std::cell::Cell;
use std::panic::catch_unwind;
fn main() {
    let mut x = Cell::new(22);
    catch_unwind(|| { x.set(23); });
}
```
which has been added as a ui test.

Also, the message [here](https://github.com/gaurikholkar/rust/blob/master/src/librustc_mir/transform/qualify_consts.rs#L666) and it's respective `compile-fail` test have been modified.

cc @nikomatsakis  @Mark-Simulacrum  @eddyb
2017-06-07 21:58:44 -04:00
Corey Farwell
0362891073 Rollup merge of #42470 - frewsxcv:frewsxcv/ffi-cstr-doc-examples, r=QuietMisdreavus
Add doc examples for `CString` methods.

None
2017-06-07 21:58:43 -04:00
bors
d8d5592596 Auto merge of #40706 - irfanhudda:doc-next-power-of-two, r=alexcrichton
Improve documentation of next_power_of_two

Clarify overflow behavior of `next_power_of_two`.

Related Issue: #18604
2017-06-08 01:07:08 +00:00
bors
03eb7109c7 Auto merge of #42447 - alexcrichton:update-cargo, r=petrochenkov
Update Cargo

Brings in some perf improvements!
2017-06-07 22:48:15 +00:00
Tommy Ip
345b8332bd Cover all cases in closure errors 2017-06-07 21:26:28 +01:00
Marc-Antoine Perennou
95bc0d6c79 update git2
Fixes build with libressl

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2017-06-07 21:42:31 +02:00
Matt Brubeck
b6193f3c00 Update docs to say iterator instead of range 2017-06-07 09:24:35 -07:00
bors
f062832b20 Auto merge of #42378 - steveklabnik:rustdoc-docs, r=frewsxcv
The Rustdoc book

A work-in-progress start for docs for rustdoc.

This doesn't actually generate the docs yet; I wanted to open this PR to get feedback on this approach, the chapters headings themselves, and to see if anyone wanted to help fill in the ones that aren't done yet.

Start of #42322.

/cc @rust-lang/dev-tools @rust-lang/docs
2017-06-07 15:16:46 +00:00
Alex Crichton
453080f13e Update Cargo
Brings in some perf improvements!
2017-06-07 07:57:59 -07:00
bors
a69cc85909 Auto merge of #42486 - eddyb:issue-39882, r=nikomatsakis
rustc_trans: do not store pair fields if they are ZSTs.

Should help with #39882 even if it's not a complete fix AFAICT.
2017-06-07 12:34:13 +00:00
bors
37b1f6c4f1 Auto merge of #42482 - eddyb:issue-42467, r=nikomatsakis
rustc: T: 'empty always holds for all types.

Fixes #42467 by special-casing `ReEmpty` to always hold, even for parameters.
The reason this is the case is that `ReEmpty` is the result of inferring a region variable with no constraints attached to it, so there is no lifetime a type would contain which would be strictly shorter.

r? @nikomatsakis
2017-06-07 10:09:11 +00:00
gaurikholkar
980a5b0529 indentation fixes 2017-06-07 02:35:45 -07:00
bors
89fceaa5b0 Auto merge of #42480 - eddyb:issue-42463, r=nikomatsakis
rustc_typeck: do not overlap a borrow of TypeckTables with method lookup.

If trait selection is reached, it could potentially request a closure signature, which will have to borrow the `TypeckTables` of the current function, and so those tables *should not* be mutably borrowed.

Fixes #42463.
r? @nikomatsakis
2017-06-07 07:52:12 +00:00
bors
f73f675a86 Auto merge of #42494 - frewsxcv:rollup, r=frewsxcv
Rollup of 7 pull requests

- Successful merges: #42409, #42415, #42429, #42438, #42466, #42469, #42485
- Failed merges:
2017-06-07 04:24:15 +00:00
Masaki Hara
ab72611d8f
Replace some matches with try. 2017-06-07 12:15:39 +09:00
Corey Farwell
24f48d030e Rollup merge of #42485 - Mark-Simulacrum:skip-no-doc, r=alexcrichton
Skip printing for skipped doc tests.

Followup to https://github.com/rust-lang/rust/pull/42437 to further reduce noise.

r? @alexcrichton
2017-06-06 22:36:37 -04:00
Corey Farwell
7f8467eaaf Rollup merge of #42469 - citizen428:document-assert-macros, r=steveklabnik
Doc changes for assert macros

See #29381
2017-06-06 22:36:36 -04:00
Corey Farwell
bedead25fe Rollup merge of #42466 - wesleywiser:fix_42407, r=arielb1
syntax_pos::Symbol should not implement Sync

Fixes #42407
2017-06-06 22:36:35 -04:00
Corey Farwell
9e8c94c5d7 Rollup merge of #42438 - king6cong:master, r=alexcrichton
doc rewording
2017-06-06 22:36:34 -04:00
Corey Farwell
b472b66454 Rollup merge of #42429 - venkatagiri:llvm_config, r=alexcrichton
rustc_llvm: re-run build script if config.toml changes

closes #35199
2017-06-06 22:36:34 -04:00
Corey Farwell
915b19d7c3 Rollup merge of #42415 - stephen-lazaro:Issue29094, r=arielb1
Remove 'elided' from lifetime resolution error

Removes 'elided' from lifetime resolution errors
Removes 'elided' from relevant error messaging tests

This PR resolves https://github.com/rust-lang/rust/issues/29094

r? @Mark-Simulacrum
2017-06-06 22:36:33 -04:00
Corey Farwell
e702b75b00 Rollup merge of #42409 - bjorn3:patch-3, r=frewsxcv
Better docs

Working on more doc improvements

Edit: done for today
2017-06-06 22:36:32 -04:00
bors
21d0f91444 Auto merge of #42133 - cuviper:stdio-from, r=alexcrichton
Add conversions from File and Child* handles to Stdio

`Stdio` now implements `From<ChildStdin>`, `From<ChildStdout>`,
`From<ChildStderr>`, and `From<File>`.

The `Command::stdin`/`stdout`/`stderr` methods now take any type that
implements `Into<Stdio>`.

This makes it much easier to write shell-like command chains, piping to
one another and redirecting to and from files.  Otherwise one would need
to use the unsafe and OS-specific `from_raw_fd` or `from_raw_handle`.
2017-06-07 02:11:20 +00:00
Josh Stone
9debe91675 Add conversions from File and Child* handles to Stdio
`Stdio` now implements `From<ChildStdin>`, `From<ChildStdout>`,
`From<ChildStderr>`, and `From<File>`.

The `Command::stdin`/`stdout`/`stderr` methods now take any type that
implements `Into<Stdio>`.

This makes it much easier to write shell-like command chains, piping to
one another and redirecting to and from files.  Otherwise one would need
to use the unsafe and OS-specific `from_raw_fd` or `from_raw_handle`.
2017-06-06 15:42:55 -07:00
Brian Anderson
e8689c7de7 Fix setting PATH during linkage on windows-gnu 2017-06-06 14:51:17 -07:00
bors
76242aebb9 Auto merge of #42361 - GuillaumeGomez:error-codes, r=arielb1
Add E0602

Part of #42229.

cc @Susurrus
2017-06-06 20:46:10 +00:00
gaurikholkar
bc7eb3bd3a Changing error message for interior mutability, adding ui test 2017-06-07 01:38:05 +05:30
Eduard-Mihai Burtescu
b02e3a165c rustc_typeck: do not overlap a borrow of TypeckTables with method lookup. 2017-06-06 21:48:16 +03:00
Eduard-Mihai Burtescu
1a2eb4953e rustc_trans: do not store pair fields if they are ZSTs. 2017-06-06 21:13:13 +03:00
Mark Simulacrum
bc8fabbabc Skip printing for skipped doc tests. 2017-06-06 12:00:22 -06:00
Eduard-Mihai Burtescu
ec7195f31f rustc: T: 'empty always holds forall T. 2017-06-06 19:50:01 +03:00
bors
a032cb89c5 Auto merge of #42247 - durka:patch-41, r=arielb1
add playbot jokes to run-pass test

Some funny expressions that people pull out on IRC, that might actually be useful to test pathological parser behavior.
2017-06-06 14:46:26 +00:00
bors
e1293ecbea Auto merge of #42437 - Mark-Simulacrum:skip-no-doc, r=alexcrichton
Skip documentation files without ``` when running markdown tests.

This should reduce the 'running 0 tests' noise in builds, and I believe this is a good heuristic for us to use.

cc @rust-lang/docs -- do we use the indented format for code blocks anywhere? Will we? If so, we shouldn't do this.

r? @alexcrichton
2017-06-06 11:10:37 +00:00
bors
9006db1fb0 Auto merge of #42436 - ollie27:win_spawn_name, r=alexcrichton
Always quote program name in Command::spawn on Windows

[`CreateProcess`](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425.aspx) will interpret args as part of the binary name if it
doesn't find the binary using just the unquoted name. For example if
`foo.exe` doesn't exist, `Command::new("foo").arg("bar").spawn()` will
try to launch `foo bar.exe` which is clearly not desired.
2017-06-06 08:38:50 +00:00
Tommy Ip
b1b6490c5d Group closure context ui tests 2017-06-06 09:29:06 +01:00
Tommy Ip
2c282b8e5d Add additional ui tests for issue 26046
This tests the FnMut case.
2017-06-06 09:17:06 +01:00
Tommy Ip
94c808c1d3 Update closure errors to emit context for FnMut
It now handles both FnMut and FnOnce case.
2017-06-06 09:06:56 +01:00
bors
17f493fffc Auto merge of #42394 - ollie27:rustdoc_deref_box, r=QuietMisdreavus
rustdoc: Hide `self: Box<Self>` in list of deref methods

These methods can never be called through deref so there is no point including them. For example you can't call [`into_boxed_bytes`](https://doc.rust-lang.org/nightly/std/string/struct.String.html#method.into_boxed_bytes) or [`into_string`](https://doc.rust-lang.org/nightly/std/string/struct.String.html#method.into_string) on `String`.
2017-06-06 06:18:17 +00:00
Corey Farwell
06f63f5edb Add doc example for CString::as_bytes. 2017-06-05 23:50:49 -04:00
Corey Farwell
ae4832d48a Add doc example for CString::as_bytes_with_nul. 2017-06-05 23:49:52 -04:00
Corey Farwell
815c12a765 Add doc example for CString::into_bytes_with_nul. 2017-06-05 23:48:13 -04:00
Corey Farwell
3ec1f61acc Add doc example for CString::into_bytes. 2017-06-05 23:46:44 -04:00
Corey Farwell
4db8c9f0ba Add doc example for CString::into_raw. 2017-06-05 23:43:25 -04:00
bors
e862695158 Auto merge of #41990 - qnighy:disallow-underscore-suffix-for-string-like-literals, r=nikomatsakis
Disallow underscore suffix for string-like literals.

This patch turns string/bytestring/char/byte literals followed by an underscore, like `"Foo"_`, to an error.

`scan_optional_raw_name` will parse `_` as a valid raw name, but it will be rejected by the parser. I also considered just stopping parsing when the suffix is `_`, but in that case `"Foo"_` will be lexed as two valid tokens.

Fixes the latter half of #41723.
2017-06-06 02:56:17 +00:00