bors [Thu, 16 Jan 2020 07:20:52 +0000 (07:20 +0000)]
Auto merge of #68272 - Dylan-DPC:rollup-vrb90gu, r=Dylan-DPC
Rollup of 5 pull requests
Successful merges:
- #67780 (Move some queries from rustc::ty to librustc_ty.)
- #68096 (Clean up some diagnostics by making them more consistent)
- #68223 (Use 3.6 instead of 3.5 in float fract() documentation)
- #68265 (Fix some issue numbers of unstable features)
- #68266 (Changed docs for f32 and f64.)
Failed merges:
- #68204 (Use named fields for `{ast,hir}::ItemKind::Impl`)
Dylan DPC [Thu, 16 Jan 2020 06:28:04 +0000 (11:58 +0530)]
Rollup merge of #68223 - SOF3:float-fract-doc, r=varkor
Use 3.6 instead of 3.5 in float fract() documentation
It is not self-explanatory whether the fract() function inverts the fractional part of negative numbers. This change clarifies this possible question (so that it is `.6` not `.4`)
Dylan DPC [Thu, 16 Jan 2020 06:28:02 +0000 (11:58 +0530)]
Rollup merge of #68096 - varkor:diagnostic-cleanup, r=Centril
Clean up some diagnostics by making them more consistent
In general:
- Diagnostic should start with a lowercase letter.
- Diagnostics should not end with a full stop.
- Ellipses contain three dots.
- Backticks should encode Rust code.
I also reworded a couple of messages to make them read more clearly.
It might be sensible to create a style guide for diagnostics, so these informal conventions are written down somewhere, after which we could audit the existing diagnostics.
The current implementation of (`A`)`Rc::into_raw` uses the `Deref::deref` implementation to get the pointer-to-data that is returned. This is problematic in the proposed Stacked Borrow rules, as this only gets shared provenance over the data location. (Note that the strong/weak counts are `UnsafeCell` (`Cell`/`Atomic`) so shared provenance can still mutate them, but the data itself is not.) When promoted back to a real reference counted pointer, the restored pointer can be used for mutation through `::get_mut` (if it is the only surviving reference). However, this mutates through a pointer ultimately derived from a `&T` borrow, violating the Stacked Borrow rules.
There are three known potential solutions to this issue:
- Stacked Borrows is wrong, liballoc is correct.
- Fully admit (`A`)`Rc` as an "internal mutability" type and store the data payload in an `UnsafeCell` like the strong/weak counts are. (Note: this is not needed generally since the `RcBox`/`ArcInner` is stored behind a shared `NonNull` which maintains shared write provenance as a raw pointer.)
- Adjust `into_raw` to do direct manipulation of the pointer (like `from_raw`) so that it maintains write provenance and doesn't derive the pointer from a reference.
This PR implements the third option, as recommended by @RalfJung.
Potential future work: provide `as_raw` and `clone_raw` associated functions to allow the [`&T` -> (`A`)`Rc<T>` pattern](https://internals.rust-lang.org/t/rc-and-internal-mutability/11463/2?u=cad97) to be used soundly without creating (`A`)`Rc` from references.
Dylan DPC [Wed, 15 Jan 2020 17:19:28 +0000 (22:49 +0530)]
Rollup merge of #68236 - JohnTitor:ice-tests, r=Centril
Add some regression tests
Closes #64848 (fixed by #67631)
Closes #65918 (ICE is hidden by #67000, no longer ICE)
Closes #66473 (fixed by #68084)
Closes #67550 (set mir-opt-level to 3)
Dylan DPC [Wed, 15 Jan 2020 17:19:27 +0000 (22:49 +0530)]
Rollup merge of #68232 - Mark-Simulacrum:unicode-tables, r=joshtriplett
Optimize size/speed of Unicode datasets
The overall implementation has the same general idea as the prior approach,
which was based on a compressed trie structure, but modified to use less space
(and, coincidentally, be an overall performance improvement).
This table shows the size of the old and new tables in bytes. The most important
of these tables is "Grapheme_Extend", as it is present in essentially all Rust
programs due to being called from `str`'s Debug impl (`char::escape_debug`). In
a representative case given by this [blog post] for the embedded world, the
shrinking in this PR shrinks the final binary by 1,604 bytes, from 14,440 to
12,836.
The performance of these new tables, based on the (rough) benchmark of linearly
scanning the entire valid set of chars, querying for each `is_*`, is roughly
~50% better, though in some cases is either on par or slightly (3-5%) worse. In
practice, I believe the size benefits of this PR are the main concern. The new
implementation has been tested to be equivalent to the current nightly in terms
of returned values on the set of valid chars.
A (relatively) high-level explanation of the specific compression scheme used
can be found [in the generator].
This is split into three commits -- the first adds the generator which produces
the Rust code for the tables, the second adds support code for the lookup, and
the third actually swaps the current implementation out for the new one.
[blog post]: https://jamesmunns.com/blog/fmt-unreasonably-expensive/
[in the generator]: https://github.com/Mark-Simulacrum/rust/blob/unicode-tables/src/tools/unicode-table-generator/src/raw_emitter.rs
bors [Wed, 15 Jan 2020 16:28:06 +0000 (16:28 +0000)]
Auto merge of #67603 - oli-obk:no_mut_static_ref_from_const, r=RalfJung
Promoteds can contain raw pointers, but these must still only point to immutable allocations
fixes #67601
r? @RalfJung
cc @wesleywiser in order to not change behaviour in this PR, const prop uses the constant rules for interning, but at least there's an explicit mode for it now that we can think about this in the future
bors [Wed, 15 Jan 2020 13:00:43 +0000 (13:00 +0000)]
Auto merge of #68248 - JohnTitor:rollup-x0kml5f, r=JohnTitor
Rollup of 12 pull requests
Successful merges:
- #67784 (Reset Formatter flags on exit from pad_integral)
- #67914 (Don't run const propagation on items with inconsistent bounds)
- #68141 (use winapi for non-stdlib Windows bindings)
- #68211 (Add failing example for E0170 explanation)
- #68219 (Untangle ZST validation from integer validation and generalize it to all zsts)
- #68222 (Update the wasi-libc bundled with libstd)
- #68226 (Avoid calling tcx.hir().get() on CRATE_HIR_ID)
- #68227 (Update to a version of cmake with windows arm64 support)
- #68229 (Update iovec to a version with no winapi dependency)
- #68230 (Update libssh2-sys to a version that can build for aarch64-pc-windows…)
- #68231 (Better support for cross compilation on Windows.)
- #68233 (Update compiler_builtins with changes to fix 128 bit integer remainder for aarch64 windows.)
Yuki Okushi [Wed, 15 Jan 2020 12:51:59 +0000 (21:51 +0900)]
Rollup merge of #68233 - danielframpton:update-compiler-builtins, r=alexcrichton
Update compiler_builtins with changes to fix 128 bit integer remainder for aarch64 windows.
I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
Yuki Okushi [Wed, 15 Jan 2020 12:51:58 +0000 (21:51 +0900)]
Rollup merge of #68231 - danielframpton:windows-crosscompile, r=alexcrichton
Better support for cross compilation on Windows.
I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
Without the libpath changes we were trying to link a mix of amd64 and arm64 binaries.
Without the cmake system name change, the llvm build was trying to run an arm64 build tool on the x86_64 build machine.
That said, I haven't tested all different combinations here and am very open to resolving this a different way.
Yuki Okushi [Wed, 15 Jan 2020 12:51:57 +0000 (21:51 +0900)]
Rollup merge of #68230 - danielframpton:update-libssh2-sys, r=alexcrichton
Update libssh2-sys to a version that can build for aarch64-pc-windows…
I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
Yuki Okushi [Wed, 15 Jan 2020 12:51:55 +0000 (21:51 +0900)]
Rollup merge of #68229 - danielframpton:update-iovec, r=alexcrichton
Update iovec to a version with no winapi dependency
I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
Yuki Okushi [Wed, 15 Jan 2020 12:51:54 +0000 (21:51 +0900)]
Rollup merge of #68227 - danielframpton:update-cmake, r=alexcrichton
Update to a version of cmake with windows arm64 support
I have been investigating enabling panic=unwind for aarch64-pc-windows-msvc (see #65313) and building rustc and cargo hosted on aarch64-pc-windows-msvc.
Yuki Okushi [Wed, 15 Jan 2020 12:51:43 +0000 (21:51 +0900)]
Rollup merge of #67914 - Aaron1011:fix/const-prop-impossible, r=matthewjasper,oli-obk
Don't run const propagation on items with inconsistent bounds
Fixes #67696
Using `#![feature(trivial_bounds)]`, it's possible to write functions
with unsatisfiable 'where' clauses, making them uncallable. However, the
user can act as if these 'where' clauses are true inside the body of the
function, leading to code that would normally be impossible to write.
Since const propgation can run even without any user-written calls to a
function, we need to explcitly check for these uncallable functions.
Yuki Okushi [Wed, 15 Jan 2020 12:51:42 +0000 (21:51 +0900)]
Rollup merge of #67784 - Mark-Simulacrum:residual-pad-integral, r=dtolnay
Reset Formatter flags on exit from pad_integral
This fixes a bug where after calling pad_integral with appropriate flags, the
fill and alignment flags would be set to '0' and 'Right' and left as such even
after exiting pad_integral, which meant that future calls on the same Formatter
would get incorrect flags reported.
This is quite difficult to observe in practice, as almost all formatting
implementations in practice don't call `Display::fmt` directly, but rather use
`write!` or a similar macro, which means that they cannot observe the effects of
the wrong flags (as `write!` creates a fresh Formatter instance). However, we
include a test case.
A manual check leads me to believe this is the only case where we failed to reset the flags appropriately, but I could have missed something.
bors [Wed, 15 Jan 2020 09:34:49 +0000 (09:34 +0000)]
Auto merge of #68221 - ehuss:update-cargo-rls, r=alexcrichton
Update cargo rls
## cargo
12 commits in 6e1ca924a67dd1ac89c33f294ef26b5c43b89168..ad3dbe10e1e654fb1f032a5dd9481d7cbaa00d65
2020-01-06 19:11:37 +0000 to 2020-01-13 21:37:15 +0000
- Add named config profiles. (rust-lang/cargo#7750)
- Make cargo-rustc crate-type-aware (rust-lang/cargo#7755)
- Rename `Kind` (rust-lang/cargo#7791)
- Update bash completion (rust-lang/cargo#7789)
- Add another curl spurious network error (rust-lang/cargo#7788)
- Some small tweaks around error in configuration (rust-lang/cargo#7783)
- Fix tests with `url` crate update (rust-lang/cargo#7787)
- Fix .gitignore of Cargo.lock in a subdirectory. (rust-lang/cargo#7779)
- Bump crates-io (rust-lang/cargo#7778)
- Migrate from the `failure` crate to `anyhow` (rust-lang/cargo#7776)
- Fix several needless_borrow clippy lints. (rust-lang/cargo#7771)
- Fix some links (rust-lang/cargo#7770)
bors [Wed, 15 Jan 2020 05:01:10 +0000 (05:01 +0000)]
Auto merge of #66329 - ktrianta:mir-opt-unreachable-propagation, r=oli-obk
Add unreachable propagation mir optimization pass
@oli-obk suggested we create a MIR pass that optimizes away basic blocks that lead only to basic blocks with terminator kind **unreachable**. This is a first take on this, which we started with @gilescope at RustFest Impl Days.
The test currently fails when the compiled program runs (undefined behaviour). Is there a way to avoid running the compiled program?
bors [Wed, 15 Jan 2020 00:56:53 +0000 (00:56 +0000)]
Auto merge of #68118 - skinny121:eager_lit_eval, r=varkor
perf: Eagerly convert literals to consts
Previousely even literal constants were being converted to an `Unevaluted` constant for evaluation later. This seems unecessary as no more information is needed to be able to convert the literal to a mir constant.
Hopefully this will also minimise the performance impact of #67717, as far less constant evaluations are needed.
bors [Tue, 14 Jan 2020 15:29:43 +0000 (15:29 +0000)]
Auto merge of #67711 - Amanieu:fix_unwind_leak, r=alexcrichton
Fix memory leak if C++ catches a Rust panic and discards it
If C++ catches a Rust panic using `catch (...)` and then chooses not to rethrow it, the `Box<dyn Any>` in the exception may be leaked. This PR fixes this by adding the necessary destructors to the exception object.
Yuki Okushi [Tue, 14 Jan 2020 05:02:24 +0000 (14:02 +0900)]
Rollup merge of #68150 - tillarnold:master, r=cramertj
Document behavior of set_nonblocking on UnixListener
The description on `set_nonblocking` in `UnixListener` was rather brief so I adapted it to be more like the documentation of `set_nonblocking` in `TcpListener`.
Yuki Okushi [Tue, 14 Jan 2020 05:02:21 +0000 (14:02 +0900)]
Rollup merge of #68127 - varkor:clarify-extended-option, r=alexcrichton
Clarify the relationship between `extended` and `tools` in `config.toml`
I.e. `tools` is only effective if `extended = true`. Alternatively, we could make `tools = []` by default and remove `extended` (although we'd want to list the possible options), but improving the description seems sufficient to solve the issue.
Yuki Okushi [Tue, 14 Jan 2020 05:02:20 +0000 (14:02 +0900)]
Rollup merge of #68036 - euclio:libterm-ncurses6-fix, r=KodrAus
libterm: parse extended terminfo format
Fixes #45728.
Modifies libterm to parse the extended terminfo format introduced in ncurses 6.1. This fixes the lack of color in test output for users with newer ncurses versions.
The ideal fix for this would be to migrate libtest to use `termcolor` (https://github.com/rust-lang/rust/issues/60349), but that's blocked for the foreseeable future.
Ben Lewis [Sat, 11 Jan 2020 02:22:36 +0000 (15:22 +1300)]
perf: eagerly convert literals to consts, this avoids creating loads on unevaluated consts
which requires a lot of unnecessary work to evaluate them further down the line.
bors [Mon, 13 Jan 2020 17:39:01 +0000 (17:39 +0000)]
Auto merge of #68088 - oli-obk:fix_miri, r=RalfJung
Don't try to force_ptr pointers to zsts
r? @RalfJung
cc @wesleywiser
This is required to fix miri after https://github.com/rust-lang/rust/pull/67501 broke it. The reason only miri sees this is that it uses validation on values during interpretation and not just on the final value of constants, which never contain such values.