Commit graph

127926 commits

Author SHA1 Message Date
Simon Vandel Sillesen
b4bdaa14f2 Suggestion from review
Co-authored-by: Andreas Jonson <andjo403@users.noreply.github.com>
2020-09-22 23:09:07 +02:00
Simon Vandel Sillesen
290dca1781 MIR pass to remove unneeded drops on types not needing drop
This is heavily dependent on MIR inlining running to actually see the drop statement
2020-09-22 23:09:07 +02:00
bors
0da5800745 Auto merge of #76810 - Mark-Simulacrum:fix-lld-macos, r=alexcrichton
Don't dynamically link LLVM tools unless rustc is too

This PR initially tried to support link-shared on all of our target platforms (other than Windows), but ran into a number of difficulties:
 * LLVM doesn't really support a shared link on macOS (llvm-config runs into problems with the version suffix)
 * LLVM doesn't seem to support a shared link when cross-compiling (the libLLVM.so ends up empty and symbols are not found)

So, this PR has now been revised such that we don't attempt to dynamically link LLVM tools (even if that would, otherwise, be supported) on targets where LLVM is statically linked to rustc. Currently that's basically everything except for x86_64-unknown-linux-gnu (where we dynamically link to avoid rerunning ThinLTO in each stage).

Follow-up to #76708.
Fixes #76698.
2020-09-22 20:35:45 +00:00
Dylan MacKenzie
186d148b4c Use correct feature gate for unsizing casts 2020-09-22 10:22:50 -07:00
Dylan MacKenzie
6044836284 Add #![feature(const_fn_transmute)] to rustc_ast 2020-09-22 10:22:21 -07:00
Josh Stone
883a7a5c05 Rebase LLVM onto 11.0.0-rc3 2020-09-22 10:16:03 -07:00
Dylan MacKenzie
08e3822d9a Replace missing comment 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
d60e204e0a Use the same name everywhere for is_const_stable_const_fn 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
9be3d106c3 Bless compile-fail 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
ef6d4277ed Bless tests 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
3569bb6323 Update const-checker to replicate qualify_min_const_fn 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
5ee5429e00 Add structured errors for qualify_min_const_fn checks 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
bfc10a89c3 Allow errors to abort const checking when emitted
This is a hack for parity with `qualify_min_const_fn`, which only
emitted a single error.
2020-09-22 10:05:58 -07:00
Dylan MacKenzie
7fb9587a3c Return true if check_const emits an error 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
a173c5c1b3 Add const-stability helpers 2020-09-22 10:05:58 -07:00
Dylan MacKenzie
110e59e70e Update library functions with stability attributes
This may not be strictly minimal, but all unstable functions also need a
`rustc_const_unstable` attribute.
2020-09-22 10:05:58 -07:00
Dylan MacKenzie
3dd28c78c3 Useful derives on ops::Status 2020-09-22 10:05:58 -07:00
Imbolc
4622ceb5e0
Update library/std/src/net/addr.rs
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2020-09-22 19:09:35 +03:00
Imbolc
5ab714fdfe
Update library/std/src/net/addr.rs
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2020-09-22 19:09:27 +03:00
blitzerr
14736ca20b fixing the custom.rs 2020-09-22 08:51:20 -07:00
est31
05c3a2b07d Add #[track_caller] to more panicking Cell functions
Continuation of #74526

Adds the #[track_caller] attribute to almost all panicking Cell
functions. The ones that borrow two Cells in their function
body are spared, because the panic location helps pinpoint
which of the two borrows failed. You'd need to have
full debuginfo and backtraces enabled together with column
info in order to be able to discern the cases.
Column info is only available on non-Windows platforms.
2020-09-22 15:34:22 +02:00
blitzerr
3ffd403c6b removing &mut self for other methods of AllocRef 2020-09-22 06:22:02 -07:00
bors
e0bc267512 Auto merge of #76110 - FedericoPonzi:convert-openoptions-cint, r=JoshTriplett
Function to convert OpenOptions to c_int

Fixes: #74943
The creation_mode and access_mode function were already available in the OpenOptions struct, but currently private. I've added a new free functions to unix/fs.rs which takes the OpenOptions, and returns the c_int to be used as parameter for the `open` call.
2020-09-22 13:02:02 +00:00
Guillaume Gomez
143557ec56 Add missing examples on Vec iter types 2020-09-22 13:47:06 +02:00
bors
cbc5e4d4d5 Auto merge of #76626 - jyn514:x.py-changelog, r=Mark-Simulacrum
Add a changelog for x.py and nag contributors until they read it

Add a changelog for x.py

- Add a changelog and instructions for updating it
- Use `changelog-seen` in `config.toml` and `VERSION` in bootstrap to determine whether the changelog has been read.  There's no way to tie reading the changelog to updating the version, so unfortunately they still have to update `config.toml` manually. Actually reading the changelog is optional, anyone can set `changelog-seen = N` without reading (although it's not recommended).
- Nag people if they haven't read the x.py changelog
  + Print message twice to make sure it's seen
- Give different error messages depending on whether the version needs to be updated or added

Closes https://github.com/rust-lang/rust/issues/76617
r? `@Mark-Simulacrum`
2020-09-22 10:36:41 +00:00
Federico Ponzi
2f5192280f
enable unstable open_options_ext_as_flags feature in doc comments 2020-09-22 09:54:36 +01:00
bors
c113030f6b Auto merge of #76906 - Nicholas-Baron:shorten_typeck_check, r=oli-obk
Split rustc_typeck::check into separate files

Contributing to #60302.
2020-09-22 08:11:07 +00:00
Ralf Jung
731113b8ee Miri: more informative deallocation error messages 2020-09-22 09:05:12 +02:00
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