Commit Graph

109519 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
c00a21c2e3
Rollup merge of #70694 - lzutao:self, r=Centril
Use Self over specific type in return position
2020-04-03 00:32:04 +02:00
Mazdak Farrokhzad
e07f57c51c
Rollup merge of #70691 - TimDiekmann:allocref-docs, r=RalfJung
Improve docs in `AllocRef`

r? @RalfJung
2020-04-03 00:32:03 +02:00
Mazdak Farrokhzad
4cba69e585
Rollup merge of #70595 - wesleywiser:remove_unused_discriminant_reads, r=oli-obk
Remove unused discriminant reads from MIR bodies

Allow the `SimplifyLocals` pass to remove reads of discriminants if the
read is never used.

Fixes #70531

r? @oli-obk
2020-04-03 00:32:01 +02:00
Mazdak Farrokhzad
1eabbd024c
Rollup merge of #70487 - Mark-Simulacrum:float-unchecked-casts, r=SimonSapin
Stabilize float::to_int_unchecked

This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts. As such, I believe this also likely unblocks #10184 (our oldest I-unsound issue!), as once this rolls out to stable it would be far easier IMO to change the behavior of `as` to be safe by default.

This does not stabilize the trait or the associated method, as they are deemed internal implementation details (and consumers should not, generally, want to expose them, as in practice all callers likely know statically/without generics what the return type is).

Closes #67058
2020-04-03 00:32:00 +02:00
bors
537ccdf3ac Auto merge of #70692 - Centril:rollup-d0t4ecx, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #70281 (Implement Hash for Infallible)
 - #70421 (parse: recover on `const fn()` / `async fn()`)
 - #70615 (Renamed `PerDefTables` to `Tables`)
 - #70631 (Update cargo)
 - #70634 (Remove some reexports in `rustc_middle`)
 - #70658 (add `STILL_FURTHER_SPECIALIZABLE` flag)
 - #70678 (Add missing markdown rust annotation)
 - #70681 (Handle unterminated raw strings with no #s properly)

Failed merges:

r? @ghost
2020-04-02 15:33:19 +00:00
Mazdak Farrokhzad
ec0da7222d
Rollup merge of #70681 - rcoh:russell/70677-raw-str-panic, r=petrochenkov
Handle unterminated raw strings with no #s properly

The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file.

Fixes #70677

r? @petrochenkov

cc @Centril
2020-04-02 14:28:03 +02:00
Mazdak Farrokhzad
c10f214ddc
Rollup merge of #70678 - lzutao:patch-1, r=Dylan-DPC
Add missing markdown rust annotation
2020-04-02 14:28:01 +02:00
Mazdak Farrokhzad
857942eed0
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
2020-04-02 14:28:00 +02:00
Mazdak Farrokhzad
791e872c53
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.
2020-04-02 14:27:58 +02:00
Mazdak Farrokhzad
eefa78ebf0
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)
2020-04-02 14:27:57 +02:00
Mazdak Farrokhzad
f3559973cb
Rollup merge of #70615 - Lezzz:rename-tables, r=oli-obk
Renamed `PerDefTables` to `Tables`

Originally suggested by @eddyb
2020-04-02 14:27:55 +02:00
Mazdak Farrokhzad
03591e8a78
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
2020-04-02 14:27:54 +02:00
Mazdak Farrokhzad
cb81b41c9a
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).
2020-04-02 14:27:52 +02:00
Tim Diekmann
0b61239936 Improve docs in AllocRef 2020-04-02 14:20:35 +02:00
Wesley Wiser
75e2e8c71b Remove unused discriminant reads from MIR bodies
Allow the `SimplifyLocals` pass to remove reads of discriminants if the
read is never used.
2020-04-02 08:14:34 -04:00
Mazdak Farrokhzad
0826009638 fix fulldeps test fallout 2020-04-02 13:40:43 +02:00
Mazdak Farrokhzad
4dfec59eda nix CachingSourceMapView reexport 2020-04-02 13:40:43 +02:00
Mazdak Farrokhzad
6daff1400a direct imports for langitem stuff 2020-04-02 13:40:43 +02:00
Mazdak Farrokhzad
86c0fca44b use direct import for ErrorReported 2020-04-02 13:40:43 +02:00
Mazdak Farrokhzad
124144704f nix rustc_target::abi::* reexport in ty::layout 2020-04-02 13:40:43 +02:00
David Wood
c665eaeeb0
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>
2020-04-02 10:50:08 +01:00
bors
0f72ce1b27 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
2020-04-02 09:10:06 +00:00
bors
127a11a344 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
2020-04-02 06:08:35 +00:00
Russell Cohen
f543689eb6 Handle unterminated raw strings with no #s properly
The modified code to handle parsing raw strings didn't properly account for the case where there was no "#" on either end and erroneously reported this strings as complete. This lead to a panic trying to read off the end of the file.
2020-04-02 01:02:55 -04:00
Lzu Tao
f87afec2ce Use Self over specific type in return position 2020-04-02 03:55:35 +00:00
bors
b793f403bd Auto merge of #70667 - flip1995:clippyup, r=Manishearth
Update Clippy

