]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #76338 - euclio:intra-link-iterator, r=jyn514
Dylan DPC [Sun, 6 Sep 2020 23:18:08 +0000 (01:18 +0200)]
Rollup merge of #76338 - euclio:intra-link-iterator, r=jyn514

add some intra-doc links to `Iterator`

3 years agoRollup merge of #76324 - ayushmishra2005:move_vec_tests_in_library, r=matklad
Dylan DPC [Sun, 6 Sep 2020 23:18:07 +0000 (01:18 +0200)]
Rollup merge of #76324 - ayushmishra2005:move_vec_tests_in_library, r=matklad

Move Vec slice UI tests in library

Moved some of Vec slice UI tests in Library as a part of #76268

r? @matklad

3 years agoRollup merge of #76318 - scottmcm:one-control-flow, r=ecstatic-morse
Dylan DPC [Sun, 6 Sep 2020 23:18:05 +0000 (01:18 +0200)]
Rollup merge of #76318 - scottmcm:one-control-flow, r=ecstatic-morse

Use ops::ControlFlow in rustc_data_structures::graph::iterate

Since I only know about this because you mentioned it,
r? @ecstatic-morse

If we're not supposed to use new `core` things in compiler for a while then feel free to close, but it felt reasonable to merge the two types since they're the same, and it might be convenient for people to use `?` in their traversal code.

