Commit graph

128174 commits

Author SHA1 Message Date
Ivan Tham
4a6bc77a01
Liballoc bench vec use mem take not replace 2020-09-22 14:26:15 +08:00
Imbolc
2a40b63662
Update addr.rs
I little clarification
2020-09-22 09:15:53 +03:00
bors
44ae0b8b2d Auto merge of #76799 - Mark-Simulacrum:fix-cross-compile-dist, r=alexcrichton
Fix cross compiling dist/build invocations

I am uncertain why the first commit is not affecting CI. I suspect it's because we pass --disable-docs on most of our cross-compilation builders. The second commit doesn't affect CI because CI runs x.py dist, not x.py build.

Both commits are standalone; together they should resolve #76733. The first commit doesn't really fix that issue but rather just fixes cross-compiled x.py dist, resolving a bug introduced in #76549.
2020-09-22 06:02:21 +00:00
Ishi Tatsuyuki
01a771a7d8 Add debug assertions against slow path reference results 2020-09-22 14:40:44 +09:00
bors
c2bc344eb2 Auto merge of #77039 - ecstatic-morse:rollup-qv3jj4a, r=ecstatic-morse
Rollup of 13 pull requests

Successful merges:

 - #72734 (Reduce duplicate in liballoc reserve error handling)
 - #76131 (Don't use `zip` to compare iterators during pretty-print hack)
 - #76150 (Don't recommend ManuallyDrop to customize drop order)
 - #76275 (Implementation of Write for some immutable ref structs)
 - #76489 (Add explanation for E0756)
 - #76581 (do not ICE on bound variables, return `TooGeneric` instead)
 - #76655 (Make some methods of `Pin` unstable const)
 - #76783 (Only get ImplKind::Impl once)
 - #76807 (Use const-checking to forbid use of unstable features in const-stable functions)
 - #76888 (use if let instead of single match arm expressions)
 - #76914 (extend `Ty` and `TyCtxt` lints to self types)
 - #77022 (Reduce boilerplate for BytePos and CharPos)
 - #77032 (lint missing docs for extern items)

Failed merges:

r? `@ghost`
2020-09-22 03:45:30 +00:00
ecstatic-morse
0863f9a965
Rollup merge of #77032 - lcnr:visit-all-the-item-likes, r=davidtwco
lint missing docs for extern items

fixes #76991
2020-09-21 20:41:01 -07:00
ecstatic-morse
359615b852
Rollup merge of #77022 - Juici:master, r=lcnr
Reduce boilerplate for BytePos and CharPos

Reduces boilerplate code for BytePos and CharPos by using a macro to implement shared traits.
2020-09-21 20:40:59 -07:00
ecstatic-morse
50d4aebc7a
Rollup merge of #76914 - lcnr:path-no-more, r=ecstatic-morse
extend `Ty` and `TyCtxt` lints to self types

blocked on #76891

r? @ecstatic-morse cc @Aaron1011
2020-09-21 20:40:57 -07:00
ecstatic-morse
dcf4d1f2be
Rollup merge of #76888 - matthiaskrgr:clippy_single_match_2, r=Dylan-DPC
use if let instead of single match arm expressions

use if let instead of single match arm expressions to compact code and reduce nesting (clippy::single_match)
2020-09-21 20:40:55 -07:00
ecstatic-morse
60b99015e9
Rollup merge of #76807 - ecstatic-morse:const-checking-staged-api, r=oli-obk
Use const-checking to forbid use of unstable features in const-stable functions

First step towards #76618.

Currently this code isn't ever hit because `qualify_min_const_fn` runs first and catches pretty much everything. One exception is `const_precise_live_drops`, which does not use the newly added code since it runs as part of a separate pass.

Also contains some unrelated refactoring, which is split into separate commits.

r? @oli-obk
2020-09-21 20:40:53 -07:00
ecstatic-morse
b3433c7cc9
Rollup merge of #76783 - lzutao:rd_impl_kind, r=GuillaumeGomez
Only get ImplKind::Impl once

With this, the code panics in one place instead of two.
2020-09-21 20:40:51 -07:00
ecstatic-morse
537ede465f
Rollup merge of #76655 - CDirkx:const-pin, r=ecstatic-morse
Make some methods of `Pin` unstable const

Make the following methods unstable const under the `const_pin` feature:
- `new`
- `new_unchecked`
- `into_inner`
- `into_inner_unchecked`
- `get_ref`
- `into_ref`
- `get_mut`
- `get_unchecked_mut`

