]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoRollup merge of #70658 - davidtwco:issue-70285-still-further-specializable, r=eddyb
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:28:00 +0000 (14:28 +0200)]
Rollup merge of #70658 - davidtwco:issue-70285-still-further-specializable, r=eddyb

add `STILL_FURTHER_SPECIALIZABLE` flag

Contributes to #70285.

This PR adds a `STILL_FURTHER_SPECIALIZABLE` flag to `TypeFlags`
which replaces `needs_infer` and `needs_subst` in `Instance::resolve`
and `assemble_candidates_from_impls`.

r? @eddyb

4 years agoRollup merge of #70634 - Centril:import-directly, r=Mark-Simulacrum
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:58 +0000 (14:27 +0200)]
Rollup merge of #70634 - Centril:import-directly, r=Mark-Simulacrum

Remove some reexports in `rustc_middle`

This will help get these imports out of the way of detecting the true dependencies in and out to `rustc_middle`, thereby helping future work towards https://github.com/rust-lang/rust/issues/65031.

4 years agoRollup merge of #70631 - ehuss:update-cargo, r=ehuss
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:57 +0000 (14:27 +0200)]
Rollup merge of #70631 - ehuss:update-cargo, r=ehuss

Update cargo

8 commits in 8a0d4d9c9abc74fd670353094387d62028b40ae9..6e07d2dfb7fc87b1c9489de41da4dafa239daf03
2020-03-24 17:57:04 +0000 to 2020-03-31 03:22:39 +0000
- Fix man page typo for "Owner Options". (rust-lang/cargo#8057)
- enable progress bar on all UNIX platforms (rust-lang/cargo#8054)
- Squelch some rustdoc warnings. (rust-lang/cargo#8052)
- Remove clippy tests. (rust-lang/cargo#8053)
- Fix -Zfeatures=itarget with certain host dependencies (rust-lang/cargo#8048)
- Checking for binary that is built as an implicit dependency of an integration test. (rust-lang/cargo#8020)
- Use stabilized version of rustdoc's --crate-version (rust-lang/cargo#8039)
- Remove the `git-checkout` subcommand. (rust-lang/cargo#8040)

4 years agoRollup merge of #70615 - Lezzz:rename-tables, r=oli-obk
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:55 +0000 (14:27 +0200)]
Rollup merge of #70615 - Lezzz:rename-tables, r=oli-obk

Renamed `PerDefTables` to `Tables`

Originally suggested by @eddyb

4 years agoRollup merge of #70421 - Centril:recover-const-async-fn-ptr, r=estebank
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:54 +0000 (14:27 +0200)]
Rollup merge of #70421 - Centril:recover-const-async-fn-ptr, r=estebank

parse: recover on `const fn()` / `async fn()`

Recover on `const fn()` and `async fn()` function pointers, suggesting to remove the qualifier.
For example:
```
error: an `fn` pointer type cannot be `async`
  --> $DIR/recover-const-async-fn-ptr.rs:6:11
   |
LL | type T3 = async fn();
   |           -----^^^^^
   |           |
   |           `async` because of this
   |           help: remove the `async` qualifier
```

r? @estebank

4 years agoRollup merge of #70281 - xfix:infallible-hash, r=dtolnay
Mazdak Farrokhzad [Thu, 2 Apr 2020 12:27:52 +0000 (14:27 +0200)]
Rollup merge of #70281 - xfix:infallible-hash, r=dtolnay

Implement Hash for Infallible

https://www.reddit.com/r/rust/comments/fmllgx/never_crate_stable_alternative_to/ lists not implementing `Hash` as a reason for the `never` crate. I see no reason not to implement `Hash` for `Infallible`, so might as well do it.

No changes necessary for `!`, because `!` already implements `Hash` (see https://github.com/rust-lang/rust/pull/51404).

4 years agofix fulldeps test fallout
Mazdak Farrokhzad [Tue, 31 Mar 2020 21:02:59 +0000 (23:02 +0200)]
fix fulldeps test fallout

4 years agonix CachingSourceMapView reexport
Mazdak Farrokhzad [Tue, 31 Mar 2020 19:51:04 +0000 (21:51 +0200)]
nix CachingSourceMapView reexport

4 years agodirect imports for langitem stuff
Mazdak Farrokhzad [Tue, 31 Mar 2020 19:38:14 +0000 (21:38 +0200)]
direct imports for langitem stuff

4 years agouse direct import for ErrorReported
Mazdak Farrokhzad [Tue, 31 Mar 2020 19:18:30 +0000 (21:18 +0200)]
use direct import for ErrorReported

4 years agonix rustc_target::abi::* reexport in ty::layout
Mazdak Farrokhzad [Tue, 31 Mar 2020 16:16:47 +0000 (18:16 +0200)]
nix rustc_target::abi::* reexport in ty::layout

4 years agoadd `STILL_FURTHER_SPECIALIZABLE` flag
David Wood [Wed, 1 Apr 2020 15:20:27 +0000 (16:20 +0100)]
add `STILL_FURTHER_SPECIALIZABLE` flag

This commit adds a STILL_FURTHER_SPECIALIZABLE flag to `TypeFlags`
which replaces `needs_infer` and `needs_subst` in `Instance::resolve`
and `assemble_candidates_from_impls.`

Signed-off-by: David Wood <david@davidtw.co>
4 years agoAuto merge of #70628 - pietroalbini:gha-multiple-tries, r=Mark-Simulacrum
bors [Thu, 2 Apr 2020 09:10:06 +0000 (09:10 +0000)]
Auto merge of #70628 - pietroalbini:gha-multiple-tries, r=Mark-Simulacrum

GHA: enable running multiple try builds at the same time

While for auto, try and PR builds we only want the latest commit to be tested, that's not true for try builds: each commit pushed to the branch is a different PR being tested, and we want multiple PRs to be tested in parallel if there is enough demand.

Fixes #70569

4 years agoAuto merge of #70362 - TimDiekmann:alloc-overhaul, r=Amanieu
bors [Thu, 2 Apr 2020 06:08:35 +0000 (06:08 +0000)]
Auto merge of #70362 - TimDiekmann:alloc-overhaul, r=Amanieu

Overhaul of the `AllocRef` trait to match allocator-wg's latest consens; Take 2

GitHub won't let me reopen #69889 so I make a new PR.

In addition to #69889 this fixes the unsoundness of `RawVec::into_box` when using allocators supporting overallocating. Also it uses `MemoryBlock` in `AllocRef` to unify `_in_place` methods by passing `&mut MemoryBlock`. Additionally, `RawVec` now checks for `size_of::<T>()` again and ignore every ZST. The internal capacity of `RawVec` isn't used by ZSTs anymore, as `into_box` now requires a length to be specified.

r? @Amanieu

fixes rust-lang/wg-allocators#38
fixes rust-lang/wg-allocators#41
fixes rust-lang/wg-allocators#44
fixes rust-lang/wg-allocators#51

4 years agoAuto merge of #70667 - flip1995:clippyup, r=Manishearth
bors [Thu, 2 Apr 2020 03:16:46 +0000 (03:16 +0000)]
Auto merge of #70667 - flip1995:clippyup, r=Manishearth

Update Clippy

r? @Manishearth

Closes #70663

4 years agoAuto merge of #70672 - Dylan-DPC:rollup-cco9bbd, r=Dylan-DPC
bors [Wed, 1 Apr 2020 20:30:35 +0000 (20:30 +0000)]
Auto merge of #70672 - Dylan-DPC:rollup-cco9bbd, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70535 (Track the finalizing node in the specialization graph)
 - #70590 (Miri: make backtrace function names and spans match up)
 - #70616 (rustc_target::abi: rename FieldPlacement to FieldsShape.)
 - #70626 (cargotest: remove webrender)
 - #70649 (clean up E0468 explanation)
 - #70662 (compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.)

Failed merges:

r? @ghost

4 years agoRollup merge of #70662 - eddyb:compiletest-stdout-fix, r=Mark-Simulacrum
Dylan DPC [Wed, 1 Apr 2020 20:25:23 +0000 (22:25 +0200)]
Rollup merge of #70662 - eddyb:compiletest-stdout-fix, r=Mark-Simulacrum

compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.

This PR undoes a change made during #69916, which became unnecessary during review but was left in by accident, and which isn't correct due to `libtest` using `std::io::set_print`, which overwrites the `println!` behavior but *not* `writeln!(std::io::stdout(), ...)`.

The effect of using `writeln!(std::io::stdout(), ...)` was that the diff output would show *while* running the tests, instead of at the end, when failing tests are listed.

r? @Mark-Simulacrum cc @oli-obk

4 years agoRollup merge of #70649 - GuillaumeGomez:cleanup-e0468, r=Dylan-DPC
Dylan DPC [Wed, 1 Apr 2020 20:25:22 +0000 (22:25 +0200)]
Rollup merge of #70649 - GuillaumeGomez:cleanup-e0468, r=Dylan-DPC

clean up E0468 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70626 - pietroalbini:remove-webrender-cargotest, r=Mark-Simulacrum
Dylan DPC [Wed, 1 Apr 2020 20:25:20 +0000 (22:25 +0200)]
Rollup merge of #70626 - pietroalbini:remove-webrender-cargotest, r=Mark-Simulacrum

cargotest: remove webrender

The current webrender commit occasionally fails without a reason, and the latest webrender commit is missing a dependency on our Windows builders. It's not worth installing an extra dependency for cargotest, and the spurious failure makes keeping this test not worth it.

r? @Mark-Simulacrum

4 years agoRollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obk
Dylan DPC [Wed, 1 Apr 2020 20:25:18 +0000 (22:25 +0200)]
Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obk

rustc_target::abi: rename FieldPlacement to FieldsShape.

Originally suggested by @eddyb.

4 years agoRollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obk
Dylan DPC [Wed, 1 Apr 2020 20:25:16 +0000 (22:25 +0200)]
Rollup merge of #70590 - RalfJung:miri-backtrace, r=oli-obk

Miri: make backtrace function names and spans match up

Currently, Miri backtraces are a bit confusing:
```
error: Undefined Behavior: entering unreachable code
  --> tests/compile-fail/never_transmute_void.rs:10:11
   |
10 |     match v {} //~ ERROR  entering unreachable code
   |           ^ entering unreachable code
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
note: inside call to `f` at tests/compile-fail/never_transmute_void.rs:17:5
  --> tests/compile-fail/never_transmute_void.rs:17:5
   |
17 |     f(v); //~ inside call to `f`
   |     ^^^^
   = note: inside call to `main` at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:67:34
   = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/rt.rs:52:73
   = note: inside call to closure at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/src/libstd/sys_common/backtrace.rs:130:5
```
When reading this like a normal backtrace, one would expect that e.g. the backrace involves the "main" function at "libstd/rt.rs:67:34". But that is not actually where we are in the main function, that is *where the main function is called*.

This is not how backtraces are usually rendered (including e.g. with `RUST_BACKTRACE=1`). Usually we print next to each function name where inside that function the frame is currently executing, not where the *parent* frame is executing. With this PR and the Miri side at https://github.com/rust-lang/miri/pull/1283, the backtrace now looks as follows:
```
error: Undefined Behavior: entering unreachable code
  --> tests/compile-fail/never_transmute_void.rs:10:11
   |
10 |     match v {} //~ ERROR entering unreachable code
   |           ^ entering unreachable code
   |
   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
   = note: inside `f` at tests/compile-fail/never_transmute_void.rs:10:11
note: inside `main` at tests/compile-fail/never_transmute_void.rs:17:5
  --> tests/compile-fail/never_transmute_void.rs:17:5
   |
17 |     f(v); //~ inside `main`
   |     ^^^^
   = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:67:34
   = note: inside closure at /home/r/src/rust/rustc/src/libstd/rt.rs:52:73
   = note: inside `std::sys_common::backtrace::__rust_begin_short_backtrace::<[closure@DefId(1:6034 ~ std[87db]::rt[0]::lang_start_internal[0]::{{closure}}[0]::{{closure}}[0]) 0:&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe], i32>` at /home/r/src/rust/rustc/src/libstd/sys_common/backtrace.rs:130:5
```
Now function name and printed line numbers match up in the notes.

This code is partially shared with const-eval, so the change also affects const-eval: instead of printing what is being called at some span, we print which function/constant this span is inside.

With this, we can also remove the `span` field from Miri's stack frames (which used to track the *caller span* of that frame, quite confusing), and then get of a whole lot of `span` arguments that ultimately just served to fill that field (and as a fallback for `caller_location`, which however was never actually used).

r? @oli-obk

4 years agoRollup merge of #70535 - jonas-schievink:graph-refactor, r=nikomatsakis
Dylan DPC [Wed, 1 Apr 2020 20:25:15 +0000 (22:25 +0200)]
Rollup merge of #70535 - jonas-schievink:graph-refactor, r=nikomatsakis

Track the finalizing node in the specialization graph

Fixes https://github.com/rust-lang/rust/issues/70419
Fixes https://github.com/rust-lang/rust/issues/70442

r? @eddyb

4 years agoUpdate Clippy
flip1995 [Wed, 1 Apr 2020 19:06:06 +0000 (21:06 +0200)]
Update Clippy

4 years agocompiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.
Eduard-Mihai Burtescu [Wed, 1 Apr 2020 16:40:09 +0000 (19:40 +0300)]
compiletest: don't use `std::io::stdout()`, as it bypasses `set_print`.

4 years agoAuto merge of #70653 - Centril:rollup-vh5x5e5, r=Centril
bors [Wed, 1 Apr 2020 14:21:31 +0000 (14:21 +0000)]
Auto merge of #70653 - Centril:rollup-vh5x5e5, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #70511 (Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization)
 - #70522 (Improve error messages for raw strings (#60762))
 - #70547 (Add `can_unwind` field to `FnAbi`)
 - #70591 (Ensure LLVM is in the link path for "fulldeps" tests)
 - #70627 (Use place directly its copy)
 - #70652 (Add git repo address to unstable book)

Failed merges:

 - #70634 (Remove some reexports in `rustc_middle`)

r? @ghost

4 years agoRollup merge of #70652 - lzutao:patch-1, r=Centril
Mazdak Farrokhzad [Wed, 1 Apr 2020 12:32:21 +0000 (14:32 +0200)]
Rollup merge of #70652 - lzutao:patch-1, r=Centril

Add git repo address to unstable book

4 years agoRollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obk
Mazdak Farrokhzad [Wed, 1 Apr 2020 12:32:19 +0000 (14:32 +0200)]
Rollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obk

Use place directly its copy

r? @oli-obk

4 years agoRollup merge of #70591 - cuviper:fulldeps-library-path, r=Mark-Simulacrum
Mazdak Farrokhzad [Wed, 1 Apr 2020 12:32:17 +0000 (14:32 +0200)]
Rollup merge of #70591 - cuviper:fulldeps-library-path, r=Mark-Simulacrum

Ensure LLVM is in the link path for "fulldeps" tests

This is a follow-up to #70123, which added `llvm-config --libdir` to the
`LIBRARY_PATH` for rustc tools. We need the same for "run-make-fulldeps"
and "ui-fulldeps" tests which depend on compiler libraries, implicitly
needing to link to `-lLLVM` as well.

4 years agoRollup merge of #70547 - wesleywiser:extract_can_unwind, r=eddyb
Mazdak Farrokhzad [Wed, 1 Apr 2020 12:32:16 +0000 (14:32 +0200)]
Rollup merge of #70547 - wesleywiser:extract_can_unwind, r=eddyb

Add `can_unwind` field to `FnAbi`

This is a pure refactoring with no behavior changes.

Extracted out of #70467

r? @eddyb

4 years agoRollup merge of #70522 - rcoh:60762-raw-string-errors, r=petrochenkov
Mazdak Farrokhzad [Wed, 1 Apr 2020 12:32:14 +0000 (14:32 +0200)]
Rollup merge of #70522 - rcoh:60762-raw-string-errors, r=petrochenkov

Improve error messages for raw strings (#60762)

This diff improves error messages around raw strings in a few ways:
- Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)
- Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings
- Detect potentially intended terminators (longest sequence of "#*" is suggested)

Fixes #60762
cc @estebank who reviewed the original (abandoned) PR for the same ticket.
r? @Centril

4 years agoRollup merge of #70511 - ecstatic-morse:mir-dataflow-graphviz, r=davidtwco
Mazdak Farrokhzad [Wed, 1 Apr 2020 12:32:12 +0000 (14:32 +0200)]
Rollup merge of #70511 - ecstatic-morse:mir-dataflow-graphviz, r=davidtwco

Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization

Previously, to visualize the results of a MIR dataflow pass, one had to add a `#[rustc_mir(borrowck_graphviz_postflow)]` attribute to functions of interest. However, there is no way to specify this attribute on closures and generators, so it was impossible to view results for these MIR bodies.

This PR adds a flag, `-Z dump-mir-dataflow`, which will output the dataflow results for any functions specified in `-Z dump-mir` to the output directory specified by `-Z dump-mir-dir`. This behavior is modeled on the `-Z dump-mir-graphviz` flag.

4 years agoAdd git repo address to unstable book
lzutao [Wed, 1 Apr 2020 12:10:19 +0000 (19:10 +0700)]
Add git repo address to unstable book

4 years agoclean up E0468 explanation
Guillaume Gomez [Wed, 1 Apr 2020 11:18:14 +0000 (13:18 +0200)]
clean up E0468 explanation

4 years agoAdd missing allocation guard in `RawVec::grow`
Tim Diekmann [Wed, 1 Apr 2020 08:26:30 +0000 (10:26 +0200)]
Add missing allocation guard in `RawVec::grow`

4 years agoAuto merge of #70571 - RalfJung:miri, r=RalfJung
bors [Wed, 1 Apr 2020 07:52:39 +0000 (07:52 +0000)]
Auto merge of #70571 - RalfJung:miri, r=RalfJung

bump Miri

r? @ghost Cc @oli-obk

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

4 years agoAuto merge of #70414 - lopsided98:armv6-gcc-8, r=pietroalbini
bors [Wed, 1 Apr 2020 03:56:44 +0000 (03:56 +0000)]
Auto merge of #70414 - lopsided98:armv6-gcc-8, r=pietroalbini

Upgrade GCC to 8.3.0, glibc to 2.17.0 and crosstool-ng to 1.24.0 for dist-arm-linux and dist-armhf-linux

Attempt to fix #69420 in the same manner as #65302 did for armv7l. I have tested that this eliminates the segfault while building a `hello_world` package on `arm-unknown-linux-gnueabihf`.

I have not been able to test whether the bug exists for `arm-unknown-linux-gnueabi` as well, but I suspect it does, so I upgraded the toolchain for that platform as well.

4 years agoAddress review feedback
Wesley Wiser [Tue, 31 Mar 2020 12:27:09 +0000 (08:27 -0400)]
Address review feedback

4 years agoRenamed `PerDefTables` to `Tables`
Valentin Lazureanu [Mon, 30 Mar 2020 17:06:00 +0000 (17:06 +0000)]
Renamed `PerDefTables` to `Tables`

4 years agoAuto merge of #70638 - Dylan-DPC:rollup-2tgfxjt, r=Dylan-DPC
bors [Tue, 31 Mar 2020 22:28:18 +0000 (22:28 +0000)]
Auto merge of #70638 - Dylan-DPC:rollup-2tgfxjt, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #68770 (BTreeMap/BTreeSet: implement drain_filter )
 - #70081 (add `unused_braces` lint)
 - #70556 (parse_and_disallow_postfix_after_cast: account for `ExprKind::Err`.)
 - #70605 (Add missing -lmsvcrt on mingw after -lpthread)
 - #70630 (Update books.)
 - #70632 (expand vec![] to Vec::new())

Failed merges:

r? @ghost

4 years agoRollup merge of #70632 - tspiteri:vec-new, r=sfackler
Dylan DPC [Tue, 31 Mar 2020 22:27:26 +0000 (00:27 +0200)]
Rollup merge of #70632 - tspiteri:vec-new, r=sfackler

expand vec![] to Vec::new()

The current expansion of `vec![]` calls `into_vec` on a boxed slice, which results in longer IR, and even after optimization, some unwinding artifacts are still present in the IR. This PR uses `Vec::new()` for `vec![]`.

This also allows `vec![]` to be used in const expressions.

4 years agoRollup merge of #70630 - ehuss:update-books, r=ehuss
Dylan DPC [Tue, 31 Mar 2020 22:27:25 +0000 (00:27 +0200)]
Rollup merge of #70630 - ehuss:update-books, r=ehuss

Update books.

## reference

2 commits in e2f11fe4d6a5ecb471c70323197da43c70cb96b6..89dd146154474559536d5d4049a03831c501deea
2020-03-10 06:59:24 +0100 to 2020-03-31 09:42:10 -0700
- Clarify rule for end-of-line backslashes in strings (rust-lang-nursery/reference#784)
- Fix and clarify section on re-export (rust-lang-nursery/reference#780)

## book

1 commits in 6fb3705e5230311b096d47f7e2c91f9ce24393d0..c8841f2841a2d26124319ddadd1b6a245f9a1856
2020-02-12 13:48:57 -0500 to 2020-03-22 09:07:01 -0500
- Fix broken front_of_house.rs test on nightly. (rust-lang/book#2289)

## rust-by-example

7 commits in cb369ae95ca36b841960182d26f6d5d9b2e3cc18..edd2a7e687358712608896730c083cb76c7b401a
2020-03-14 12:13:22 -0500 to 2020-03-30 09:37:29 -0300
- feat: add doc attributes section to documentation (rust-lang/rust-by-example#1323)
- feat: add playpen topic (rust-lang/rust-by-example#1324)
- feat: add sentence about rustdoc & std library (rust-lang/rust-by-example#1322)
- fix: make spelling/style of rustdoc consistent (rust-lang/rust-by-example#1321)
- Rewrite section on 'static lifetime. (rust-lang/rust-by-example#1320)
- Remove deprecated `std::error::Error` functions and other minor changes (rust-lang/rust-by-example#1319)
- Remove mdbook version flags from README (rust-lang/rust-by-example#1318)

## nomicon

1 commits in 9f797e65e6bcc79419975b17aff8e21c9adc039f..411197b0e77590c967e37e8f6ec681abd359afe8
2020-03-04 03:45:13 +0100 to 2020-03-31 20:46:09 +0200
- Fix negative_impls feature. (rust-lang-nursery/nomicon#205)

4 years agoRollup merge of #70605 - Amanieu:pthread_msvcrt, r=varkor
Dylan DPC [Tue, 31 Mar 2020 22:27:23 +0000 (00:27 +0200)]
Rollup merge of #70605 - Amanieu:pthread_msvcrt, r=varkor

Add missing -lmsvcrt on mingw after -lpthread

Fixes #70316

4 years agoRollup merge of #70556 - Centril:fix-70552, r=estebank
Dylan DPC [Tue, 31 Mar 2020 22:27:22 +0000 (00:27 +0200)]
Rollup merge of #70556 - Centril:fix-70552, r=estebank

parse_and_disallow_postfix_after_cast: account for `ExprKind::Err`.

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

r? @estebank
cc @daboross

4 years agoRollup merge of #70081 - lcnr:issue68387, r=varkor
Dylan DPC [Tue, 31 Mar 2020 22:27:20 +0000 (00:27 +0200)]
Rollup merge of #70081 - lcnr:issue68387, r=varkor

add `unused_braces` lint

Add the lint `unused_braces` which is warn by default.

`unused_parens` is also extended and now checks anon consts.

closes #68387

r? @varkor

4 years agoRollup merge of #68770 - ssomers:btree_drain_filter, r=Amanieu
Dylan DPC [Tue, 31 Mar 2020 22:27:18 +0000 (00:27 +0200)]
Rollup merge of #68770 - ssomers:btree_drain_filter, r=Amanieu

BTreeMap/BTreeSet: implement drain_filter

Provide an implementation of drain_filter for BTreeMap and BTreeSet. Should be optimal when the predicate picks only elements in leaf nodes with at least MIN_LEN remaining elements, which is a common case, at least when draining only a fraction of the map/set, and also when the predicate picks elements stored in internal nodes where the right subtree can easily let go of a replacement element.

The first commit adds benchmarks with an external, naive implementation. to compare how much this claimed optimality-in-some-cases is actually worth.

4 years agoUse Place directly in apply_call_return_effect on framework/tests, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 21:49:21 +0000 (18:49 -0300)]
Use Place directly in apply_call_return_effect on framework/tests, it's Copy

4 years agoUse Place directly in codegen_place_to_pointer, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:39:18 +0000 (14:39 -0300)]
Use Place directly in codegen_place_to_pointer, it's Copy

4 years agoUse Place directly in evaluate_array_len, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:37:10 +0000 (14:37 -0300)]
Use Place directly in evaluate_array_len, it's Copy

4 years agoUse Place directly in codegen_transmute, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:35:01 +0000 (14:35 -0300)]
Use Place directly in codegen_transmute, it's Copy

4 years agoUse Place directly on make_return_dest, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:31:34 +0000 (14:31 -0300)]
Use Place directly on make_return_dest, it's Copy

4 years agoUse Place directly on codegen_drop_terminator, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:27:48 +0000 (14:27 -0300)]
Use Place directly on codegen_drop_terminator, it's Copy

4 years agoUse Place directly in peek_at, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:26:15 +0000 (14:26 -0300)]
Use Place directly in peek_at, it's Copy

4 years agoUse Place directly on place_contents_drop_state_cannot_differ, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:20:42 +0000 (14:20 -0300)]
Use Place directly on place_contents_drop_state_cannot_differ, it's Copy

4 years agoUse Place directly in place_as_reborrow, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:16:54 +0000 (14:16 -0300)]
Use Place directly in place_as_reborrow, it's Copy

4 years agoUse Place directly in librustc_mir_build, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 17:08:48 +0000 (14:08 -0300)]
Use Place directly in librustc_mir_build, it's Copy

4 years agoexpand vec![] to Vec::new()
Trevor Spiteri [Tue, 31 Mar 2020 19:37:13 +0000 (21:37 +0200)]
expand vec![] to Vec::new()

4 years agoUpdate cargo
Eric Huss [Tue, 31 Mar 2020 19:15:13 +0000 (12:15 -0700)]
Update cargo

4 years agoAuto merge of #70625 - Dylan-DPC:rollup-o8n2hw8, r=Dylan-DPC
bors [Tue, 31 Mar 2020 19:12:14 +0000 (19:12 +0000)]
Auto merge of #70625 - Dylan-DPC:rollup-o8n2hw8, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #69425 (add fn make_contiguous to VecDeque)
 - #69458 (improve folder name for persistent doc tests)
 - #70268 (Document ThreadSanitizer in unstable-book)
 - #70600 (Ensure there are versions of test code for aarch64 windows)
 - #70606 (Clean up E0466 explanation)
 - #70614 (remove unnecessary relocation check in const_prop)
 - #70623 (Fix broken link in README)

Failed merges:

r? @ghost

4 years agoUpdate books.
Eric Huss [Tue, 31 Mar 2020 18:41:31 +0000 (11:41 -0700)]
Update books.

4 years agoci: disable cancel-outdated-builds for the try branch
Pietro Albini [Tue, 31 Mar 2020 17:46:05 +0000 (19:46 +0200)]
ci: disable cancel-outdated-builds for the try branch

While for auto, try and PR builds we only want the latest commit to be
tested, that's not true for try builds: each commit pushed to the branch
is a different PR being tested, and we want multiple PRs to be tested in
parallel if there is enough demand.

Fixes #70569

4 years agoUse Place directly on Operand::place and friends, it's Copy
Santiago Pastorino [Tue, 31 Mar 2020 16:54:20 +0000 (13:54 -0300)]
Use Place directly on Operand::place and friends, it's Copy

4 years agoUse Place directly, it's Copy even more use cases
Santiago Pastorino [Tue, 31 Mar 2020 15:19:29 +0000 (12:19 -0300)]
Use Place directly, it's Copy even more use cases

4 years agoUse Place directly, it's Copy more use cases
Santiago Pastorino [Mon, 30 Mar 2020 23:25:43 +0000 (20:25 -0300)]
Use Place directly, it's Copy more use cases

4 years agoUse Place directly on check_mut_borrowing_layout_constrained_field, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 22:22:12 +0000 (19:22 -0300)]
Use Place directly on check_mut_borrowing_layout_constrained_field, it's Copy

4 years agoUse Place directly on remove_never_initialized_mut_locals, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 22:18:54 +0000 (19:18 -0300)]
Use Place directly on remove_never_initialized_mut_locals, it's Copy

4 years agoUse Place directly on borrow_of_local_data, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 21:51:48 +0000 (18:51 -0300)]
Use Place directly on borrow_of_local_data, it's Copy

4 years agoUse Place directly on propagate_closure_used_mut_place, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 20:55:22 +0000 (17:55 -0300)]
Use Place directly on propagate_closure_used_mut_place, it's Copy

4 years agoUse Place directly, it's Copy
Santiago Pastorino [Mon, 30 Mar 2020 20:49:33 +0000 (17:49 -0300)]
Use Place directly, it's Copy

4 years agoRollup merge of #70623 - rcoh:patch-2, r=jonas-schievink
Dylan DPC [Tue, 31 Mar 2020 17:29:36 +0000 (19:29 +0200)]
Rollup merge of #70623 - rcoh:patch-2, r=jonas-schievink

Fix broken link in README

Crate name for rustc entry point docs changed. Fixes #70603

4 years agoRollup merge of #70614 - RalfJung:cons-prop-reloc, r=wesleywiser
Dylan DPC [Tue, 31 Mar 2020 17:29:35 +0000 (19:29 +0200)]
Rollup merge of #70614 - RalfJung:cons-prop-reloc, r=wesleywiser

remove unnecessary relocation check in const_prop

Unnecessary as per https://github.com/rust-lang/rust/issues/70356#issuecomment-606615292

Fixes https://github.com/rust-lang/rust/issues/70356
r? @oli-obk Cc @wesleywiser

4 years agoRollup merge of #70606 - GuillaumeGomez:cleanup-e0466, r=Dylan-DPC
Dylan DPC [Tue, 31 Mar 2020 17:29:33 +0000 (19:29 +0200)]
Rollup merge of #70606 - GuillaumeGomez:cleanup-e0466, r=Dylan-DPC

Clean up E0466 explanation

r? @Dylan-DPC

4 years agoRollup merge of #70600 - danielframpton:aarch64-windows-tests, r=alexcrichton
Dylan DPC [Tue, 31 Mar 2020 17:29:31 +0000 (19:29 +0200)]
Rollup merge of #70600 - danielframpton:aarch64-windows-tests, r=alexcrichton

Ensure there are versions of test code for aarch64 windows

Remove the `cfg` flags that were preventing some tests from running on `aarch64-pc-windows-msvc`.

All the existing `target_os = windows` targets had the same `align()` and `size()` values, so this change just removes the `target_arch` flags.

r? @alexcrichton

4 years agoRollup merge of #70268 - tmiasko:sanitizer-docs, r=steveklabnik
Dylan DPC [Tue, 31 Mar 2020 17:29:29 +0000 (19:29 +0200)]
Rollup merge of #70268 - tmiasko:sanitizer-docs, r=steveklabnik

Document ThreadSanitizer in unstable-book

4 years agoRollup merge of #69458 - Luro02:master, r=GuillaumeGomez,ollie27
Dylan DPC [Tue, 31 Mar 2020 17:29:28 +0000 (19:29 +0200)]
Rollup merge of #69458 - Luro02:master, r=GuillaumeGomez,ollie27

improve folder name for persistent doc tests

This fixes #69411, by using the entire path as folder name and storing already visited paths in a HashMap + appending a number to the file name for duplicates.

4 years agoRollup merge of #69425 - lcnr:make_contiguous, r=Amanieu
Dylan DPC [Tue, 31 Mar 2020 17:29:26 +0000 (19:29 +0200)]
Rollup merge of #69425 - lcnr:make_contiguous, r=Amanieu

add fn make_contiguous to VecDeque

Adds the following method to VecDeque:

```rust
pub fn make_contiguous(&mut self) -> &mut [T];
```

Taken from https://github.com/rust-lang/rust/pull/69400, after a suggestion by @CryZe https://github.com/rust-lang/rust/pull/69400#issuecomment-590216089

I am in favor of merging this instead of https://github.com/rust-lang/rust/pull/69400.

4 years agocargotest: remove webrender
Pietro Albini [Tue, 31 Mar 2020 17:28:06 +0000 (19:28 +0200)]
cargotest: remove webrender

The current webrender commit occasionally fails without a reason, and
the latest webrender commit is missing a dependency on our Windows
builders. It's not worth installing an extra dependency for cargotest,
and the spurious failure makes keeping this test not worth it.

4 years agoupdate unused_braces wording
Bastian Kauschke [Tue, 31 Mar 2020 16:42:54 +0000 (18:42 +0200)]
update unused_braces wording

4 years agoadd tests for `unused_braces`
Bastian Kauschke [Fri, 27 Mar 2020 20:56:58 +0000 (21:56 +0100)]
add tests for `unused_braces`

4 years agoupdate tests
Bastian Kauschke [Fri, 27 Mar 2020 20:56:19 +0000 (21:56 +0100)]
update tests

4 years agofix internal lint fallout
Bastian Kauschke [Fri, 27 Mar 2020 20:55:15 +0000 (21:55 +0100)]
fix internal lint fallout

4 years agoFix broken link in README
Russell Cohen [Tue, 31 Mar 2020 16:57:31 +0000 (12:57 -0400)]
Fix broken link in README

Crate name for rustc entry point docs changed. Fixes #70603

4 years agoconst backtrace: do not skip first frame
Ralf Jung [Tue, 31 Mar 2020 15:46:26 +0000 (17:46 +0200)]
const backtrace: do not skip first frame

4 years agoavoid an unreachable fallback
Ralf Jung [Tue, 31 Mar 2020 14:53:00 +0000 (16:53 +0200)]
avoid an unreachable fallback

4 years agofix docs
Bastian Kauschke [Tue, 31 Mar 2020 14:50:06 +0000 (16:50 +0200)]
fix docs

4 years agoFix tests to handle debug_assert
Russell Cohen [Tue, 31 Mar 2020 14:27:07 +0000 (10:27 -0400)]
Fix tests to handle debug_assert

4 years agoAuto merge of #70617 - Centril:rollup-063ycso, r=Centril
bors [Tue, 31 Mar 2020 14:00:55 +0000 (14:00 +0000)]
Auto merge of #70617 - Centril:rollup-063ycso, r=Centril

Rollup of 9 pull requests

Successful merges:

 - #69784 (Optimize strip_prefix and strip_suffix with str patterns)
 - #70548 (Add long error code for error E0226)
 - #70555 (resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery)
 - #70561 (remove obsolete comment)
 - #70562 (infer array len from pattern)
 - #70585 (std: Fix over-aligned allocations on wasm32-wasi)
 - #70587 (Add `Rust` to the code snippet)
 - #70588 (Fix incorrect documentation for `str::{split_at, split_at_mut}`)
 - #70613 (more clippy fixes)

Failed merges:

r? @ghost

4 years agoRollup merge of #70613 - matthiaskrgr:cl5ppy_squashed, r=Centril
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:52 +0000 (15:59 +0200)]
Rollup merge of #70613 - matthiaskrgr:cl5ppy_squashed, r=Centril

more clippy fixes

* use is_empty() instead of len comparison (clippy::len_zero)
* use if let instead of while let loop that never loops (clippy::never_loop)
* remove redundant returns (clippy::needless_return)
* remove redundant closures (clippy::redundant_closure)
* use if let instead of match and wildcard pattern (clippy::single_match)
* don't repeat field names redundantly (clippy::redundant_field_names)

r? @Centril

4 years agoRollup merge of #70588 - Coder-256:str-split-at-docs, r=Dylan-DPC
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:50 +0000 (15:59 +0200)]
Rollup merge of #70588 - Coder-256:str-split-at-docs, r=Dylan-DPC