r? @Manishearth

Closes #70663
2020-04-02 03:16:46 +00:00
lzutao
4b66a28bb6
Add missing markdown rust annotation 2020-04-02 08:34:57 +07:00
bors
76b11980ad 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
2020-04-01 20:30:35 +00:00
Dylan DPC
7d4d450da9
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
2020-04-01 22:25:23 +02:00
Dylan DPC
37b2e3fe56
Rollup merge of #70649 - GuillaumeGomez:cleanup-e0468, r=Dylan-DPC
clean up E0468 explanation

r? @Dylan-DPC
2020-04-01 22:25:22 +02:00
Dylan DPC
0863e2ce01
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
2020-04-01 22:25:20 +02:00
Dylan DPC
1b40067ffc
Rollup merge of #70616 - anyska:fieldplacement-rename, r=oli-obk
rustc_target::abi: rename FieldPlacement to FieldsShape.

Originally suggested by @eddyb.
2020-04-01 22:25:18 +02:00
Dylan DPC
b919df21a9
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
2020-04-01 22:25:16 +02:00
Dylan DPC
0e0d84c13c
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
2020-04-01 22:25:15 +02:00
flip1995
93aa7142e3
Update Clippy 2020-04-01 21:06:06 +02:00
Eduard-Mihai Burtescu
f181778538 compiletest: don't use std::io::stdout(), as it bypasses set_print. 2020-04-01 19:40:09 +03:00
bors
235938d1ac 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
2020-04-01 14:21:31 +00:00
Mazdak Farrokhzad
c1419b4c91
Rollup merge of #70652 - lzutao:patch-1, r=Centril
Add git repo address to unstable book
2020-04-01 14:32:21 +02:00
Mazdak Farrokhzad
9223bb5f32
Rollup merge of #70627 - spastorino:use-place-directly-its-copy, r=oli-obk
Use place directly its copy

r? @oli-obk
2020-04-01 14:32:19 +02:00
Mazdak Farrokhzad
43119deac1
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.
2020-04-01 14:32:17 +02:00
Mazdak Farrokhzad
90cecab42b
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
2020-04-01 14:32:16 +02:00
Mazdak Farrokhzad
c739465b1b
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
2020-04-01 14:32:14 +02:00
Mazdak Farrokhzad
84a4633880
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.
2020-04-01 14:32:12 +02:00
lzutao
e39f542c55
Add git repo address to unstable book 2020-04-01 19:10:19 +07:00
Guillaume Gomez
3bcb3ef8d3 clean up E0468 explanation 2020-04-01 13:18:14 +02:00
Tim Diekmann
89ed59d884
Add missing allocation guard in RawVec::grow 2020-04-01 10:26:30 +02:00
bors
99009bf319 Auto merge of #70571 - RalfJung:miri, r=RalfJung
bump Miri

r? @ghost Cc @oli-obk

Fixes https://github.com/rust-lang/rust/issues/70521
2020-04-01 07:52:39 +00:00
bors
1a87c49e33 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.
2020-04-01 03:56:44 +00:00
Wesley Wiser
036626f249 Address review feedback 2020-03-31 21:02:51 -04:00
Valentin Lazureanu
dca3782c18 Renamed PerDefTables to Tables 2020-03-31 23:19:50 +00:00