Of these, `into_inner` and `into_inner_unchecked` require the unstable `const_precise_live_drops`.

Also adds tests for these methods in a const context.

Tracking issue: #76654

r? @ecstatic-morse
2020-09-21 20:40:49 -07:00
ecstatic-morse
30f1bab7e6
Rollup merge of #76581 - lcnr:bound-too-generic, r=eddyb
do not ICE on bound variables, return `TooGeneric` instead

fixes #73260, fixes #74634, fixes #76595

r? @nikomatsakis
2020-09-21 20:40:47 -07:00
ecstatic-morse
ef6c3a7bca
Rollup merge of #76489 - GuillaumeGomez:add-explanation-e0756, r=jyn514
Add explanation for E0756

r? @pickfire
2020-09-21 20:40:46 -07:00
ecstatic-morse
65bdf79da3
Rollup merge of #76275 - FedericoPonzi:immutable-write-impl-73836, r=dtolnay
Implementation of Write for some immutable ref structs

Fixes  #73836
2020-09-21 20:40:44 -07:00
ecstatic-morse
4f3697b4b8
Rollup merge of #76150 - matklad:droporder, r=withoutboats
Don't recommend ManuallyDrop to customize drop order

See
https://internals.rust-lang.org/t/need-for-controlling-drop-order-of-fields/12914/21
for the discussion.

TL;DR: ManuallyDrop is unsafe and footguny, but you can just ask the compiler to do all the work for you by re-ordering declarations.

Specifically, the original example from the docs is much better written as

```rust
struct Peach;
struct Banana;
struct Melon;
struct FruitBox {
    melon: Melon,
    // XXX: mind the relative drop order of the fields below
    peach: Peach,
    banana: Banana,
}
```
2020-09-21 20:40:41 -07:00
ecstatic-morse
dc42aa8cd4
Rollup merge of #76131 - Aaron1011:fix/pretty-print-zip, r=lcnr
Don't use `zip` to compare iterators during pretty-print hack

If the right-hand iterator has exactly one more element than the
left-hand iterator, then both iterators will be fully consumed, but
the extra element will never be compared.

Split out from https://github.com/rust-lang/rust/pull/76130
2020-09-21 20:40:39 -07:00
ecstatic-morse
11f7bfab91
Rollup merge of #72734 - pickfire:liballoc, r=KodrAus
Reduce duplicate in liballoc reserve error handling

Not sure if it affects compilation time.
2020-09-21 20:40:37 -07:00
bors
45198456be Auto merge of #76913 - vandenheuvel:performance_debug, r=lcnr
Fixing the performance regression of #76244

Issue https://github.com/rust-lang/rust/issues/74865 suggested that removing the `def_id` field from `ParamEnv` would improve performance. PR https://github.com/rust-lang/rust/pull/76244 implemented this change.