(This doesn't do the type parameter swap; NoraCodes has signed up to do that one.)

3 years agoRollup merge of #76312 - numbermaniac:patch-1, r=shepmaster
Dylan DPC [Sun, 6 Sep 2020 23:18:03 +0000 (01:18 +0200)]
Rollup merge of #76312 - numbermaniac:patch-1, r=shepmaster

time.rs: Make spelling of "Darwin" consistent

On line 89 of this file, the OS name is written as "Darwin", but on line 162 it is written in all-caps. Darwin is usually spelt as a standard proper noun, i.e. "Darwin", rather than in all-caps.

This change makes that form consistent in both places.

3 years agoRollup merge of #76309 - lzutao:indent-note, r=jyn514
Dylan DPC [Sun, 6 Sep 2020 23:18:01 +0000 (01:18 +0200)]
Rollup merge of #76309 - lzutao:indent-note, r=jyn514

Indent a note to make folding work nicer

Sublime Text folds code based on indentation. It maybe an unnecessary change, but does it look nicer after that ?

3 years agoRollup merge of #76305 - CDirkx:const-tests, r=matklad
Dylan DPC [Sun, 6 Sep 2020 23:17:59 +0000 (01:17 +0200)]
Rollup merge of #76305 - CDirkx:const-tests, r=matklad

Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of #76268

r? @matklad

3 years agoRollup merge of #76303 - jyn514:vec-assert-doc, r=Dylan-DPC
Dylan DPC [Sun, 6 Sep 2020 23:17:56 +0000 (01:17 +0200)]
Rollup merge of #76303 - jyn514:vec-assert-doc, r=Dylan-DPC

Link to `#capacity-and-reallocation` when using with_capacity

Follow up to https://github.com/rust-lang/rust/pull/76058#discussion_r479655750.
r? @pickfire

3 years agoRollup merge of #76302 - jyn514:peekable-2, r=Dylan-DPC
Dylan DPC [Sun, 6 Sep 2020 23:17:54 +0000 (01:17 +0200)]
Rollup merge of #76302 - jyn514:peekable-2, r=Dylan-DPC

Address review comments on `Peekable::next_if`

r? @pickfire
See https://github.com/rust-lang/rust/pull/72310#pullrequestreview-480895893 for context.

3 years agoRollup merge of #76299 - CDirkx:ip-tests, r=matklad
Dylan DPC [Sun, 6 Sep 2020 23:17:52 +0000 (01:17 +0200)]
Rollup merge of #76299 - CDirkx:ip-tests, r=matklad

Make `Ipv4Addr` and `Ipv6Addr` const tests unit tests under `library`

These tests are about the standard library, not the compiler itself, thus should live in `library`, see #76268.

3 years agoRollup merge of #76293 - Amjad50:incompatible_features_error, r=lcnr
Dylan DPC [Sun, 6 Sep 2020 23:17:50 +0000 (01:17 +0200)]
Rollup merge of #76293 - Amjad50:incompatible_features_error, r=lcnr

Implementation of incompatible features error

Proposal of a new error: Incompatible features

This error should happen if two features which are not compatible are used together.

For now the only incompatible features are `const_generics` and `min_const_generics`

fixes #76280

3 years agoRollup merge of #76287 - lzutao:rm-allowed, r=jyn514
Dylan DPC [Sun, 6 Sep 2020 23:17:48 +0000 (01:17 +0200)]
Rollup merge of #76287 - lzutao:rm-allowed, r=jyn514

Remove an unnecessary allowed lint

It is outdated.

3 years agoRollup merge of #76274 - scottmcm:fix-76271, r=petrochenkov
Dylan DPC [Sun, 6 Sep 2020 23:17:46 +0000 (01:17 +0200)]
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 }`).

3 years agoRollup merge of #76273 - CraftSpider:master, r=matklad
Dylan DPC [Sun, 6 Sep 2020 23:17:45 +0000 (01:17 +0200)]
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.

3 years agoAuto merge of #76157 - ArekPiekarz:const_caller_location_tracking_issue, r=joshtriplett
bors [Sun, 6 Sep 2020 20:27:51 +0000 (20:27 +0000)]
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.

3 years agoAuto merge of #75949 - vext01:filter-docs, r=jyn514
bors [Sun, 6 Sep 2020 18:26:33 +0000 (18:26 +0000)]
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.

3 years agoAuto merge of #76390 - MaulingMonkey:pr-min-cdb-version, r=petrochenkov
bors [Sun, 6 Sep 2020 16:26:33 +0000 (16:26 +0000)]
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.

3 years agoAuto merge of #76067 - simonvandel:peephole-ne, r=wesleywiser
bors [Sun, 6 Sep 2020 14:21:11 +0000 (14:21 +0000)]
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.

3 years agoAuto merge of #76128 - poliorcetics:doc-use-arc-clone, r=KodrAus
bors [Sun, 6 Sep 2020 12:34:31 +0000 (12:34 +0000)]
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

3 years agoAuto merge of #76370 - fusion-engineering-forks:synconcecell-soundness, r=nagisa
bors [Sun, 6 Sep 2020 10:29:54 +0000 (10:29 +0000)]
Auto merge of #76370 - fusion-engineering-forks:synconcecell-soundness, r=nagisa

Fix dropck issue of SyncOnceCell.

Fixes #76367.

3 years agoGeneralize to Eq(true, _place) and Eq(_place, true)
Simon Vandel Sillesen [Thu, 3 Sep 2020 17:48:27 +0000 (19:48 +0200)]
Generalize to Eq(true, _place) and Eq(_place, true)

3 years agoAdd peephold optimization that simplifies Ne(_1, false) and Ne(false, _1) into _1
Simon Vandel Sillesen [Sat, 29 Aug 2020 12:16:39 +0000 (14:16 +0200)]
Add peephold optimization that simplifies Ne(_1, false) and Ne(false, _1) into _1

This was observed emitted from the MatchBranchSimplification pass.

3 years agoAuto merge of #76341 - richkadel:ignore-gcc-destructor-priority, r=cuviper
bors [Sun, 6 Sep 2020 08:13:39 +0000 (08:13 +0000)]
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

3 years agoAuto merge of #76331 - Aaron1011:fix/group-compat-hack-test, r=petrochenkov
bors [Sun, 6 Sep 2020 06:15:28 +0000 (06:15 +0000)]
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.

3 years agoAuto merge of #76326 - mati865:use_lld-no-linker, r=Mark-Simulacrum
bors [Sun, 6 Sep 2020 04:00:56 +0000 (04:00 +0000)]
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.

3 years agoAuto merge of #76307 - sunfishcode:wasm-no-eh-frame-header, r=alexcrichton
bors [Sun, 6 Sep 2020 01:58:35 +0000 (01:58 +0000)]
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

3 years agoAuto merge of #76385 - calebcartwright:update-rls-rustfmt, r=Xanewok
bors [Sat, 5 Sep 2020 23:29:05 +0000 (23:29 +0000)]
Auto merge of #76385 - calebcartwright:update-rls-rustfmt, r=Xanewok

Update RLS and Rustfmt

Fixes #76145 and fixes #76146

cc @Xanewok @topecongiro

3 years agodebuginfo: Ignore HashMap tests before cdb 10.0.18362.1
MaulingMonkey [Sat, 5 Sep 2020 21:47:16 +0000 (14:47 -0700)]
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."

3 years agocompiletest: Introduce "min-cdb-version"
MaulingMonkey [Sat, 5 Sep 2020 21:46:22 +0000 (14:46 -0700)]
compiletest: Introduce "min-cdb-version"

3 years agoAuto merge of #76217 - RalfJung:maybe-uninit-slice, r=KodrAus
bors [Sat, 5 Sep 2020 21:02:18 +0000 (21:02 +0000)]
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

3 years agoUpdate RLS and Rustfmt
Caleb Cartwright [Sat, 5 Sep 2020 19:03:27 +0000 (14:03 -0500)]
Update RLS and Rustfmt

3 years agoUpdate llvm-project to include PR 73
Rich Kadel [Fri, 4 Sep 2020 20:42:10 +0000 (13:42 -0700)]
Update llvm-project to include PR 73

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

3 years agoAuto merge of #75428 - the8472:fix-copy-eopnotsupp, r=joshtriplett
bors [Sat, 5 Sep 2020 19:09:22 +0000 (19:09 +0000)]
Auto merge of #75428 - the8472:fix-copy-eopnotsupp, r=joshtriplett

Workarounds for copy_file_range issues

fixes #75387
fixes #75446

3 years agoImprove the documentation of `filter()` and `filter_map()`.
Edd Barrett [Wed, 26 Aug 2020 16:39:43 +0000 (17:39 +0100)]
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.

3 years agoAuto merge of #75872 - mati865:pgo-tests, r=petrochenkov
bors [Sat, 5 Sep 2020 17:18:26 +0000 (17:18 +0000)]
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.

3 years agodocument remaining unsafety in maybe_uninit.rs
Ralf Jung [Wed, 2 Sep 2020 08:00:08 +0000 (10:00 +0200)]
document remaining unsafety in maybe_uninit.rs

3 years agorename MaybeUninit slice methods
Ralf Jung [Tue, 1 Sep 2020 21:16:51 +0000 (23:16 +0200)]
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

3 years agoAuto merge of #76376 - Dylan-DPC:rollup-8chsbw9, r=Dylan-DPC
bors [Sat, 5 Sep 2020 14:59:32 +0000 (14:59 +0000)]
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

3 years agoRollup merge of #76285 - matklad:censor-spacing, r=petrochenkov
Dylan DPC [Sat, 5 Sep 2020 14:28:36 +0000 (16:28 +0200)]
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

3 years agoRollup merge of #76263 - tmiasko:inline-codegen-fn-attrs, r=ecstatic-morse
Dylan DPC [Sat, 5 Sep 2020 14:28:34 +0000 (16:28 +0200)]
Rollup merge of #76263 - tmiasko:inline-codegen-fn-attrs, r=ecstatic-morse

inliner: Check for codegen fn attributes compatibility

* Check for target features compatibility
* Check for no_sanitize attribute compatibility

Fixes #76259.

3 years agoRollup merge of #76258 - Mark-Simulacrum:check-tests, r=ehuss
Dylan DPC [Sat, 5 Sep 2020 14:28:32 +0000 (16:28 +0200)]
Rollup merge of #76258 - Mark-Simulacrum:check-tests, r=ehuss

x.py check checks tests/examples/benches

This also adds a check for bootstrap to x.py.

r? @ehuss

3 years agoRollup merge of #76254 - tmiasko:fold-len, r=wesleywiser
Dylan DPC [Sat, 5 Sep 2020 14:28:30 +0000 (16:28 +0200)]
Rollup merge of #76254 - tmiasko:fold-len, r=wesleywiser

Fold length constant in Rvalue::Repeat

Fixes #76248.

3 years agoRollup merge of #76082 - jyn514:top-level-links, r=ollie27,GuillaumeGomez
Dylan DPC [Sat, 5 Sep 2020 14:28:28 +0000 (16:28 +0200)]
Rollup merge of #76082 - jyn514:top-level-links, r=ollie27,GuillaumeGomez

Fix intra-doc links on pub re-exports

Partial fix for https://github.com/rust-lang/rust/issues/76073 - This removes the incorrect error, but doesn't show the documentation anywhere.
r? @GuillaumeGomez

3 years agoRollup merge of #76078 - jyn514:no-disambiguator, r=manishearth
Dylan DPC [Sat, 5 Sep 2020 14:28:26 +0000 (16:28 +0200)]
Rollup merge of #76078 - jyn514:no-disambiguator, r=manishearth

Remove disambiguators from intra doc link text

Closes https://github.com/rust-lang/rust/issues/65354.
r? @Manishearth

The commits are mostly atomic, but there might be some mix between them here and there. I recommend reading 'refactor ItemLink' and 'refactor RenderedLink' on their own though, lots of churn without any logic changes.

3 years agoRollup merge of #76060 - pickfire:patch-12, r=jyn514
Dylan DPC [Sat, 5 Sep 2020 14:28:24 +0000 (16:28 +0200)]
Rollup merge of #76060 - pickfire:patch-12, r=jyn514

Link vec doc to & reference

It is not always obvious that people could see the docs for `&`
especially for beginners, it also helps learnability.

3 years agoRollup merge of #75994 - mental32:impl-rc-new-cyclic, r=KodrAus
Dylan DPC [Sat, 5 Sep 2020 14:28:22 +0000 (16:28 +0200)]
Rollup merge of #75994 - mental32:impl-rc-new-cyclic, r=KodrAus

`impl Rc::new_cyclic`

References #75861

r? @Dylan-DPC

3 years agoRollup merge of #75954 - ArekPiekarz:unstable_book_ffi_tracking_issues, r=steveklabnik
Dylan DPC [Sat, 5 Sep 2020 14:28:20 +0000 (16:28 +0200)]
Rollup merge of #75954 - ArekPiekarz:unstable_book_ffi_tracking_issues, r=steveklabnik

Unstable Book: add links to tracking issues for FFI features

3 years agoRollup merge of #75741 - workingjubilee:refactor-byteorder, r=matthewjasper
Dylan DPC [Sat, 5 Sep 2020 14:28:17 +0000 (16:28 +0200)]
Rollup merge of #75741 - workingjubilee:refactor-byteorder, r=matthewjasper

Refactor byteorder to std in rustc_middle

Use std::io::{Read, Write} and {to, from}_{le, be}_bytes methods in
order to remove byteorder from librustc_middle's dependency graph.

3 years agoRollup merge of #75695 - JohnTitor:regression-test, r=Dylan-DPC
Dylan DPC [Sat, 5 Sep 2020 14:28:16 +0000 (16:28 +0200)]
Rollup merge of #75695 - JohnTitor:regression-test, r=Dylan-DPC

Add a regression test for issue-72793

Adds a regression test for #72793, which is fixed by #75443. Note that this won't close the issue as the snippet still shows ICE with `-Zmir-opt-level=2`. But it makes sense to add a test anyway.

3 years agoAdd compile_fail test for SyncOnceCell's dropck issue.
Mara Bos [Sat, 5 Sep 2020 13:55:20 +0000 (15:55 +0200)]
Add compile_fail test for SyncOnceCell's dropck issue.

3 years agoFix dropck issue of SyncOnceCell.
Mara Bos [Sat, 5 Sep 2020 12:09:33 +0000 (14:09 +0200)]
Fix dropck issue of SyncOnceCell.

Fixes #76367.

3 years agoAuto merge of #75584 - RalfJung:union-no-deref, r=matthewjasper
bors [Sat, 5 Sep 2020 11:47:01 +0000 (11:47 +0000)]
Auto merge of #75584 - RalfJung:union-no-deref, r=matthewjasper

do not apply DerefMut on union field

This implements the part of [RFC 2514](https://github.com/rust-lang/rfcs/blob/master/text/2514-union-initialization-and-drop.md) about `DerefMut`. Unlike described in the RFC, we only apply this warning specifically when doing `DerefMut` of a `ManuallyDrop` field; that is really the case we are worried about here.

@matthewjasper suggested I patch `convert_place_derefs_to_mutable` and `convert_place_op_to_mutable` for this, but I could not find anything to do in `convert_place_op_to_mutable` and this is sufficient to make the test pass. However, maybe there are some other cases this misses? I have no familiarity with this code.

This is a breaking change *in theory*, if someone used `ManuallyDrop<T>` in a union field and relied on automatic `DerefMut`. But on stable this means `T: Copy`, so the `ManuallyDrop` is rather pointless.

Cc https://github.com/rust-lang/rust/issues/55149

3 years agoUpdate llvm submodule
Mateusz Mikuła [Mon, 31 Aug 2020 12:42:26 +0000 (14:42 +0200)]
Update llvm submodule

3 years agoIgnore failing PGO/coverage tests on MinGW
Mateusz Mikuła [Mon, 24 Aug 2020 09:58:04 +0000 (11:58 +0200)]
Ignore failing PGO/coverage tests on MinGW

3 years agoAuto merge of #75888 - GuillaumeGomez:trait-impl-assoc-const-doc-alias, r=ollie27
bors [Sat, 5 Sep 2020 09:35:17 +0000 (09:35 +0000)]
Auto merge of #75888 - GuillaumeGomez:trait-impl-assoc-const-doc-alias, r=ollie27

Add check for doc alias on assoc const in trait impl

Fixes #73721.

r? @ollie27

3 years agoFix big endian read/write
Jubilee Young [Sat, 22 Aug 2020 10:54:15 +0000 (03:54 -0700)]
Fix big endian read/write

Co-authored-by: matthewjasper <mjjasper1@gmail.com>
3 years agoExplain contract of {read, write}_target_uint
Jubilee Young [Fri, 21 Aug 2020 07:55:33 +0000 (00:55 -0700)]
Explain contract of {read, write}_target_uint

3 years agoBe explicit that we're handling bytes
Jubilee [Thu, 20 Aug 2020 22:55:02 +0000 (15:55 -0700)]
Be explicit that we're handling bytes

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoRemove reference to byteorder limits
Jubilee Young [Thu, 20 Aug 2020 12:32:14 +0000 (05:32 -0700)]
Remove reference to byteorder limits

3 years agoRefactor byteorder to std in rustc_middle
Jubilee Young [Thu, 20 Aug 2020 09:37:00 +0000 (02:37 -0700)]
Refactor byteorder to std in rustc_middle

Use std::io::{Read, Write} and {to, from}_{le, be}_bytes methods in
order to remove byteorder from librustc_middle's dependency graph.

3 years agoAuto merge of #75173 - jackh726:chalk-0.21, r=nikomatsakis
bors [Sat, 5 Sep 2020 02:24:05 +0000 (02:24 +0000)]
Auto merge of #75173 - jackh726:chalk-0.21, r=nikomatsakis

Upgrade Chalk to 0.21

Two commits here. First commit actually does the upgrade. Second commit has some changes to make more tests in compare-mode=chalk pass.

The `PlaceholdersCollector` and `RegionsSubstitutor` bits are bit a hacky, but only insomuch as `ParamsSubstitutor` is. These won't be needed eventually.

r? @nikomatsakis

3 years agoIndent a note to make folding work nicer
Lzu Tao [Sat, 5 Sep 2020 02:17:22 +0000 (02:17 +0000)]
Indent a note to make folding work nicer

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoAdd `BREAK` too, and improve the comments
Scott McMurray [Fri, 4 Sep 2020 23:28:23 +0000 (16:28 -0700)]
Add `BREAK` too, and improve the comments

3 years agokind -> kind()
Jack Huey [Fri, 4 Sep 2020 23:17:57 +0000 (19:17 -0400)]
kind -> kind()

3 years agoAuto merge of #75200 - ssomers:btree_valmut, r=Mark-Simulacrum
bors [Fri, 4 Sep 2020 23:16:23 +0000 (23:16 +0000)]
Auto merge of #75200 - ssomers:btree_valmut, r=Mark-Simulacrum

 BTreeMap: introduce marker::ValMut and reserve Mut for unique access

The mutable BTreeMap iterators (apart from `DrainFilter`) are double-ended, meaning they have to rely on a front and a back handle that each represent a reference into the tree. Reserve a type category `marker::ValMut` for them, so that we guarantee that they cannot reach operations on handles with borrow type `marker::Mut`and that these operations can assume unique access to the tree.

Including #75195, benchmarks report no genuine change:
```
benchcmp old new --threshold 5
 name                                 old ns/iter  new ns/iter  diff ns/iter   diff %  speedup
 btree::map::iter_100                 3,333        3,023                -310   -9.30%   x 1.10
 btree::map::range_unbounded_vs_iter  36,624       31,569             -5,055  -13.80%   x 1.16
