Commit Graph

120493 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
Bastian Kauschke
08b9b97c53 add test for repr(128) enum derives 2020-05-19 10:55:12 +02:00
Bastian Kauschke
d6cb5405dd add tests for enum discriminants 2020-05-19 10:55:12 +02:00
Bastian Kauschke
ff2940a9f4 update discriminant_value usage in tests 2020-05-19 10:55:12 +02:00
Bastian Kauschke
3188ca7dd9 update discriminant_value usage in the compiler 2020-05-19 10:25:13 +02:00
Bastian Kauschke
25930e47ba update codegen of discriminant_value 2020-05-19 10:25:13 +02:00
Bastian Kauschke
b6975bf22f auto implDiscriminantKind for every type 2020-05-19 10:25:13 +02:00
Bastian Kauschke
9f7c5a80a3 update libcore, add discriminant_kind lang-item 2020-05-19 10:12:35 +02:00
Bastian Kauschke
aab144f6d1 update select docs 2020-05-19 10:12:35 +02: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
Eric Huss
c8443bb33a Update cargo 2020-05-18 15:41:57 -07:00
Nathan Corbyn
ef3f2c0a7c Fix ICE in -Zsave-analysis 2020-05-18 22:55:04 +01:00
Nadrieril
159f48cdc2 Don't mention function pointers
See https://github.com/rust-lang/rust/pull/71930#discussion_r426762889
2020-05-18 20:14:38 +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
Nadrieril
4c6510bee5
Typo
Co-authored-by: varkor <github@varkor.com>
2020-05-18 16:12:01 +01:00
Alex Crichton
cc91041f26 Always generated object code for #![no_builtins]
This commit updates the code generation for `#![no_builtins]` to always
produce object files instead of conditionally respecting
`-Clinker-plugin-lto` and sometimes producing bitcode. This is intended
to address rust-lang/cargo#8239.

The issue at hand here is that Cargo has tried to get "smarter" about
codegen in whole crate graph scenarios. When LTO is enabled it attempts
to avoid codegen on as many crates as possible, opting to pass
`-Clinker-plugin-lto` where it can to only generate bitcode. When this
is combined with `-Zbuild-std`, however, it means that
`compiler-builtins` only generates LLVM bitcode instead of object files.
Rustc's own LTO passes then explicitly skip `compiler-builtins` (because
it wouldn't work anyway) which means that LLVM bitcode gets sent to the
linker, which chokes most of the time.

The fix in this PR is to not actually respect `-Clinker-plugin-lto` for
`#![no_builtins]` crates. These crates, even if slurped up by the linker
rather than rustc, will not work with LTO. They define symbols which are
only referenced as part of codegen, so LTO's aggressive internalization
would trivially remove the symbols only to have the linker realize later
that the symbol is undefined. Since pure-bitcode never makes sense for
these libraries, the `-Clinker-plugin-lto` flag is silently ignored.
2020-05-18 08:00:44 -07:00
Amanieu d'Antras
09efea5f54 Update unstable book documentation with the latest RFC text 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
32471f4d87 Update LLVM submodule 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
62ff543c36 Simplify register name output for x86 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
5a20f39672 Update compiler_builtins to 0.1.28 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
3233565cdf Mark asm unstable book doctests as allow_fail since they don't work with system LLVM 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
cecffdc1d7 Fix const handling and add tests for const operands 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
6f8be8cc8c Fix docs 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
9215ead1ee Fix handling on InlineAsm for the unconditional recursion lint. 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
46db0dfe8c Fix tests 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
ac1fb93fce Fix feature gate tests 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
6ba9696f5e Add documentation for asm! 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
2aa9aaada5 Add borrow-check test 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
f10803c81c Minor fixes 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
1c6a9351d8 Handle InlineAsm in clippy 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
a656349b55 Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_ast 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
330bdf89b1 Disable asm tests on system llvm 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
ddcdea45b6 The h modifier is only supported by reg_abcd 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
9ac4ef40d4 Update llvm-project submodule 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
08822546a5 Implement att_syntax option 2020-05-18 14:41:33 +01:00