Generally, [results](https://perf.rust-lang.org/compare.html?start=80fc9b0ecb29050d45b17c64af004200afd3cfc2&end=5ef250dd2ad618ee339f165e9b711a1b4746887d) were as expected: an instruction count decrease of about a percent. The instruction count for the unicode crates increased by about 3%, which `@nnethercote` speculated to be caused by a quirk of inlining or codegen. As the results were generally positive, and for chalk integration, this was also a step in the right direction, the PR was r+'d regardless.

However, [wall-time performance results](https://perf.rust-lang.org/compare.html?start=a055c5a1bd95e029e9b31891db63b6dc8258b472&end=7402a394471a6738a40fea7d4f1891666e5a80c5&stat=task-clock) show a much larger performance degradation: 25%, as [mentioned](https://github.com/rust-lang/rust/pull/76244#issuecomment-694459840) by `@Mark-Simulacrum.`

This PR, for now, reverts #76244 and attempts to find out, which change caused the regression.
2020-09-22 00:22:24 +00:00
blitzerr
219003bd2e replaced cell::update with cell::[g|s]et 2020-09-21 16:55:07 -07:00
blitzerr
7e443a1ffc Added feature flag to use cell_update 2020-09-21 16:43:36 -07:00
blitzerr
d9d02fa168 Changing the alloc() to accept &self instead of &mut self 2020-09-21 16:43:36 -07:00
bors
f47df31ae5 Auto merge of #76683 - simonvandel:inst-combine-deref, r=oli-obk
Add optimization to avoid load of address

Look for the sequence
```rust
_2 = &_1;
...
_5 = (*_2)
```

in which we can replace the last statement with `_5 = _1` to avoid the load of _2
2020-09-21 22:04:16 +00:00
Bastian Kauschke
d452744100 lint missing docs for extern items 2020-09-22 00:02:46 +02:00
Bastian Kauschke
2f893e458a review 2020-09-21 23:25:52 +02:00
Alexis Bourget
d01bd19573 Fix missing unsafe block for target arch wasm32 2020-09-21 23:09:12 +02:00
Alexis Bourget
3afadaad4f Fix accordingly to review 2020-09-21 22:37:30 +02:00
Alexis Bourget
5d29954b2f Improve some SAFETY comments following suggestions 2020-09-21 22:37:30 +02:00
Alexis Bourget
a83b79ec31 Finished documenting all unsafe op inside unsafe fn 2020-09-21 22:37:30 +02:00
Alexis Bourget
8c9cb06c2e Deny unsafe op in unsafe fns without the unsafe keyword, first part for std/thread 2020-09-21 22:37:29 +02:00
Simon Vandel Sillesen
dfc469ddae Run the test with explicit -O such that Add is generated instead of CheckedAdd
This makes the test run deterministic regardless of noopt testruns
2020-09-21 22:15:30 +02:00
Simon Vandel Sillesen
2bb3844820 Add optimization to avoid load of address 2020-09-21 22:08:27 +02:00
Bastian Kauschke
9a493ced74 add test for closures in abstract consts 2020-09-21 22:01:18 +02:00
bors
fb1dc34a83 Auto merge of #77003 - joshtriplett:remove-duplicate-link-libraries, r=Mark-Simulacrum
Remove duplicated library links between std and libc

The libc crate is already responsible for linking in the appropriate
libraries, and std doing the same thing results in duplicated library
names on the linker command line. Removing this duplication slightly
reduces linker time, and makes it simpler to adjust the set or order of
linked libraries in one place (such as to add static linking support).
2020-09-21 19:52:13 +00:00
Bastian Kauschke
7a02ebd828 bless tests 2020-09-21 21:50:00 +02:00
Erik Hofmayer
16eee2a04a Applied review comments 2020-09-21 21:31:01 +02:00
Mara Bos
bcc1d56917 Test that AtomicU64::from_mut is not available on x86 linux. 2020-09-21 21:20:05 +02:00
Aaron Hill
f5d71a9b3c
Don't use zip to compare iterators during pretty-print hack
If the right-hand iterator has exactly one more element than the
left-hand iterator, then both iterators will be fully consumed, but
the extra element will never be compared.
2020-09-21 15:11:59 -04:00
Aaron Hill
e734733a9e
Record tcx.def_span instead of item.span in crate metadata
This was missed in PR #75465. As a result, a few places have been using
the full body span of functions, instead of just the header span.
2020-09-21 15:10:16 -04:00
Guillaume Gomez
63195ecb45 Add explanation for E0756 2020-09-21 21:04:56 +02:00
Mara Bos
5d6f1a1e32 Move use align_of in atomic.rs into the places where it is used. 2020-09-21 20:44:45 +02:00
Mara Bos
7a04ff6c33 Gate Atomic::from_mut on cfg(target_has_atomic_equal_alignment).
Instead of a few hardcoded cfg(target_arch = ..) like before.
2020-09-21 20:43:44 +02:00
Mara Bos
668225d157 Revert "Revert adding Atomic::from_mut."
This reverts commit 5ef1db3622.
2020-09-21 20:43:44 +02:00
Mara Bos
54fdf54e06 Add feature gate ui test for cfg(target_has_atomic_equal_alignment). 2020-09-21 20:43:44 +02:00
Mara Bos
af56ad7633 Add feature gate ui test for cfg(target_has_atomic_load_store). 2020-09-21 20:43:44 +02:00
Mara Bos
9e3f94dabc Don't unwrap but report a fatal error for TargetDataLayout::parse. 2020-09-21 20:43:44 +02:00
James Whaley
9a1f1777d3
Remove cast to usize for BytePos and CharPos
The case shouldn't be necessary and implicitly truncating BytePos is not
desirable.
2020-09-21 19:42:43 +01:00
Mara Bos
db74e1f1e3 Add cfg(target_has_atomic_equal_alignment).
This is needed for Atomic::from_mut.
2020-09-21 20:42:25 +02:00
Bastian Kauschke
8fc782afc2 add test 2020-09-21 20:36:05 +02:00
Aleksei Latyshev
d4f158fa5c
Forbid redundant_pattern_matching triggering in macros
- remove ice-2636 test
2020-09-21 20:49:42 +03:00