Fix incorrect documentation for `str::{split_at, split_at_mut}`

The documentation for each method currently states:

> Panics if `mid` is not on a UTF-8 code point boundary, or if it is beyond the last code point of the string slice.

However, this is not consistent with the real behavior, or that of the corresponding methods for `[T]` slices. A comment inside each of the `str` methods states:

> is_char_boundary checks that the index is in [0, .len()]

That is what I would expect the behavior to be, and in fact this seems to be the real behavior. For example ([playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8e03dcc209d4dd176df2297523f9fee1)):

```rust
fn main() {
    // Prints ("abc", "") and doesn't panic
    println!("{:?}", "abc".split_at(3));
}
```

In this case, I would interpret "the last code point of the string slice" to mean the byte at index 2 in UTF-8. However, it is possible to pass an index of 3, which is definitely "beyond the last code point of the string slice".

I think that this is much clearer, but feel free to bikeshed.

4 years agoRollup merge of #70587 - DutchGhost:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:49 +0000 (15:59 +0200)]
Rollup merge of #70587 - DutchGhost:patch-1, r=Dylan-DPC

Add `Rust` to the code snippet

Adds `Rust` to the snippet where the code causing the ICE should be placed, so github can render it as Rust code rather than plain code.

4 years agoRollup merge of #70585 - alexcrichton:fix-wasi-align-alloc, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:47 +0000 (15:59 +0200)]
Rollup merge of #70585 - alexcrichton:fix-wasi-align-alloc, r=Mark-Simulacrum

