Commit Graph

120299 Commits

Author SHA1 Message Date
bors
42acd9086f Auto merge of #72346 - Dylan-DPC:rollup-vp418xs, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71886 (Stabilize saturating_abs and saturating_neg)
 - #72066 (correctly handle uninferred consts)
 - #72068 (Ignore arguments when looking for `IndexMut` for subsequent `mut` obligation)
 - #72338 (Fix ICE in -Zsave-analysis)
 - #72344 (Assert doc wording)

Failed merges:

r? @ghost
2020-05-19 11:54:40 +00:00
Dylan DPC
745ca2afae
Rollup merge of #72344 - kornelski:assertdoc, r=Mark-Simulacrum
Assert doc wording

The current wording implies unsafe code is dependent on assert:

https://users.rust-lang.org/t/are-assert-statements-included-in-unsafe-blocks/42865
2020-05-19 13:53:47 +02:00
Dylan DPC
817880842c
Rollup merge of #72338 - doctorn:trait-object-ice, r=ecstatic-morse
Fix ICE in -Zsave-analysis

Puts a short-circuit in to avoid an ICE in `-Zsave-analysis`.

r? @ecstatic-morse

Resolves #72267
2020-05-19 13:53:45 +02:00
Dylan DPC
79ac73a3fc
Rollup merge of #72068 - estebank:mut-deref-hack, r=oli-obk
Ignore arguments when looking for `IndexMut` for subsequent `mut` obligation

Given code like `v[&field].boo();` where `field: String` and
`.boo(&mut self)`, typeck will have decided that `v` is accessed using
`Index`, but when `boo` adds a new `mut` obligation,
`convert_place_op_to_mutable` is called. When this happens, for *some
reason* the arguments' dereference adjustments are completely ignored
causing an error saying that `IndexMut` is not satisfied:

```
error[E0596]: cannot borrow data in an index of `Indexable` as mutable
  --> src/main.rs:30:5
   |
30 |     v[&field].boo();
   |     ^^^^^^^^^ cannot borrow as mutable
   |
   = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Indexable`
