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
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
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
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
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
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
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`.
`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`.
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.
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
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.
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.