std: Fix over-aligned allocations on wasm32-wasi

The wasm32-wasi target delegates its malloc implementation to the
functions in wasi-libc, but the invocation of `aligned_alloc` was
incorrect by passing the number of bytes requested first rather than the
alignment. This commit swaps the order of these two arguments to ensure
that we allocate over-aligned memory correctly.

4 years agoRollup merge of #70562 - lcnr:const-arr_len, r=Centril
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:46 +0000 (15:59 +0200)]
Rollup merge of #70562 - lcnr:const-arr_len, r=Centril

infer array len from pattern

closes #70529

This still errors in the following case

```rust
#![feature(const_generics)]
fn arr<const N: usize>() -> [u8; N] {
    todo!()
}

fn main() {
    match arr() {
        [5, ..] => (),
        //~^ ERROR cannot pattern-match on an array without a fixed length
        [_, _] => (),
    }
}
```
Considering that this should be rare and is harder to implement I would merge this PR without *fixing* the above.

4 years agoRollup merge of #70561 - tshepang:obsolete-comment, r=petrochenkov
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:44 +0000 (15:59 +0200)]
Rollup merge of #70561 - tshepang:obsolete-comment, r=petrochenkov

remove obsolete comment

Made obsolete by b5e35b128efeed4bfdb4b1ee9d0697389ec9f164

