Commit graph

127035 commits

Author SHA1 Message Date
Dylan DPC
6545985888
Rollup merge of #76274 - scottmcm:fix-76271, r=petrochenkov
Allow try blocks as the argument to return expressions

Fixes #76271

I don't think this needs to be edition-aware (phew) since `return try` in 2015 is also the start of an expression, just with a struct literal instead of a block (`return try { x: 4, y: 5 }`).
2020-09-07 01:17:46 +02:00
Dylan DPC
e488c4f187
Rollup merge of #76273 - CraftSpider:master, r=matklad
Move some Vec UI tests into alloc unit tests

A bit of work towards #76268, makes a number of the Vec UI tests that are simply running code into unit tests. Ensured that they are being run when testing liballoc locally.
2020-09-07 01:17:45 +02:00
bors
bf4d6cca49 Auto merge of #76229 - camelid:patch-3, r=jonas-schievink
Add missing link in README
2020-09-06 22:42:21 +00:00
bors
daad592fac Auto merge of #6006 - ebroto:6001_unnecessary_sort_by, r=Manishearth
Restrict unnecessary_sort_by to non-reference, Copy types

`Vec::sort_by_key` closure parameter is `F: FnMut(&T) -> K`. The lint's suggestion destructures the `T` parameter; this was probably done to avoid different unnamed lifetimes when `K = Reverse<&T>`.

This change fixes two issues:
* Destructuring T when T is non-reference requires the type to be Copy, otherwise we would try to move from a shared reference. We make sure `T: Copy` holds.
* Make sure `T` is actually non-reference. I didn't go for destructuring multiple levels of references, as we would have to compensate in the closure body by removing derefs and maybe adding parens, which would add more complexity.

changelog: Restrict [`unnecessary_sort_by`] to non-reference, Copy types

Fixes #6001
2020-09-06 22:37:46 +00:00
Eduardo Broto
9fa9208bd5 Restrict unnecessary_sort_by to non-ref copy types 2020-09-07 00:19:17 +02:00
Vadim Petrochenkov
b27fca71d4 rustbuild: Deduplicate LLD checks slightly 2020-09-07 00:40:07 +03:00
Vadim Petrochenkov
5118a51b4d rustbuild: Propagate LLD to more places when use-lld is enabled 2020-09-07 00:40:07 +03:00
Vadim Petrochenkov
8e6b563b93 rustbuild: Build tests with LLD if use-lld = true was passed (non-msvc) 2020-09-07 00:40:07 +03:00
Vadim Petrochenkov
77d11c3ce2 rustbuild: Build tests with LLD if use-lld = true was passed 2020-09-07 00:40:07 +03:00
bors
73dc675b94 Auto merge of #76157 - ArekPiekarz:const_caller_location_tracking_issue, r=joshtriplett
Update tracking issue for const_caller_location

Update the tracking issue to https://github.com/rust-lang/rust/issues/76156, as suggested in https://github.com/rust-lang/rust/issues/76105.
2020-09-06 20:27:51 +00:00
Joshua Nelson
aee0ef13dd Remove duplicate 'note:' 2020-09-06 15:18:45 -04:00
Joshua Nelson
3ecfd5ca51 Move sections about contributing closer together 2020-09-06 15:14:29 -04:00
bors
5d74e88006 Auto merge of #75949 - vext01:filter-docs, r=jyn514
Try to improve the documentation of `filter()` and `filter_map()`.

I believe the documentation is currently a little misleading.

For example, in the docs for `filter()`:

> If the closure returns `false`, it will try again, and call the closure on
> the next element, seeing if it passes the test.

This kind of implies that if the closure returns true then we *don't* "try
again" and no further elements are considered. In actuality that's not the
case, every element is tried regardless of what happened with the previous
element.

This change tries to clarify that by removing the uses of "try again"
altogether.
2020-09-06 18:26:33 +00:00
bors
ac892a1274 Auto merge of #76390 - MaulingMonkey:pr-min-cdb-version, r=petrochenkov
debuginfo:  Ignore HashMap .natvis tests before cdb 10.0.18362.1

CDB <10.0.18362.1 chokes on casts within HashMap's natvis visualizers.  This PR adds support for "min-cdb-version" (per existing "min-gdb-version" and "min-lldb-version" filters) and uses it.  CI uses a more recent version of CDB for testing and thus should still run the tests.