```

This is not true, but by changing `try_overloaded_place_op` to retry
when given `Needs::MutPlace` without passing the argument types, the
example successfully compiles.

I believe there might be more appropriate ways to deal with this.

Fix #72002.
2020-05-19 13:53:43 +02:00
Dylan DPC
12040cf665
Rollup merge of #72066 - lcnr:const-type-info-err, r=varkor
correctly handle uninferred consts

fixes the ICE mentioned in https://github.com/rust-lang/rust/issues/70507#issuecomment-615268893

I originally tried to generalize `need_type_info_err` to also work with consts which was not as much fun as I hoped 😅

It might be easier to have some duplication here and handle consts separately.

r? @varkor
2020-05-19 13:53:41 +02:00
Dylan DPC
4c48f5ab69
Rollup merge of #71886 - t-rapp:tr-saturating-funcs, r=dtolnay
Stabilize saturating_abs and saturating_neg

Stabilizes the following signed integer functions with saturation mechanics:
 * saturating_abs()
 * saturating_neg()

Closes #59983
2020-05-19 13:53:36 +02:00
Kornel
5b65c0f9a5 Assert doc wording 2020-05-19 11:22:03 +01:00
bors
914adf04af Auto merge of #71447 - cuviper:unsized_cow, r=dtolnay
impl From<Cow> for Box, Rc, and Arc

These forward `Borrowed`/`Owned` values to existing `From` impls.

- `Box<T>` is a fundamental type, so it would be a breaking change to add a blanket impl. Therefore, `From<Cow>` is only implemented for `[T]`, `str`, `CStr`, `OsStr`, and `Path`.
- For `Rc<T>` and `Arc<T>`, `From<Cow>` is implemented for everything that implements `From` the borrowed and owned types separately.
2020-05-19 08:08:48 +00:00
bors
5943351d0e Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
Stabilize fn-like proc macros in expression, pattern and statement positions

I.e. all the positions in which stable `macro_rules` macros are supported.

Depends on https://github.com/rust-lang/rust/pull/68716 ("Stabilize `Span::mixed_site`").

cc https://github.com/rust-lang/rust/issues/54727
cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446

Stabilization report: https://github.com/rust-lang/rust/pull/68717#issuecomment-623197503.
2020-05-19 03:11:32 +00:00
bors
89988fe727 Auto merge of #72330 - Dylan-DPC:rollup-yuxadv8, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71599 (Support coercion between (FnDef | Closure) and (FnDef | Closure))
 - #71973 (Lazy normalization of constants (Reprise))
 - #72283 (Drop Elaboration Elaboration)
 - #72290 (Add newer rust versions to linker-plugin-lto.md)
 - #72318 (Add help text for remote-test-client)

Failed merges:

r? @ghost
2020-05-18 22:50:40 +00:00
Nathan Corbyn
ef3f2c0a7c Fix ICE in -Zsave-analysis 2020-05-18 22:55:04 +01:00
bors
d8878868c8 Auto merge of #72332 - mati865:ci-fix, r=pietroalbini
CI: Workaround MSYS2 issue
2020-05-18 18:40:07 +00:00
Mateusz Mikuła
081daf609c Update pacman first 2020-05-18 20:38:59 +02:00
Bastian Kauschke
5da74304d5 correctly handle uninferred consts 2020-05-18 20:36:18 +02:00
Dylan DPC
256ce18dcb
Rollup merge of #72318 - tblah:remote-test-client-doc, r=nikomatsakis
Add help text for remote-test-client

Add help text describing the usage of remote-test-client
2020-05-18 19:04:08 +02:00
Dylan DPC
0b63bc7b51
Rollup merge of #72290 - elichai:2020-doc-lto, r=wesleywiser
Add newer rust versions to linker-plugin-lto.md

Hi,
This doc got a bit out of date,
it's hosted here: https://doc.rust-lang.org/rustc/linker-plugin-lto.html
you can check the versions I've added via:
```bash
$ rustup install 1.38.0
$ rustc +1.38.0 -vV
rustc 1.38.0 (625451e37 2019-09-23)
binary: rustc
commit-hash: 625451e376bb2e5283fc4741caa0a3e8a2ca4d54
commit-date: 2019-09-23
host: x86_64-unknown-linux-gnu
release: 1.38.0
LLVM version: 9.0

$ rustup install 1.43.1
$ rustc +1.43.1 -vV
rustc 1.43.1 (8d69840ab 2020-05-04)
binary: rustc
commit-hash: 8d69840ab92ea7f4d323420088dd8c9775f180cd
commit-date: 2020-05-04
host: x86_64-unknown-linux-gnu
release: 1.43.1
LLVM version: 9.0
```
2020-05-18 19:04:06 +02:00
Dylan DPC
4adb9a85c3
Rollup merge of #72283 - jonas-schievink:elaborate-drop-elaboration, r=cramertj
Drop Elaboration Elaboration

As in, adding more documentation to it.
2020-05-18 19:04:04 +02:00
Dylan DPC
c6030c957a
Rollup merge of #71973 - lcnr:lazy-norm, r=nikomatsakis
Lazy normalization of constants (Reprise)

Continuation of #67890 by @skinny121.

Initial implementation of #60471 for constants.

Perform normalization/evaluation of constants lazily, which is known as lazy normalization. Lazy normalization is only enabled when using `#![feature(lazy_normalization_consts)]`, by default constants are still evaluated eagerly as there are currently.

Lazy normalization of constants is achieved with a new ConstEquate predicate which type inferences uses to delay checking whether constants are equal to each other until later, avoiding cycle errors.

Note this doesn't allow the use of generics within repeat count expressions as that is still evaluated during conversion to mir. There are also quite a few other known problems with lazy normalization which will be fixed in future PRs.

r? @nikomatsakis