4 years agoRollup merge of #70555 - Centril:fix-70549, r=petrochenkov
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:43 +0000 (15:59 +0200)]
Rollup merge of #70555 - Centril:fix-70549, r=petrochenkov

resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes #70549

r? @petrochenkov

4 years agoRollup merge of #70548 - Ersikan:master, r=GuillaumeGomez
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:41 +0000 (15:59 +0200)]
Rollup merge of #70548 - Ersikan:master, r=GuillaumeGomez

Add long error code for error E0226

Added a long description message for error E0226, which previously did not exist.
As requested in issue #61137

r? @GuillaumeGomez

4 years agoRollup merge of #69784 - benesch:fast-strip-prefix-suffix, r=kennytm
Mazdak Farrokhzad [Tue, 31 Mar 2020 13:59:40 +0000 (15:59 +0200)]
Rollup merge of #69784 - benesch:fast-strip-prefix-suffix, r=kennytm

Optimize strip_prefix and strip_suffix with str patterns

As mentioned in https://github.com/rust-lang/rust/issues/67302#issuecomment-585639226.
I'm not sure whether adding these methods to `Pattern` is desirable—but they have default implementations so the change is backwards compatible. Plus it seems like they're slated for wholesale replacement soon anyway? #56345

----

Constructing a Searcher in strip_prefix and strip_suffix is
unnecessarily slow when the pattern is a fixed-length string. Add
strip_prefix and strip_suffix methods to the Pattern trait, and add
optimized implementations of these methods in the str implementation.
The old implementation is retained as the default for these methods.