Credit to @petrochenkov per https://github.com/rust-lang/rust/issues/76352 for helping catch this.

### SDK Testing

| Win 10 SDK                                                             |  x64 CDB          | rustc 1.47.0-nightly (bf4342114 2020-08-25) built-in .natvis  | Note |
| --------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------- | ---- |
| [10.0.19041.0](https://go.microsoft.com/fwlink/p/?linkid=2120843)     | 10.0.19041.1      | ✔️                                                            | CI
| [10.0.18362.1](https://go.microsoft.com/fwlink/?linkid=2083338)       | 10.0.18362.1      | ✔️                                                            | MaulingMonkey
| [10.0.17763.0](https://go.microsoft.com/fwlink/p/?LinkID=2033908)     | 10.0.17763.132    |  `Unable to find type 'tuple<u64,u64> *' for cast.`
| [10.0.17134.12](https://go.microsoft.com/fwlink/p/?linkid=870807)     | 10.0.17134.12     |  `Unable to find type 'tuple<u64,u64> *' for cast.`
| [10.0.16299.91](https://go.microsoft.com/fwlink/p/?linkid=864422)     | 10.0.16299.91     |  `Unable to find type 'tuple<u64,u64> *' for cast.`
| [10.0.15063.468](https://go.microsoft.com/fwlink/p/?LinkId=845298)    | 10.0.15063.468    |  `Unable to find type 'tuple<u64,u64> *' for cast.`
| [10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916)    | 10.0.14321.1024   |  `Unable to find type 'tuple<u64,u64> *' for cast.` | petrochenkov
| [10.0.10586.212](https://go.microsoft.com/fwlink/p/?LinkID=698771)    | 10.0.10586.567    |  `Expected ')' at '+ 1)].__1'`
| [10.0.10240](https://go.microsoft.com/fwlink/p/?LinkId=619296)        | 10.0.10240?       |  Untested

### Rust Testing

```cmd
x.py test --stage 1 src/tools/tidy
x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo
```

Also verified test still fails when intentionally broken w/ CDB version >= min-cdb-version.
2020-09-06 16:26:33 +00:00
bors
4b65872d27 Auto merge of #76067 - simonvandel:peephole-ne, r=wesleywiser
MIR peephole optimize {Ne, Eq}(_1, false) into _1

Add peephole optimization that simplifies Ne(_1, false) and Ne(false, _1) into _1. Similarly handles Eq(_1, true) and Eq(true, _1).

This was observed emitted from the MatchBranchSimplification pass.
2020-09-06 14:21:11 +00:00
Jonas Schievink
24dc182f20 Remove unneeded #[cfg(not(test))] from libcore 2020-09-06 16:00:28 +02:00
bors
aa81d32165 Auto merge of #76128 - poliorcetics:doc-use-arc-clone, r=KodrAus
Use Arc::clone and Rc::clone in documentation

This PR replaces uses of `x.clone()` by `Rc::clone(&x)` (or `Arc::clone(&x)`) to better match the documentation for those types.

@rustbot modify labels: T-doc
2020-09-06 12:34:31 +00:00
Ralf Jung
28ddda76b7 add compile-fail test for &mut promotion 2020-09-06 14:14:31 +02:00
Ralf Jung
720293b640 do not premote non-ZST mutable references ever 2020-09-06 14:14:27 +02:00
Elichai Turkel
2e82589741
linker-plugin-lto.md: Convert the rust-clang MxN table to a 2xM table 2020-09-06 14:55:27 +03:00
bors
23e49ddafb Auto merge of #76370 - fusion-engineering-forks:synconcecell-soundness, r=nagisa
Fix dropck issue of SyncOnceCell.

Fixes #76367.
2020-09-06 10:29:54 +00:00
Sasha
84fc6fd2d0 Fix documentation for TyCtxt::all_impls 2020-09-06 12:10:46 +02:00
Simon Vandel Sillesen
9b0fc6202b Generalize to Eq(true, _place) and Eq(_place, true) 2020-09-06 11:51:44 +02:00
Simon Vandel Sillesen
c2693db264 Add peephold optimization that simplifies Ne(_1, false) and Ne(false, _1) into _1
This was observed emitted from the MatchBranchSimplification pass.
2020-09-06 11:51:44 +02:00
Elichai Turkel
9e1403373d
Update linker-plugin-lto.md to contain up to rust 1.46 2020-09-06 11:20:53 +03:00
bors
6c6003a7ad Auto merge of #76341 - richkadel:ignore-gcc-destructor-priority, r=cuviper
Update llvm-project to include PR 73

https://github.com/rust-lang/llvm-project/pull/73

r? @cuviper
2020-09-06 08:13:39 +00:00
bors
ffaf158608 Auto merge of #76331 - Aaron1011:fix/group-compat-hack-test, r=petrochenkov
Account for version number in NtIdent hack

Issue #74616 tracks a backwards-compatibility hack for certain macros.
This has is implemented by hard-coding the filenames and macro names of
certain code that we want to continue to compile.

However, the initial implementation of the hack was based on the
directory structure when building the crate from its repository (e.g.
`js-sys/src/lib.rs`). When the crate is build as a dependency, it will
include a version number from the clone from the cargo registry (e.g.
`js-sys-0.3.17/src/lib.rs`), which would fail the check.

This commit modifies the backwards-compatibility hack to check that
desired crate name (`js-sys` or `time-macros-impl`) is a prefix of the
proper part of the path.

See https://github.com/rust-lang/rust/issues/76070#issuecomment-687215646
for more details.
2020-09-06 06:15:28 +00:00
bors
b40abfd485 Auto merge of #76326 - mati865:use_lld-no-linker, r=Mark-Simulacrum
Fix rust.use-lld when linker is not set

Fixes https://github.com/rust-lang/rust/pull/76127#issuecomment-685419195

Previously when `[<target>].linker` was not configured `rust.use-lld` would set it to `rust-lld` on platforms where it should not.
2020-09-06 04:00:56 +00:00
Ayush Kumar Mishra
05d22c8519 Move test-cases in string.rs 2020-09-06 09:23:40 +05:30
bors
94b8eb80ab Auto merge of #76307 - sunfishcode:wasm-no-eh-frame-header, r=alexcrichton
Disable use of `--eh-frame-hdr` on wasm32.

Set wasm32's `TargetOptions::eh_frame_header` to false so that we don't pass `--eh-frame-hdr` to `wasm-ld`, which doesn't support that flag.

r? @alexcrichton
2020-09-06 01:58:35 +00:00
dylni
b92b0d6ee6 Fix typo in tracking issue template 2020-09-05 20:12:26 -04:00
dylni
cf529c767e Adjust documentation for slice_check_range 2020-09-05 19:53:35 -04:00
bors
d39b076489 Auto merge of #76385 - calebcartwright:update-rls-rustfmt, r=Xanewok
Update RLS and Rustfmt

Fixes #76145 and fixes #76146

cc @Xanewok @topecongiro
2020-09-05 23:29:05 +00:00
MaulingMonkey
5acd272f5f Fix HashMap visualizers in Visual Studio (Code)
CDB doesn't care that you're using static_cast between unrelated types.
VS(C) does.  These should've been reinterpret_cast or C casts.
Cast is from e.g. `u8*` to `tuple<$T1, $T2>*`
2020-09-05 14:50:03 -07:00
MaulingMonkey
4046f928d1 debuginfo: Ignore HashMap tests before cdb 10.0.18362.1
cdb chokes on the cast and reports "Unable to find type 'tuple<u64,u64> *' for cast."
2020-09-05 14:47:16 -07:00
MaulingMonkey
7cbfbd3ee7 compiletest: Introduce "min-cdb-version" 2020-09-05 14:46:22 -07:00
bors
cdc8f0606d Auto merge of #76217 - RalfJung:maybe-uninit-slice, r=KodrAus
rename MaybeUninit slice methods

The `first` methods conceptually point to the whole slice, not just its first element, so rename them to be consistent with the raw ptr methods on ref-slices.

Also, do the equivalent of https://github.com/rust-lang/rust/pull/76047 for the slice reference getters, and make them part of https://github.com/rust-lang/rust/issues/63569 (so far they somehow had no tracking issue).

* first_ptr -> slice_as_ptr
* first_ptr_mut -> slice_as_mut_ptr
* slice_get_ref -> slice_assume_init_ref
* slice_get_mut -> slice_assume_init_mut
2020-09-05 21:02:18 +00:00
Caleb Cartwright
1ceb82488f Update RLS and Rustfmt 2020-09-05 15:40:07 -05:00
bors
e9440cbcde Auto merge of #5997 - giraffate:fix_fp_about_clone_in_same_item_push, r=ebroto
Fix FP in `same_item_push`

Don't emit a lint when the pushed item doesn't have Clone trait

Fix #5979

changelog: Fix FP in `same_item_push` not to emit a lint when the pushed item doesn't have Clone trait
2020-09-05 20:27:17 +00:00
Rich Kadel
39a35178d3 Update llvm-project to include PR 73
https://github.com/rust-lang/llvm-project/pull/73
2020-09-05 12:49:17 -07:00
bors
de921ab3c3 Auto merge of #75428 - the8472:fix-copy-eopnotsupp, r=joshtriplett
Workarounds for copy_file_range issues

fixes #75387
fixes #75446
2020-09-05 19:09:22 +00:00
Edd Barrett
8af85fa1f7 Improve the documentation of filter() and filter_map().
I believe the documentation is currently a little misleading.

For example, in the docs for `filter()`:

> If the closure returns `false`, it will try again, and call the closure on
> the next element, seeing if it passes the test.

This kind of implies that if the closure returns true then we *don't* "try
again" and no further elements are considered. In actuality that's not the
case, every element is tried regardless of what happened with the previous
element.

This change tries to clarify that by removing the uses of "try again"
altogether.
2020-09-05 19:59:30 +01:00
Vadim Petrochenkov
8754884b78 rustbuild: Do not use rust-mingw component when bootstrapping windows-gnu targets 2020-09-05 20:49:59 +03:00
Vadim Petrochenkov
4fff14d3d8 rustbuild: Remove Mode::Codegen 2020-09-05 20:34:03 +03:00
bors
04f44fb923 Auto merge of #75872 - mati865:pgo-tests, r=petrochenkov
Enable some of profiler tests on Windows-gnu

CC https://github.com/rust-lang/rust/issues/61266

Because of force-push GitHub didn't let me reopen https://github.com/rust-lang/rust/pull/75184

Because of the GCC miscompilation, generated binaries either segfault or `.profraw` is malformed. Clang works fine but we can't use it on the CI.
However we can still test the IR for the proper instrumentation so let's do it.
2020-09-05 17:18:26 +00:00
Ralf Jung
35068326b5 document remaining unsafety in maybe_uninit.rs 2020-09-05 17:24:22 +02:00
Ralf Jung
cff5f56886 rename MaybeUninit slice methods
first_ptr -> slice_as_ptr
first_ptr_mut -> slice_as_mut_ptr
slice_get_ref -> slice_assume_init_ref
slice_get_mut -> slice_assume_init_mut
2020-09-05 17:24:22 +02:00
Takayuki Nakata
96b31a5b36 Fix FP when coercion kicks in 2020-09-06 00:02:35 +09:00
bors
7d289aeade Auto merge of #76376 - Dylan-DPC:rollup-8chsbw9, r=Dylan-DPC
Rollup of 11 pull requests

Successful merges:

 - #75695 (Add a regression test for issue-72793)
 - #75741 (Refactor byteorder to std in rustc_middle)
 - #75954 (Unstable Book: add links to tracking issues for FFI features)
 - #75994 (`impl Rc::new_cyclic`)
 - #76060 (Link vec doc to & reference)
 - #76078 (Remove disambiguators from intra doc link text)
 - #76082 (Fix intra-doc links on pub re-exports)
 - #76254 (Fold length constant in Rvalue::Repeat)
 - #76258 (x.py check checks tests/examples/benches)
 - #76263 (inliner: Check for codegen fn attributes compatibility)
 - #76285 (Move jointness censoring to proc_macro)

Failed merges:

r? @ghost
2020-09-05 14:59:32 +00:00
Dylan DPC
85cee57fd7
Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov
Move jointness censoring to proc_macro

Proc-macro API currently exposes jointness in `Punct` tokens. That is,
`+` in `+one` is **non** joint.

Our lexer produces jointness info for all tokens, so we need to censor
it *somewhere*

Previously we did this in a lexer, but it makes more sense to do this
in a proc-macro server.

r? @petrochenkov
2020-09-05 16:28:36 +02:00