fixes #71922, fixes #71986
2020-05-18 19:04:03 +02:00
Dylan DPC
58e6447365
Rollup merge of #71599 - ldm0:fnclo, r=nikomatsakis
Support coercion between (FnDef | Closure) and (FnDef | Closure)

Fixes #46742, fixes #48109
Inject `Closure` into the `FnDef x FnDef` coercion special case, which makes coercion of `(FnDef | Closure) x (FnDef | Closure)` possible, where closures should be **non-capturing**.
2020-05-18 19:04:01 +02:00
Tom Eccles
5b9941ca47 Add remote-test-client help text 2020-05-18 12:33:18 +01:00
bors
9e2a6a29ce Auto merge of #72289 - RalfJung:abort_internal, r=Mark-Simulacrum
abort_internal is safe

`sys::abort_internal` is stably exposed as a safe function. Forward that assumption "inwards" to the `sys` module by making the function itself safe, too.

This corresponds to what https://github.com/rust-lang/rust/pull/72204 did for the intrinsic. We should probably wait until that lands because some of the intrinsic calls in this PR might then need adjustments.
2020-05-18 11:11:19 +00:00
bors
d4bf05693c Auto merge of #72316 - RalfJung:rollup-70g6bln, r=RalfJung
Rollup of 2 pull requests

Successful merges:

 - #72143 (make offset must_use)
 - #72307 (use the new interface to initialize conditional variables)

Failed merges:

r? @ghost
2020-05-18 07:53:03 +00:00
Ralf Jung
2cff5d961a
Rollup merge of #72307 - hermitcore:condvar, r=Mark-Simulacrum
use the new interface to initialize conditional variables

HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.
2020-05-18 08:48:45 +02:00
Ralf Jung
2a90664798
Rollup merge of #72143 - rust-lang:steveklabnik-must-use, r=sfackler
make offset must_use

https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.

This PR only adds `offset`, because I wanted to float the idea; I'm imagining that there's more than just `add` and `offset` that could use this. I am also very open to re-wording the warning.

r? @rust-lang/libs
2020-05-18 08:48:43 +02:00
bors
1baf85c7e0 Auto merge of #72300 - flip1995:clippyup, r=Mark-Simulacrum
Sync Clippy

cc rust-lang/rust-clippy#5608

Included changes:

- renames/merges of some lints
- ICE fix
- Downgrade useless_let_if_seq to nursery
- FP fixes
- formatting

r? @oli-obk
2020-05-18 04:10:01 +00:00
bors
35d86693ac Auto merge of #72269 - RalfJung:unsafe-borrow-of-packed, r=Mark-Simulacrum
move borrow-of-packed-field unsafety check out of loop

Looks like during the place refactoring, this code somehow got into this loop even though it does not actually depend on the loop variables.
2020-05-18 00:54:42 +00:00
Stefan Lankes
3f47d9d2e6 minor changes to pass the format check 2020-05-18 00:06:32 +02:00
Stefan Lankes
06d692febd use new interface to initialize Condvar
HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.
2020-05-17 23:49:18 +02:00
Ralf Jung
2764673dca abort_internal is safe 2020-05-17 23:38:31 +02:00
bors
5f472813df Auto merge of #72248 - petrochenkov:codemodel, r=Amanieu
Cleanup and document `-C code-model`

r? @Amanieu
2020-05-17 21:22:48 +00:00
bors
d79f1bd31a Auto merge of #72295 - RalfJung:rollup-icmhbs7, r=RalfJung
Rollup of 3 pull requests

Successful merges:

 - #72259 (Disallow forbidden usage of non-ascii identifiers.)
 - #72261 (Break out early on empty span when generate_fn_span)
 - #72291 (bootstrap: fix typo)

Failed merges:

r? @ghost
2020-05-17 16:20:19 +00:00
flip1995
4dc83a74fd
Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup 2020-05-17 17:36:26 +02:00
Steve Klabnik
aea0186fe5 make many ptr functions must_use
https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.
2020-05-17 10:35:57 -05:00
Ralf Jung
2b3d99d31a
Rollup merge of #72291 - RalfJung:format-typo, r=jonas-schievink
bootstrap: fix typo
2020-05-17 16:24:29 +02:00
Ralf Jung
65833dcd3d
Rollup merge of #72261 - csmoe:issue-72095, r=estebank
Break out early on empty span when generate_fn_span

Closes #72095
r? @oli-obk
cc @estebank @tmandry
2020-05-17 16:24:27 +02:00
Ralf Jung
49b81cae86
Rollup merge of #72259 - crlf0710:ascii_only_check, r=petrochenkov
Disallow forbidden usage of non-ascii identifiers.

Part of RFC2457, this tightens allowed identifiers back to ascii only in two situations.

r? @petrochenkov
2020-05-17 16:24:26 +02:00
bors
34cce58d81 Auto merge of #72204 - RalfJung:abort, r=Mark-Simulacrum
make abort intrinsic safe, and correct its documentation

Turns out `std::process::abort` is not the same as the intrinsic, the comment was just wrong. Quoting from the unix implementation:
```
// On Unix-like platforms, libc::abort will unregister signal handlers
// including the SIGABRT handler, preventing the abort from being blocked, and
// fclose streams, with the side effect of flushing them so libc buffered
// output will be printed.  Additionally the shell will generally print a more
// understandable error message like "Abort trap" rather than "Illegal
// instruction" that intrinsics::abort would cause, as intrinsics::abort is
// implemented as an illegal instruction.
```
2020-05-17 12:49:01 +00:00
bors
e214ea82ad Auto merge of #5568 - ThibsG:RenameIdentityConversionLint, r=flip1995
Rename lint `identity_conversion` to `useless_conversion`

Lint name `identity_conversion` was misleading, so this PR renames it to `useless_conversion`.

As decision has not really came up in the issue comments, this PR will probably need discussion.

fixes #3106

changelog: Rename lint `identity_conversion` to `useless_conversion`
2020-05-17 11:29:04 +00:00
bors
6ae0643d1a Auto merge of #5529 - alex-700:improve-option-and-then-some-lint, r=phansch
Improve `option_and_then_some` lint

fixed #5492

changelog: Improve and generalize `option_and_then_some` and rename it to `bind_instead_of_map`.
2020-05-17 10:58:56 +00:00
Bastian Kauschke
9da8a5ba68 update tests 2020-05-17 11:42:41 +02:00
Ralf Jung
4caddaeeea bootstrap: fix typo 2020-05-17 11:41:20 +02:00
Ralf Jung
5980d972d1 make abort intrinsic safe, and correct its documentation 2020-05-17 11:23:42 +02:00
bors
7faeae0d38 Auto merge of #72135 - oli-obk:const_prop_deaggregates, r=wesleywiser
Propagate locals, even if they have unpropagatable assignments somewhere

Second try for https://github.com/rust-lang/rust/pull/71946#discussion_r422967292

r? @wesleywiser

cc @rust-lang/wg-mir-opt @RalfJung
2020-05-17 09:18:12 +00:00
Aleksei Latyshev
07f1edf2d4
improve and generalize option_and_then_some lint
- rename it to bind_instead_of_map
2020-05-17 12:17:03 +03:00
Elichai Turkel
15911963ec
Update linker-plugin-lto.md to contain up to rust 1.43 2020-05-17 12:16:43 +03:00
Bastian Kauschke
6a72ba4c33 Logically seperate lazy norm from const_generics 2020-05-17 11:06:35 +02:00
Bastian Kauschke
752d8a24d8 the best way to fix bugs is by ignoring them 2020-05-17 11:06:35 +02:00
Bastian Kauschke
c71439791c chalk 2020-05-17 11:06:35 +02:00
Bastian Kauschke
3d7637e66d correctly handle escaping bound variables 2020-05-17 11:06:35 +02:00
Bastian Kauschke
0f7bf5d9e1 add docs 2020-05-17 11:06:35 +02:00