4 years agorustc_target::abi: rename FieldPlacement to FieldsShape.
Ana-Maria Mihalache [Tue, 31 Mar 2020 13:44:52 +0000 (13:44 +0000)]
rustc_target::abi: rename FieldPlacement to FieldsShape.

4 years agoupdate `VecDeque::as_(mut)_slice` docs
Bastian Kauschke [Tue, 31 Mar 2020 13:39:56 +0000 (15:39 +0200)]
update `VecDeque::as_(mut)_slice` docs

4 years agoremove unnecessary relocation check in const_prop
Ralf Jung [Tue, 31 Mar 2020 13:25:12 +0000 (15:25 +0200)]
remove unnecessary relocation check in const_prop

4 years agomore clippy fixes
Matthias Krüger [Sun, 29 Mar 2020 18:19:14 +0000 (20:19 +0200)]
more clippy fixes

use is_empty() instead of len comparison (clippy::len_zero)
use if let instead of while let loop that never loops (clippy::never_loop)
remove redundant returns (clippy::needless_return)
remove redundant closures (clippy::redundant_closure)
use if let instead of match and wildcard pattern (clippy::single_match)
don't repeat field names redundantly (clippy::redundant_field_names)

4 years agoClean up E0466 explanation
Guillaume Gomez [Tue, 31 Mar 2020 11:55:58 +0000 (13:55 +0200)]
Clean up E0466 explanation