```

r? @Mark-Simulacrum

3 years agoBless changed test output
Jack Huey [Fri, 4 Sep 2020 05:51:57 +0000 (01:51 -0400)]
Bless changed test output

3 years agoReview comments
Jack Huey [Sat, 15 Aug 2020 22:04:11 +0000 (18:04 -0400)]
Review comments

3 years agoMore chalk work
Jack Huey [Wed, 5 Aug 2020 02:28:59 +0000 (22:28 -0400)]
More chalk work

3 years agoUpgrade chalk to 0.21
Jack Huey [Tue, 4 Aug 2020 22:35:37 +0000 (18:35 -0400)]
Upgrade chalk to 0.21

3 years agoAuto merge of #76292 - Aaron1011:fix/proc-macro-panic-hide, r=petrochenkov
bors [Fri, 4 Sep 2020 20:58:37 +0000 (20:58 +0000)]
Auto merge of #76292 - Aaron1011:fix/proc-macro-panic-hide, r=petrochenkov

Respect `-Z proc-macro-backtrace` flag for panics inside libproc_macro

Fixes #76270

Previously, any panic occuring during a call to a libproc_macro method
(e.g. calling `Ident::new` with an invalid identifier) would always
cause an ICE message to be printed.

3 years agoadd some intra-doc links to `Iterator`
Andy Russell [Fri, 4 Sep 2020 19:51:58 +0000 (15:51 -0400)]
add some intra-doc links to `Iterator`

3 years agoAuto merge of #76315 - lcnr:map-track-caller, r=Mark-Simulacrum
bors [Fri, 4 Sep 2020 19:05:20 +0000 (19:05 +0000)]
Auto merge of #76315 - lcnr:map-track-caller, r=Mark-Simulacrum

add `#[track_caller]` to `local_def_id_to_hir_id`

Improves one of the more frequent ICE

3 years agoAccount for version number in NtIdent hack
Aaron Hill [Fri, 4 Sep 2020 17:10:23 +0000 (13:10 -0400)]
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.

3 years agoAuto merge of #75077 - LeSeulArtichaut:tys-kind, r=nikomatsakis
bors [Fri, 4 Sep 2020 17:07:39 +0000 (17:07 +0000)]
Auto merge of #75077 - LeSeulArtichaut:tys-kind, r=nikomatsakis

Refractor ty.kind -> ty.kind() and ty.flags -> ty.flags()

First step for the ["shared library to represent Rust types"](https://rust-lang.github.io/compiler-team/minutes/design-meeting/2020-03-12-shared-library-for-types/) work (rust-lang/wg-traits#16).

This PR makes the `TyS::kind` field private and adds a `kind()` method to access it.
As noted [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/Looking.20to.20contribute/near/205185412), this refractoring might require a MCP. I am perfectly fine with having to wait until MCP is accepted and resolving the conflicts that pop up afterwards.

r? @nikomatsakis

3 years agoty.flags -> ty.flags()
LeSeulArtichaut [Thu, 6 Aug 2020 15:49:46 +0000 (17:49 +0200)]
ty.flags -> ty.flags()

3 years ago`ty.kind` -> `ty.kind()` in rustdoc and clippy
LeSeulArtichaut [Mon, 3 Aug 2020 22:18:29 +0000 (00:18 +0200)]
`ty.kind` -> `ty.kind()` in rustdoc and clippy

3 years agoChange ty.kind to a method
LeSeulArtichaut [Sun, 2 Aug 2020 22:49:11 +0000 (00:49 +0200)]
Change ty.kind to a method

3 years agoAuto merge of #75655 - nielx:fix/haiku-llvm-libz, r=Mark-Simulacrum
bors [Fri, 4 Sep 2020 14:32:33 +0000 (14:32 +0000)]
Auto merge of #75655 - nielx:fix/haiku-llvm-libz, r=Mark-Simulacrum

Disable zlib in LLVM on Haiku

PR #72696 enabled the option LLVM_ENABLE_ZLIB for the LLVM builds. Like NetBSD and aarch64-apple-darwin (see PR #75500), the LLVM build system not explicitly linking to libz on these platforms cause issues. For Haiku, this meant the runtime loader complaining about undefined symbols..

3 years agoImplementation of incompatible features error
Amjad Alsharafi [Thu, 3 Sep 2020 17:47:35 +0000 (01:47 +0800)]
Implementation of incompatible features error

If two features are defined as incompatible, using them together would
result in an error

3 years agoFix rust.use-lld when linker is not set
Mateusz Mikuła [Fri, 4 Sep 2020 13:20:13 +0000 (15:20 +0200)]
Fix rust.use-lld when linker is not set

3 years agoFix warning whe building profiler_builtins crate
Mateusz Mikuła [Mon, 24 Aug 2020 09:57:32 +0000 (11:57 +0200)]
Fix warning whe building profiler_builtins crate

3 years agoEnable profiler tests on Windows-gnu
Mateusz Mikuła [Wed, 5 Aug 2020 08:58:04 +0000 (10:58 +0200)]
Enable profiler tests on Windows-gnu

3 years agoMisc cleanup
Joshua Nelson [Sat, 29 Aug 2020 19:19:43 +0000 (15:19 -0400)]
Misc cleanup

- Preserve suffixes when displaying
- Rename test file to match `intra-link*`
- Remove unnecessary .clone()s
- Improve comments and naming
- Fix more bugs and add tests
- Escape intra-doc link example in public documentation

3 years agoAuto merge of #75207 - dylni:add-slice-check-range, r=KodrAus
bors [Fri, 4 Sep 2020 12:21:43 +0000 (12:21 +0000)]
Auto merge of #75207 - dylni:add-slice-check-range, r=KodrAus

Add `slice::check_range`

This method is useful for [`RangeBounds`] parameters. It's even been [rewritten](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/src/librustc_data_structures/sorted_map.rs#L214) [many](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/alloc/src/vec.rs#L1299) [times](https://github.com/rust-lang/rust/blob/22ee68dc586440f96b76b32fbd6087507c6afdb9/library/core/src/slice/mod.rs#L2441) in the standard library, sometimes assuming that the bounds won't be [`usize::MAX`].

For example, [`Vec::drain`] creates an empty iterator when [`usize::MAX`] is used as an inclusive end bound:

```rust
assert!(vec![1].drain(..=usize::max_value()).eq(iter::empty()));
```

If this PR is merged, I'll create another to use it for those methods.

[`RangeBounds`]: https://doc.rust-lang.org/std/ops/trait.RangeBounds.html
[`usize::MAX`]: https://doc.rust-lang.org/std/primitive.usize.html#associatedconstant.MAX
[`Vec::drain`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.drain

3 years agoMove Vec slice UI tests in library
Ayush Kumar Mishra [Fri, 4 Sep 2020 11:48:26 +0000 (17:18 +0530)]
Move Vec slice UI tests in library

3 years agoUse ops::ControlFlow in graph::iterate
Scott McMurray [Fri, 4 Sep 2020 07:59:41 +0000 (00:59 -0700)]
Use ops::ControlFlow in graph::iterate

3 years agoadd track_caller to `local_def_id_to_hir_id`
Bastian Kauschke [Fri, 4 Sep 2020 07:24:44 +0000 (09:24 +0200)]
add track_caller to `local_def_id_to_hir_id`

3 years agotime.rs: Make spelling of "Darwin" consistent
numbermaniac [Fri, 4 Sep 2020 04:21:52 +0000 (14:21 +1000)]
time.rs: Make spelling of "Darwin" consistent

3 years agoRemove a useless allowed attr
Lzu Tao [Fri, 4 Sep 2020 02:42:50 +0000 (02:42 +0000)]
Remove a useless allowed attr

3 years agoAdd slice primitive link to vec
Ivan Tham [Fri, 4 Sep 2020 01:50:50 +0000 (09:50 +0800)]
Add slice primitive link to vec

3 years agoAuto merge of #76004 - richkadel:llvm-coverage-map-gen-6b.5, r=tmandry
bors [Fri, 4 Sep 2020 01:31:07 +0000 (01:31 +0000)]
Auto merge of #76004 - richkadel:llvm-coverage-map-gen-6b.5, r=tmandry

Tools, tests, and experimenting with MIR-derived coverage counters

Leverages the new mir_dump output file in HTML+CSS (from #76074) to visualize coverage code regions
and the MIR features that they came from (including overlapping spans).

See example below.

The `run-make-fulldeps/instrument-coverage` test has been refactored to maximize test coverage and reduce code duplication. The new tests support testing with and without `-Clink-dead-code`, so Rust coverage can be tested on MSVC (which, currently, only works with `link-dead-code` _disabled_).

New tests validate coverage region generation and coverage reports with multiple counters per function. Starting with a simple `if-else` branch tests, coverage tests for each additional syntax type can be added by simply dropping in a new Rust sample program.

Includes a basic, MIR-block-based implementation of coverage injection,
available via `-Zexperimental-coverage`. This implementation has known
flaws and omissions, but is simple enough to validate the new tools and
tests.

The existing `-Zinstrument-coverage` option currently enables
function-level coverage only, which at least appears to generate
accurate coverage reports at that level.

Experimental coverage is not accurate at this time. When branch coverage
works as intended, the `-Zexperimental-coverage` option should be
removed.

This PR replaces the bulk of PR #75828, with the remaining parts of
that PR distributed among other separate and indentpent PRs.

This PR depends on two of those other PRs: #76002, #76003 and #76074

Rust compiler MCP rust-lang/compiler-team#278

Relevant issue: #34701 - Implement support for LLVMs code coverage
instrumentation

![Screen-Recording-2020-08-21-at-2](https://user-images.githubusercontent.com/3827298/90972923-ff417880-e4d1-11ea-92bb-8713c6198f6d.gif)

r? @tmandry
FYI: @wesleywiser

3 years agoDisable use of `--eh-frame-hdr` on wasm32.
Dan Gohman [Fri, 4 Sep 2020 00:49:09 +0000 (17:49 -0700)]
Disable use of `--eh-frame-hdr` on wasm32.

3 years agoMove various ui const tests to `library`
Christiaan Dirkx [Fri, 4 Sep 2020 00:35:27 +0000 (02:35 +0200)]
Move various ui const tests to `library`

Move:
 - `src\test\ui\consts\const-nonzero.rs` to `library\core`
 - `src\test\ui\consts\ascii.rs` to `library\core`
 - `src\test\ui\consts\cow-is-borrowed` to `library\alloc`

Part of #76268

3 years agoinliner: Add mir-opt tests for codegen attributes compatibility
Tomasz Miąsko [Fri, 4 Sep 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Add mir-opt tests for codegen attributes compatibility

3 years agoinliner: Check for no_sanitize attribute compatibility
Tomasz Miąsko [Thu, 3 Sep 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Check for no_sanitize attribute compatibility

3 years agoinliner: Check for target features compatibility
Tomasz Miąsko [Thu, 3 Sep 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Check for target features compatibility

3 years agoAuto merge of #73996 - da-x:short-unique-paths, r=petrochenkov
bors [Thu, 3 Sep 2020 23:27:45 +0000 (23:27 +0000)]
Auto merge of #73996 - da-x:short-unique-paths, r=petrochenkov

diagnostics: shorten paths of unique symbols

This is a step towards implementing a fix for #50310, and continuation of the discussion in [Pre-RFC: Nicer Types In Diagnostics - compiler - Rust Internals](https://internals.rust-lang.org/t/pre-rfc-nicer-types-in-diagnostics/11139). Impressed upon me from previous discussion in #21934 that an RFC for this is not needed, and I should just come up with code.

The recent improvements to `use` suggestions that I've contributed have given rise to this implementation. Contrary to previous suggestions, it's rather simple logic, and I believe it only reduces the amount of cognitive load that a developer would need when reading type errors.

-----

If a symbol name can only be imported from one place, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path to the last component.

This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable from anywhere.

3 years agoLink to `#capacity-and-reallocation` when using with_capacity
Joshua Nelson [Thu, 3 Sep 2020 22:08:25 +0000 (18:08 -0400)]
Link to `#capacity-and-reallocation` when using with_capacity

3 years agoAddress review comments on `Peekable::next_if`
Joshua Nelson [Thu, 3 Sep 2020 22:03:33 +0000 (18:03 -0400)]
Address review comments on `Peekable::next_if`

3 years agoOptimize Cursor::look_ahead
Aleksey Kladov [Thu, 3 Sep 2020 21:26:59 +0000 (23:26 +0200)]
Optimize Cursor::look_ahead

Cloning a tt is cheap, but not free (there's Arc inside).

3 years agoAuto merge of #70793 - the8472:in-place-iter-collect, r=Amanieu
bors [Thu, 3 Sep 2020 21:20:21 +0000 (21:20 +0000)]
Auto merge of #70793 - the8472:in-place-iter-collect, r=Amanieu

specialize some collection and iterator operations to run in-place

This is a rebase and update of #66383 which was closed due inactivity.

Recent rustc changes made the compile time regressions disappear, at least for webrender-wrench. Running a stage2 compile and the rustc-perf suite takes hours on the hardware I have at the moment, so I can't do much more than that.

![Screenshot_2020-04-05 rustc performance data](https://user-images.githubusercontent.com/1065730/78462657-5d60f100-76d4-11ea-8a0b-4f3962707c38.png)

In the best case of the `vec::bench_in_place_recycle` synthetic microbenchmark these optimizations can provide a 15x speedup over the regular implementation which allocates a new vec for every benchmark iteration. [Benchmark results](https://gist.github.com/the8472/6d999b2d08a2bedf3b93f12112f96e2f). In real code the speedups are tiny, but it also depends on the allocator used, a system allocator that uses a process-wide mutex will benefit more than one with thread-local pools.

## What was changed

* `SpecExtend` which covered `from_iter` and `extend` specializations was split into separate traits
* `extend` and `from_iter` now reuse the `append_elements` if passed iterators are from slices.
* A preexisting `vec.into_iter().collect::<Vec<_>>()` optimization that passed through the original vec has been generalized further to also cover cases where the original has been partially drained.
* A chain of *Vec<T> / BinaryHeap<T> / Box<[T]>* `IntoIter`s  through various iterator adapters collected into *Vec<U>* and *BinaryHeap<U>* will be performed in place as long as `T` and `U` have the same alignment and size and aren't ZSTs.
* To enable above specialization the unsafe, unstable `SourceIter` and `InPlaceIterable` traits have been added. The first allows reaching through the iterator pipeline to grab a pointer to the source memory. The latter is a marker that promises that the read pointer will advance as fast or faster than the write pointer and thus in-place operation is possible in the first place.
* `vec::IntoIter` implements `TrustedRandomAccess` for `T: Copy` to allow in-place collection when there is a `Zip` adapter in the iterator. TRA had to be made an unstable public trait to support this.

## In-place collectible adapters

* `Map`
* `MapWhile`
* `Filter`
* `FilterMap`
* `Fuse`
* `Skip`
* `SkipWhile`
* `Take`
* `TakeWhile`
* `Enumerate`
* `Zip` (left hand side only, `Copy` types only)
* `Peek`
* `Scan`
* `Inspect`

## Concerns

`vec.into_iter().filter(|_| false).collect()` will no longer return a vec with 0 capacity, instead it will return its original allocation. This avoids the cost of doing any allocation or deallocation but could lead to large allocations living longer than expected.
If that's not acceptable some resizing policy at the end of the attempted in-place collect would be necessary, which in the worst case could result in one more memcopy than the non-specialized case.

## Possible followup work

* split liballoc/vec.rs to remove `ignore-tidy-filelength`
* try to get trivial chains such as `vec.into_iter().skip(1).collect::<Vec<)>>()` to compile to a `memmove` (currently compiles to a pile of SIMD, see #69187 )
* improve up the traits so they can be reused by other crates, e.g. itertools. I think currently they're only good enough for internal use
* allow iterators sourced from a `HashSet` to be in-place collected into a `Vec`