]> git.lizzy.rs Git - rust.git/log
rust.git
17 months agoRollup merge of #106640 - lcnr:update-test, r=jackh726
Yuki Okushi [Mon, 9 Jan 2023 23:05:36 +0000 (08:05 +0900)]
Rollup merge of #106640 - lcnr:update-test, r=jackh726

update test for inductive canonical cycles

the previous test always resulted in a cycle :sweat_smile: cc https://github.com/rust-lang/chalk/pull/787.

I checked with #102713 and this is the only test which fails with that PR.

r? ``@jackh726``

17 months agoRollup merge of #106639 - RalfJung:miri, r=RalfJung
Yuki Okushi [Mon, 9 Jan 2023 23:05:36 +0000 (08:05 +0900)]
Rollup merge of #106639 - RalfJung:miri, r=RalfJung

update Miri

Notable PRs:
- https://github.com/rust-lang/miri/pull/2748
- https://github.com/rust-lang/miri/pull/2752

r? `@ghost`

17 months agoRollup merge of #106636 - djkoloski:accept_old_fuchsia_triple, r=tmandry
Yuki Okushi [Mon, 9 Jan 2023 23:05:35 +0000 (08:05 +0900)]
Rollup merge of #106636 - djkoloski:accept_old_fuchsia_triple, r=tmandry

Accept old spelling of Fuchsia target triples

The old spelling of Fuchsia target triples was changed in #106429 to add a proper vendor. Because the old spelling is widely used, some projects may need time to migrate their uses to the new triple spelling. The old spelling may eventually be removed altogether.

r? ``@tmandry``

17 months agoRollup merge of #106387 - jyn514:clippy, r=Mark-Simulacrum
Yuki Okushi [Mon, 9 Jan 2023 23:05:35 +0000 (08:05 +0900)]
Rollup merge of #106387 - jyn514:clippy, r=Mark-Simulacrum

Revert "bootstrap: Get rid of `tail_args` in `stream_cargo`"

This reverts commit 9dfe50440e6d48bd2fd40a4b7b3992998e55eace. (Note: that merged as part of https://github.com/rust-lang/rust/pull/106305, but https://github.com/rust-lang/rust/pull/106305/ contains more commits than just 9dfe50440e6d48bd2fd40a4b7b3992998e55eace.)

Fixes `x clippy`. It turns out `clippy` was the only one using `tail_args` 🤦 sorry for not testing this earlier.

r? `@Mark-Simulacrum`

17 months agoRollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obk
Yuki Okushi [Mon, 9 Jan 2023 23:05:34 +0000 (08:05 +0900)]
Rollup merge of #106204 - compiler-errors:no-take-opaques-in-compare, r=oli-obk

No need to take opaques in `check_type_bounds`

`InferCtxt` already has its defining use anchor set to err

r? ``@oli-obk``

17 months agoRollup merge of #106175 - compiler-errors:bad-import-sugg, r=oli-obk
Yuki Okushi [Mon, 9 Jan 2023 23:05:34 +0000 (08:05 +0900)]
Rollup merge of #106175 - compiler-errors:bad-import-sugg, r=oli-obk

Fix bad import suggestion with nested `use` tree

Fixes #105566
Fixes #105373

Ideally, we'd find some way to turn these into structured suggestions -- perhaps on a separate line as a different `use` statement, but I have no idea how to access the span for the whole `use` from this point in the import resolution code.

17 months agoRollup merge of #105708 - tomerze:enable-atomic-cas-bpf, r=nagisa
Yuki Okushi [Mon, 9 Jan 2023 23:05:33 +0000 (08:05 +0900)]
Rollup merge of #105708 - tomerze:enable-atomic-cas-bpf, r=nagisa

Enable atomic cas for bpf targets

It seems like LLVM now supports it.

https://reviews.llvm.org/D72184 - the PR in LLVM

17 months agoRollup merge of #105034 - HintringerFabian:improve_iterator_flatten_doc, r=cuviper
Yuki Okushi [Mon, 9 Jan 2023 23:05:32 +0000 (08:05 +0900)]
Rollup merge of #105034 - HintringerFabian:improve_iterator_flatten_doc, r=cuviper

Add example for iterator_flatten

Adds an Example to iterator_flatten
Fixes #82687

17 months agoAdd issue number to FIXMEs
Tyler Mandry [Mon, 9 Jan 2023 18:23:50 +0000 (13:23 -0500)]
Add issue number to FIXMEs

17 months agoAuto merge of #106637 - fee1-dead-contrib:rollup-ticvmsd, r=fee1-dead
bors [Mon, 9 Jan 2023 18:20:00 +0000 (18:20 +0000)]
Auto merge of #106637 - fee1-dead-contrib:rollup-ticvmsd, r=fee1-dead

Rollup of 10 pull requests

Successful merges:

 - #105292 (Change a commit_if_ok call to probe)
 - #105655 (Remove invalid case for mutable borrow suggestion)
 - #106047 (Fix ui constant tests for big-endian platforms)
 - #106061 (Enable Shadow Call Stack for Fuchsia on AArch64)
 - #106164 (Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`)
 - #106291 (Fix incorrect suggestion for extra `&` in pattern)
 - #106389 (Simplify some canonical type alias names)
 - #106468 (Use FxIndexSet when updating obligation causes in `adjust_fulfillment_errors_for_expr_obligation`)
 - #106549 (Use fmt named parameters in rustc_borrowck)
 - #106614 (error-code docs improvements (No. 2))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoAssert defining anchor is set in take_opaque_types
Michael Goulet [Mon, 9 Jan 2023 18:14:28 +0000 (18:14 +0000)]
Assert defining anchor is set in take_opaque_types

17 months agoreview comment
Michael Goulet [Mon, 9 Jan 2023 18:07:34 +0000 (18:07 +0000)]
review comment

17 months agoNo need to take opaques in check_type_bounds
Michael Goulet [Sat, 24 Dec 2022 21:30:15 +0000 (21:30 +0000)]
No need to take opaques in check_type_bounds

17 months agoAccept old spelling of Fuchsia target triples
David Koloski [Mon, 9 Jan 2023 15:22:08 +0000 (10:22 -0500)]
Accept old spelling of Fuchsia target triples

Because the old spelling is widely used, some projects may need time to
migrate their uses to the new triple spelling. The old spelling may
eventually be removed altogether.

17 months agoupdate test for inductive canonical cycles
lcnr [Mon, 9 Jan 2023 16:13:14 +0000 (17:13 +0100)]
update test for inductive canonical cycles

17 months agoAuto merge of #2755 - RalfJung:dtors_in_dtors_in_dtors, r=RalfJung
bors [Mon, 9 Jan 2023 15:36:18 +0000 (15:36 +0000)]
Auto merge of #2755 - RalfJung:dtors_in_dtors_in_dtors, r=RalfJung

add dtors_in_dtors_in_dtors

That's a pretty neat test from the standard library. Sadly not enough to check for https://github.com/rust-lang/miri/issues/2754, but still worth having here.

17 months agoRollup merge of #106614 - Ezrashaw:ui-test-fixups-2, r=GuillaumeGomez
fee1-dead [Mon, 9 Jan 2023 15:35:32 +0000 (23:35 +0800)]
Rollup merge of #106614 - Ezrashaw:ui-test-fixups-2, r=GuillaumeGomez

error-code docs improvements (No. 2)

- Added empty error-code docs for `E0208`, `E0640` and `E0717` with the "internal" header as discussed on Discord.
- Wrote docs and UI test for `E0711`, again with the header.
- `tidy` changes are common-sense and make everything pass, `style.rs` hack is annoying though.

r? ```@GuillaumeGomez```

17 months agoRollup merge of #106549 - wcampbell0x2a:use-fmt-named-parameters-borrowck, r=estebank
fee1-dead [Mon, 9 Jan 2023 15:35:31 +0000 (23:35 +0800)]
Rollup merge of #106549 - wcampbell0x2a:use-fmt-named-parameters-borrowck, r=estebank

Use fmt named parameters in rustc_borrowck

17 months agoRollup merge of #106468 - compiler-errors:err-instability, r=lcnr
fee1-dead [Mon, 9 Jan 2023 15:35:31 +0000 (23:35 +0800)]
Rollup merge of #106468 - compiler-errors:err-instability, r=lcnr

Use FxIndexSet when updating obligation causes in `adjust_fulfillment_errors_for_expr_obligation`

I have no idea how to test this reliably, but I've **manually** verified it fixes the instability in #106417 that isn't due to dtolnay/trybuild#212.

Fixes #106417

17 months agoRollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnr
fee1-dead [Mon, 9 Jan 2023 15:35:30 +0000 (23:35 +0800)]
Rollup merge of #106389 - compiler-errors:no-canonicalized, r=lcnr

Simplify some canonical type alias names

* delete the `Canonicalized<'tcx>` type alias in favor for `Canonical<'tcx>`
* `CanonicalizedQueryResponse` -> `CanonicalQueryResponse`

I don't particularly care about the latter, but it should be consistent. We could alternatively delete the first alias and rename the struct to `Canonicalized`, and then keep the name of `CanonicalizedQueryResponse` untouched.

17 months agoRollup merge of #106291 - obeis:issue-106182, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:29 +0000 (23:35 +0800)]
Rollup merge of #106291 - obeis:issue-106182, r=oli-obk

Fix incorrect suggestion for extra `&` in pattern

Closes #106182

17 months agoRollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:29 +0000 (23:35 +0800)]
Rollup merge of #106164 - compiler-errors:check-region-tweak, r=oli-obk

Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`

Makes sense for this function to live with its sibling `resolve_regions_and_report_errors`, around which it's basically just a wrapper.

17 months agoRollup merge of #106061 - ilovepi:fuchsia-scs, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:28 +0000 (23:35 +0800)]
Rollup merge of #106061 - ilovepi:fuchsia-scs, r=oli-obk

Enable Shadow Call Stack for Fuchsia on AArch64

Fuchsia already uses SCS by default for C/C++ code on ARM hardware. This patch allows SCS to be used for Rust code as well.

17 months agoRollup merge of #106047 - uweigand:s390x-test-bigendian-ui, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:27 +0000 (23:35 +0800)]
Rollup merge of #106047 - uweigand:s390x-test-bigendian-ui, r=oli-obk

Fix ui constant tests for big-endian platforms

A number of tests under ui/const-ptr and ui/consts are currently failing on big-endian platforms as the binary encoding of some constants is hard-coded in the stderr test files.

Fix this by a combination of two types of changes:

- Where possible (i.e. where the particular value of a constant does not affect the purpose of the test), choose constant values that have the same encoding on big- and little-endian platforms.

- Where this is not possible, provide a normalize-stderr-test rule that transforms the printed big-endian encoding of such constants into the corresponding little-endian form.

Fixes part of https://github.com/rust-lang/rust/issues/105383.

17 months agoRollup merge of #105655 - RedDocMD:bug-105645, r=oli-obk
fee1-dead [Mon, 9 Jan 2023 15:35:27 +0000 (23:35 +0800)]
Rollup merge of #105655 - RedDocMD:bug-105645, r=oli-obk

Remove invalid case for mutable borrow suggestion

If we have a call such as `foo(&mut buf)` and after reference
collapsing the type is inferred as `&T` where-as the required type is
`&mut T`, don't suggest `foo(&mut mut buf)`. This is wrong syntactically
and the issue lies elsewhere, not in the borrow.

Fixes #105645

17 months agoRollup merge of #105292 - JulianKnodt:no_eager_commit, r=BoxyUwU
fee1-dead [Mon, 9 Jan 2023 15:35:26 +0000 (23:35 +0800)]
Rollup merge of #105292 - JulianKnodt:no_eager_commit, r=BoxyUwU

Change a commit_if_ok call to probe

Removes an over-eager `commit_if_ok` which makes inference worse.

I'm not entirely sure whether it's ok to remove the check that types are the same, because casting seems to cause equality checks with incorrect types?

Fixes #105037

r? ```@BoxyUwU```

17 months agoadd dtors_in_dtors_in_dtors
Ralf Jung [Mon, 9 Jan 2023 15:35:16 +0000 (16:35 +0100)]
add dtors_in_dtors_in_dtors

17 months agoAuto merge of #101947 - aliemjay:astconv-normalize, r=lcnr
bors [Mon, 9 Jan 2023 15:29:59 +0000 (15:29 +0000)]
Auto merge of #101947 - aliemjay:astconv-normalize, r=lcnr

Don't normalize in AstConv

See individual commits.

Fixes #101350
Fixes #54940

17 months agoAuto merge of #2753 - RalfJung:rustup, r=RalfJung
bors [Mon, 9 Jan 2023 13:13:35 +0000 (13:13 +0000)]
Auto merge of #2753 - RalfJung:rustup, r=RalfJung

Rustup

Pulls in https://github.com/rust-lang/rust/pull/104658

17 months agoMerge from rustc
Ralf Jung [Mon, 9 Jan 2023 12:49:07 +0000 (13:49 +0100)]
Merge from rustc

17 months agoPreparing for merge from rustc
Ralf Jung [Mon, 9 Jan 2023 12:48:31 +0000 (13:48 +0100)]
Preparing for merge from rustc

17 months agoAuto merge of #2752 - RalfJung:win-env-current-exe, r=RalfJung
bors [Mon, 9 Jan 2023 12:47:38 +0000 (12:47 +0000)]
Auto merge of #2752 - RalfJung:win-env-current-exe, r=RalfJung

make env::current_exe work on Windows

17 months agomake env::current_exe work on Windows
Ralf Jung [Mon, 9 Jan 2023 12:43:06 +0000 (13:43 +0100)]
make env::current_exe work on Windows

17 months agoRelocate changes
Fabian Hintringer [Mon, 9 Jan 2023 12:19:41 +0000 (13:19 +0100)]
Relocate changes

17 months agoAuto merge of #106340 - saethlin:propagate-operands, r=oli-obk
bors [Mon, 9 Jan 2023 11:59:51 +0000 (11:59 +0000)]
Auto merge of #106340 - saethlin:propagate-operands, r=oli-obk

Always permit ConstProp to exploit arithmetic identities

Fixes https://github.com/rust-lang/rust/issues/72751

Initially, I thought I would need to enable operand propagation then do something else, but actually https://github.com/rust-lang/rust/pull/74491 already has the fix for the issue in question! It looks like this optimization was put under MIR opt level 3 due to possible soundness/stability implications, then demoted further to MIR opt level 4 when MIR opt level 2 became associated with `--release`.

Perhaps in the past we were doing CTFE on optimized MIR? We aren't anymore, so this optimization has no stability implications.

r? `@oli-obk`

17 months agoAuto merge of #2750 - rust-lang:dependabot/cargo/test_dependencies/tokio-1.23.1,...
bors [Mon, 9 Jan 2023 10:29:57 +0000 (10:29 +0000)]
Auto merge of #2750 - rust-lang:dependabot/cargo/test_dependencies/tokio-1.23.1, r=oli-obk

Bump tokio from 1.23.0 to 1.23.1 in /test_dependencies

Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.23.0 to 1.23.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/tokio-rs/tokio/releases">tokio's releases</a>.</em></p>
<blockquote>
<h2>Tokio v1.23.1</h2>
<p>This release forward ports changes from 1.18.4.</p>
<h3>Fixed</h3>
<ul>
<li>net: fix Windows named pipe server builder to maintain option when toggling
pipe mode (<a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/5336">#5336</a>).</li>
</ul>
<p><a href="https://github-redirect.dependabot.com/tokio-rs/tokio/issues/5336">#5336</a>: <a href="https://github-redirect.dependabot.com/tokio-rs/tokio/pull/5336">tokio-rs/tokio#5336</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/tokio-rs/tokio/commit/1a997ffbd62334af2553775234e75ede2d7d949f"><code>1a997ff</code></a> chore: prepare Tokio v1.23.1 release</li>
<li><a href="https://github.com/tokio-rs/tokio/commit/a8fe333cc45c14b0566d450dff8ff85fbe974fa0"><code>a8fe333</code></a> Merge branch 'tokio-1.20.x' into tokio-1.23.x</li>
<li><a href="https://github.com/tokio-rs/tokio/commit/ba81945ffc2695b71f2bbcadbfb5e46ec55aaef3"><code>ba81945</code></a> chore: prepare Tokio 1.20.3 release</li>
<li><a href="https://github.com/tokio-rs/tokio/commit/763bdc967e3e128d1e6e000238f1d257a81bf59a"><code>763bdc9</code></a> ci: run WASI tasks using latest Rust</li>
<li><a href="https://github.com/tokio-rs/tokio/commit/9f98535877f8f706b436447952f40f153e2a52dc"><code>9f98535</code></a> Merge remote-tracking branch 'origin/tokio-1.18.x' into fix-named-pipes-1.20</li>
<li><a href="https://github.com/tokio-rs/tokio/commit/9241c3eddf4a6a218681b088d71f7191513e2376"><code>9241c3e</code></a> chore: prepare Tokio v1.18.4 release</li>
<li><a href="https://github.com/tokio-rs/tokio/commit/699573d550fabf4bfb45d82505d6709faaae9037"><code>699573d</code></a> net: fix named pipes server configuration builder</li>
<li>See full diff in <a href="https://github.com/tokio-rs/tokio/compare/tokio-1.23.0...tokio-1.23.1">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tokio&package-manager=cargo&previous-version=1.23.0&new-version=1.23.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` use these labels` will set the current labels as the default for future PRs for this repo and language
- ``@dependabot` use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- ``@dependabot` use these assignees` will set the current assignees as the default for future PRs for this repo and language
- ``@dependabot` use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-lang/miri/network/alerts).

</details>

17 months agoClean up
kadmin [Wed, 21 Dec 2022 21:53:52 +0000 (21:53 +0000)]
Clean up

Simplify match statement

Add multiple tests
- 1 test for checking `N + 1 + 1` does not unify with `N+1`
- 2 tests for checking that a function that uses two parameters only returns the parameter that
  is actually used.
- Check exact repeat predicates

17 months agoCheck for duplicates
kadmin [Tue, 20 Dec 2022 21:11:19 +0000 (21:11 +0000)]
Check for duplicates

17 months agoSet !const_evaluatable if ambig. and not inferred
kadmin [Tue, 20 Dec 2022 03:36:32 +0000 (03:36 +0000)]
Set !const_evaluatable if ambig. and not inferred

This prevents an ICE due to a value not actually being evaluatable later.

17 months agoChange based on comments
kadmin [Tue, 13 Dec 2022 09:51:13 +0000 (09:51 +0000)]
Change based on comments

Instead of just switching to a probe, check for different matches, and see how many there are.
If one, unify it, otherwise return true and let it be unified later.

17 months agoChange commit_if_ok to probe
kadmin [Sun, 4 Dec 2022 19:58:03 +0000 (19:58 +0000)]
Change commit_if_ok to probe

17 months agoAuto merge of #106582 - compiler-errors:better-spans-on-bad-tys, r=lcnr
bors [Mon, 9 Jan 2023 08:40:08 +0000 (08:40 +0000)]
Auto merge of #106582 - compiler-errors:better-spans-on-bad-tys, r=lcnr

Improve spans of non-WF implied bound types

Fixes #60980

17 months agoAuto merge of #106616 - compiler-errors:rollup-emcj0o3, r=compiler-errors
bors [Mon, 9 Jan 2023 05:09:45 +0000 (05:09 +0000)]
Auto merge of #106616 - compiler-errors:rollup-emcj0o3, r=compiler-errors

Rollup of 8 pull requests

Successful merges:

 - #104163 (Don't derive Debug for `OnceWith` & `RepeatWith`)
 - #106131 (Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible)
 - #106363 (Structured suggestion for `&mut dyn Iterator` when possible)
 - #106497 (Suggest using clone when we have &T and T implemented Clone)
 - #106584 (Document that `Vec::from_raw_parts[_in]` must be given a pointer from the correct allocator.)
 - #106600 (Suppress type errors that come from private fields)
 - #106602 (Add goml scripts to tidy checks)
 - #106606 (Do not emit structured suggestion for turbofish with wrong span)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agofix: fix CI errors
Ezra Shaw [Mon, 9 Jan 2023 02:44:33 +0000 (15:44 +1300)]
fix: fix CI errors

17 months agoRollup merge of #106606 - estebank:bad-nested-turbofish, r=compiler-errors
Michael Goulet [Mon, 9 Jan 2023 03:57:56 +0000 (19:57 -0800)]
Rollup merge of #106606 - estebank:bad-nested-turbofish, r=compiler-errors

Do not emit structured suggestion for turbofish with wrong span

Fix #79161.

17 months agoRollup merge of #106602 - GuillaumeGomez:tidy-goml-scripts, r=Mark-Simulacrum
Michael Goulet [Mon, 9 Jan 2023 03:57:56 +0000 (19:57 -0800)]
Rollup merge of #106602 - GuillaumeGomez:tidy-goml-scripts, r=Mark-Simulacrum

Add goml scripts to tidy checks

r? ``@notriddle``

17 months agoRollup merge of #106600 - compiler-errors:no-private-field-ty-err, r=estebank
Michael Goulet [Mon, 9 Jan 2023 03:57:55 +0000 (19:57 -0800)]
Rollup merge of #106600 - compiler-errors:no-private-field-ty-err, r=estebank

Suppress type errors that come from private fields

Fixes #57320

There was some discussion here (https://github.com/rust-lang/rust/issues/57320#issuecomment-451308420), but I honestly think the second error is worth suppressing regardless.

I would be open to feedback though -- perhaps we can suppress the `.len()` suggestion if there's type error (since we have access to [`Expectation`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_typeck/enum.Expectation.html), we can determine that).

r? ``@estebank``

17 months agoRollup merge of #106584 - kpreid:vec-allocator, r=JohnTitor
Michael Goulet [Mon, 9 Jan 2023 03:57:54 +0000 (19:57 -0800)]
Rollup merge of #106584 - kpreid:vec-allocator, r=JohnTitor

Document that `Vec::from_raw_parts[_in]` must be given a pointer from the correct allocator.

Currently, the documentation of `Vec::from_raw_parts` and `Vec::from_raw_parts_in` says nothing about what allocator the pointer must come from. This PR adds that missing information explicitly.

17 months agoRollup merge of #106497 - chenyukang:yukang/fix-106443-sugg-clone, r=estebank
Michael Goulet [Mon, 9 Jan 2023 03:57:54 +0000 (19:57 -0800)]
Rollup merge of #106497 - chenyukang:yukang/fix-106443-sugg-clone, r=estebank

Suggest using clone when we have &T and T implemented Clone

Fixes #106443

17 months agoRollup merge of #106363 - estebank:mutability-mismatch-arg, r=Nilstrieb
Michael Goulet [Mon, 9 Jan 2023 03:57:53 +0000 (19:57 -0800)]
Rollup merge of #106363 - estebank:mutability-mismatch-arg, r=Nilstrieb

Structured suggestion for `&mut dyn Iterator` when possible

Fix #37914.

17 months agoRollup merge of #106131 - compiler-errors:not-ptrs, r=davidtwco
Michael Goulet [Mon, 9 Jan 2023 03:57:53 +0000 (19:57 -0800)]
Rollup merge of #106131 - compiler-errors:not-ptrs, r=davidtwco

Mention "signature" rather than "fn pointer" when impl/trait methods are incompatible

Fixes #80929
Fixes #67296

17 months agoRollup merge of #104163 - H4x5:once-repeat-with-debug, r=dtolnay
Michael Goulet [Mon, 9 Jan 2023 03:57:52 +0000 (19:57 -0800)]
Rollup merge of #104163 - H4x5:once-repeat-with-debug, r=dtolnay

Don't derive Debug for `OnceWith` & `RepeatWith`

Closures don't impl Debug, so the derived impl is kinda useless. The behavior of not debug-printing closures is consistent with the rest of the iterator adapters/sources.

17 months agodocs/test: add error-docs and UI test for `E0711`
Ezra Shaw [Sun, 8 Jan 2023 08:36:19 +0000 (21:36 +1300)]
docs/test: add error-docs and UI test for `E0711`

17 months agodocs/test: add empty error-docs for `E0208`, `E0640` and `E0717`
Ezra Shaw [Sun, 8 Jan 2023 08:35:50 +0000 (21:35 +1300)]
docs/test: add empty error-docs for `E0208`, `E0640` and `E0717`

17 months agoAuto merge of #90291 - geeklint:loosen_weak_debug_bound, r=dtolnay
bors [Sun, 8 Jan 2023 22:40:38 +0000 (22:40 +0000)]
Auto merge of #90291 - geeklint:loosen_weak_debug_bound, r=dtolnay

Loosen the bound on the Debug implementation of Weak.

Both `rc::Weak<T>` and `sync::Weak<T>` currently require `T: Debug` in their own `Debug` implementations, but they don't currently use it;  they only ever print a fixed string.

A general implementation of Debug for Weak that actually attempts to upgrade and rely on the contents is unlikely in the future because it may have unbounded recursion in the presence of reference cycles, which Weak is commonly used in.  (This was the justification for why the current implementation [was implemented the way it is](https://github.com/rust-lang/rust/pull/19388/commits/f0976e2cf3f6b0027f118b791e0888b29fbb41a7)).

When I brought it up [on the forum](https://internals.rust-lang.org/t/could-the-bound-on-weak-debug-be-relaxed/15504), it was suggested that, even if an implementation is specialized in the future that relies on the data stored within the Weak, it would likely rely on specialization anyway, and could therefore easily specialize on the Debug bound as well.

17 months agoDo not emit structured suggestion for turbofish with wrong span
Esteban Küber [Sun, 8 Jan 2023 22:27:13 +0000 (22:27 +0000)]
Do not emit structured suggestion for turbofish with wrong span

Fix #79161.

17 months agoFix tidy issues in goml scripts
Guillaume Gomez [Sun, 8 Jan 2023 20:29:57 +0000 (21:29 +0100)]
Fix tidy issues in goml scripts

17 months agoAdd goml scripts to tidy checks
Guillaume Gomez [Sun, 8 Jan 2023 20:29:45 +0000 (21:29 +0100)]
Add goml scripts to tidy checks

17 months agoSuppress type errors that come from private fields
Michael Goulet [Sun, 8 Jan 2023 19:45:23 +0000 (19:45 +0000)]
Suppress type errors that come from private fields

17 months agoDon't store spans in assumed_wf_types actually
Michael Goulet [Sun, 8 Jan 2023 19:02:58 +0000 (19:02 +0000)]
Don't store spans in assumed_wf_types actually

17 months agoNormalize assumed_wf_types after wfchecking is complete, for better spans
Michael Goulet [Sun, 8 Jan 2023 03:14:27 +0000 (03:14 +0000)]
Normalize assumed_wf_types after wfchecking is complete, for better spans

17 months agoImprove spans of non-WF implied bound types
Michael Goulet [Sun, 8 Jan 2023 02:40:59 +0000 (02:40 +0000)]
Improve spans of non-WF implied bound types

17 months agoAuto merge of #106449 - GuillaumeGomez:rustdoc-gui-retry-mechanism, r=Mark-Simulacrum
bors [Sun, 8 Jan 2023 17:49:31 +0000 (17:49 +0000)]
Auto merge of #106449 - GuillaumeGomez:rustdoc-gui-retry-mechanism, r=Mark-Simulacrum

Add retry mechanism for rustdoc GUI tests to reduce flakyness

Part of #93784.

I added 3 retries for failing GUI tests. An important note: if more than half of total tests fail, I don't retry because it's very likely not flakyness anymore at this point but a missing update after changes.

17 months agoRemove extra space
Yukang [Sun, 8 Jan 2023 14:51:42 +0000 (22:51 +0800)]
Remove extra space

17 months agoAuto merge of #106235 - compiler-errors:rework-bounds-collection, r=davidtwco
bors [Sun, 8 Jan 2023 14:40:52 +0000 (14:40 +0000)]
Auto merge of #106235 - compiler-errors:rework-bounds-collection, r=davidtwco

Rework `Bounds` collection

I think it's weird for the `Bounds` struct in astconv to store its predicates *almost* converted into real predicates... so we do this eagerly, instead of lazily.

17 months agoAuto merge of #105733 - compiler-errors:ty-ct-late-flags, r=cjgillot
bors [Sun, 8 Jan 2023 11:51:41 +0000 (11:51 +0000)]
Auto merge of #105733 - compiler-errors:ty-ct-late-flags, r=cjgillot

Add type flags support for `Ty` and `Const` late-bound variables

I've been working on `for<T>` binders, and these will eventually be useful.

17 months agoAuto merge of #106588 - JohnTitor:rollup-4z80tjx, r=JohnTitor
bors [Sun, 8 Jan 2023 09:00:31 +0000 (09:00 +0000)]
Auto merge of #106588 - JohnTitor:rollup-4z80tjx, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #103104 (Stabilize `main_separator_str`)
 - #106410 (Suggest `mut self: &mut Self` for `?Sized` impls)
 - #106457 (Adjust comments about pre-push.sh hook)
 - #106546 (jsondoclint: Check local items in `paths` are also in `index`.)
 - #106557 (Add some UI tests and reword error-code docs)
 - #106562 (Clarify examples for `VecDeque::get/get_mut`)
 - #106580 (remove unreachable error code `E0313`)
 - #106581 (Do not emit wrong E0308 suggestion for closure mismatch)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoRollup merge of #106581 - estebank:bad-suggestion, r=compiler-errors
Yuki Okushi [Sun, 8 Jan 2023 08:01:49 +0000 (17:01 +0900)]
Rollup merge of #106581 - estebank:bad-suggestion, r=compiler-errors

Do not emit wrong E0308 suggestion for closure mismatch

Found in #76353.

17 months agoRollup merge of #106580 - Ezrashaw:remove-e0313, r=compiler-errors
Yuki Okushi [Sun, 8 Jan 2023 08:01:49 +0000 (17:01 +0900)]
Rollup merge of #106580 - Ezrashaw:remove-e0313, r=compiler-errors

remove unreachable error code `E0313`

Fixes #103742
Makes #103433 redundant

Implements removal of `E0313`. I agree with the linked issue that this error code is unreachable but if someone could confirm that would be great, are crater runs done for this sort of thing?

Also removed a redundant `// ignore-tidy-filelength` that I found while reading code.

cc ``@GuillaumeGomez`` #61137

17 months agoRollup merge of #106562 - clubby789:vec-deque-example, r=Mark-Simulacrum
Yuki Okushi [Sun, 8 Jan 2023 08:01:48 +0000 (17:01 +0900)]
Rollup merge of #106562 - clubby789:vec-deque-example, r=Mark-Simulacrum

Clarify examples for `VecDeque::get/get_mut`

Closes #106114

``@rustbot`` label +A-docs

17 months agoRollup merge of #106557 - Ezrashaw:ui-test-fixups-1, r=GuillaumeGomez
Yuki Okushi [Sun, 8 Jan 2023 08:01:48 +0000 (17:01 +0900)]
Rollup merge of #106557 - Ezrashaw:ui-test-fixups-1, r=GuillaumeGomez

Add some UI tests and reword error-code docs

Added UI tests for `E0013` and `E0015`. Error code docs for `E0015` were a bit unclear (they referred to all non-const errors in const context, when only non-const functions applied), so I touched them up a bit.

I also fixed up some issues in the new `error_codes.rs` tidy check (linked #106341), that I overlooked previously.

r? ``@GuillaumeGomez``

17 months agoRollup merge of #106546 - aDotInTheVoid:jsondoclint-path-local-item, r=notriddle
Yuki Okushi [Sun, 8 Jan 2023 08:01:47 +0000 (17:01 +0900)]
Rollup merge of #106546 - aDotInTheVoid:jsondoclint-path-local-item, r=notriddle

jsondoclint: Check local items in `paths` are also in `index`.

Would have caught #104064 (if core.json was linted in CI).

Closes #106433.

r? rustdoc

17 months agoRollup merge of #106457 - kadiwa4:no-bless, r=Mark-Simulacrum
Yuki Okushi [Sun, 8 Jan 2023 08:01:47 +0000 (17:01 +0900)]
Rollup merge of #106457 - kadiwa4:no-bless, r=Mark-Simulacrum

Adjust comments about pre-push.sh hook

Follow-up to #101175.

17 months agoRollup merge of #106410 - clubby789:borrow-mut-self-mut-self-diag, r=compiler-errors
Yuki Okushi [Sun, 8 Jan 2023 08:01:46 +0000 (17:01 +0900)]
Rollup merge of #106410 - clubby789:borrow-mut-self-mut-self-diag, r=compiler-errors

Suggest `mut self: &mut Self` for `?Sized` impls

Closes #106325
Closes #93078

The suggestion is _probably_ not what the user wants (hence `MaybeIncorrect`) but at least makes the problem in the above issues clearer. It might be better to add a note explaining why this is the case, but I'm not sure how best to word that so this is a start.

``@rustbot`` label +A-diagnostics

17 months agoRollup merge of #103104 - SUPERCILEX:sep-ref, r=dtolnay
Yuki Okushi [Sun, 8 Jan 2023 08:01:46 +0000 (17:01 +0900)]
Rollup merge of #103104 - SUPERCILEX:sep-ref, r=dtolnay

Stabilize `main_separator_str`

See reasoning here: https://github.com/rust-lang/rust/issues/94071#issuecomment-1279872605. Closes #94071.

17 months agoMention signature rather than fn pointers when comparing impl/trait methods
Michael Goulet [Sat, 24 Dec 2022 23:17:25 +0000 (23:17 +0000)]
Mention signature rather than fn pointers when comparing impl/trait methods

17 months agoAdd type flags support for Ty and Const late-bound regions
Michael Goulet [Thu, 15 Dec 2022 02:38:39 +0000 (02:38 +0000)]
Add type flags support for Ty and Const late-bound regions

17 months agoDo not emit wrong E0308 suggestion for closure mismatch
Esteban Küber [Sun, 8 Jan 2023 01:53:39 +0000 (01:53 +0000)]
Do not emit wrong E0308 suggestion for closure mismatch

17 months agoAdd test
Esteban Küber [Sun, 8 Jan 2023 01:53:08 +0000 (01:53 +0000)]
Add test

17 months agoremove unreachable error code `E0313`
Ezra Shaw [Sun, 8 Jan 2023 01:46:01 +0000 (14:46 +1300)]
remove unreachable error code `E0313`

17 months agoAuto merge of #104658 - thomcc:rand-update-and-usable-no_std, r=Mark-Simulacrum
bors [Sun, 8 Jan 2023 01:34:05 +0000 (01:34 +0000)]
Auto merge of #104658 - thomcc:rand-update-and-usable-no_std, r=Mark-Simulacrum

Update `rand` in the stdlib tests, and remove the `getrandom` feature from it.

The main goal is actually removing `getrandom`, so that eventually we can allow running the stdlib test suite on tier3 targets which don't have `getrandom` support. Currently those targets can only run the subset of stdlib tests that exist in uitests, and (generally speaking), we prefer not to test libstd functionality in uitests, which came up recently in https://github.com/rust-lang/rust/pull/104095 and https://github.com/rust-lang/rust/pull/104185. Additionally, the fact that we can't update `rand`/`getrandom` means we're stuck with the old set of tier3 targets, so can't test new ones.

~~Anyway, I haven't checked that this actually does allow use on tier3 targets (I think it does not, as some work is needed in stdlib submodules) but it moves us slightly closer to this, and seems to allow at least finally updating our `rand` dep, which definitely improves the status quo.~~ Checked and works now.

For the most part, our tests and benchmarks are fine using hard-coded seeds. A couple tests seem to fail with this (stuff manipulating the environment expecting no collisions, for example), or become pointless (all inputs to a function become equivalent). In these cases I've done a (gross) dance (ab)using `RandomState` and `Location::caller()` for some extra "entropy".

Trying to share that code seems *way* more painful than it's worth given that the duplication is a 7-line function, even if the lines are quite gross. (Keeping in mind that sharing it would require adding `rand` as a non-dev dep to std, and exposing a type from it publicly, all of which sounds truly awful, even if done behind a perma-unstable feature).

See also some previous attempts:
- https://github.com/rust-lang/rust/pull/86963 (in particular https://github.com/rust-lang/rust/pull/86963#issuecomment-885438936 which explains why this is non-trivial)
- https://github.com/rust-lang/rust/pull/89131
- https://github.com/rust-lang/rust/pull/96626#issuecomment-1114562857 (I tried in that PR at the same time, but settled for just removing the usage of `thread_rng()` from the benchmarks, since that was the main goal).
- https://github.com/rust-lang/rust/pull/104185
- Probably more. It's very tempting of a thing to "just update".

r? `@Mark-Simulacrum`

17 months agodoc/test: add UI test and reword docs for `E0013` and `E0015`
Ezra Shaw [Sat, 7 Jan 2023 05:37:40 +0000 (18:37 +1300)]
doc/test: add UI test and reword docs for `E0013` and `E0015`

17 months agoDocument that `Vec::from_raw_parts[_in]` must be given a pointer from the correct...
Kevin Reid [Sat, 7 Jan 2023 23:56:36 +0000 (15:56 -0800)]
Document that `Vec::from_raw_parts[_in]` must be given a pointer from the correct allocator.

17 months agoAuto merge of #106573 - matthiaskrgr:rollup-zkgfsta, r=matthiaskrgr
bors [Sat, 7 Jan 2023 22:42:39 +0000 (22:42 +0000)]
Auto merge of #106573 - matthiaskrgr:rollup-zkgfsta, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #101936 (Migrating rustc_infer to session diagnostics (part 3))
 - #104081 (PhantomData layout guarantees)
 - #104543 (Migrate `codegen_ssa` to diagnostics structs - [Part 3])
 - #105128 (Add O(1) `Vec -> VecDeque` conversion guarantee)
 - #105517 (Fix process-panic-after-fork.rs to pass on newer versions of Android.)
 - #105859 (Point out span where we could introduce higher-ranked lifetime)
 - #106509 (Detect closures assigned to binding in block)
 - #106553 (docs: make `HashSet::retain` doctest more clear)
 - #106556 (rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }`)
 - #106564 (Change to immutable borrow when cloning element of RepeatN)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

17 months agoRollup merge of #106564 - Folyd:feat-repeatn, r=scottmcm
Matthias Krüger [Sat, 7 Jan 2023 19:43:23 +0000 (20:43 +0100)]
Rollup merge of #106564 - Folyd:feat-repeatn, r=scottmcm

Change to immutable borrow when cloning element of RepeatN

17 months agoRollup merge of #106556 - notriddle:notriddle/margin-left-content-mobile, r=Guillaume...
Matthias Krüger [Sat, 7 Jan 2023 19:43:23 +0000 (20:43 +0100)]
Rollup merge of #106556 - notriddle:notriddle/margin-left-content-mobile, r=GuillaumeGomez

rustdoc: remove no-op mobile CSS `.content { margin-left: 0 }`

This rule was added to override non-zero left margin on `.content`, which was removed in 135281ed1525db15edd8ebd092aa10aa40df2386 and the margin-left was put on the docblock.

17 months agoRollup merge of #106553 - Ezrashaw:fix-hashset-doctest, r=JohnTitor
Matthias Krüger [Sat, 7 Jan 2023 19:43:22 +0000 (20:43 +0100)]
Rollup merge of #106553 - Ezrashaw:fix-hashset-doctest, r=JohnTitor

docs: make `HashSet::retain` doctest more clear

Fixes #106535

Extremely simple fix suggested by ``@compiler-errors`` in the linked issue.

17 months agoRollup merge of #106509 - estebank:closure-in-block, r=davidtwco
Matthias Krüger [Sat, 7 Jan 2023 19:43:22 +0000 (20:43 +0100)]
Rollup merge of #106509 - estebank:closure-in-block, r=davidtwco

Detect closures assigned to binding in block

Fix #58497.

17 months agoRollup merge of #105859 - compiler-errors:hr-lifetime-add, r=davidtwco
Matthias Krüger [Sat, 7 Jan 2023 19:43:21 +0000 (20:43 +0100)]
Rollup merge of #105859 - compiler-errors:hr-lifetime-add, r=davidtwco

Point out span where we could introduce higher-ranked lifetime

Somewhat addresses #105422, but not really. We don't have that much useful information here since we're still in resolution :^(

Maybe this suggestion isn't worth it. If the reviewer has an idea how we can get a more succinct binder information for a structured suggestion, it would be appreciated.

17 months agoRollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco
Matthias Krüger [Sat, 7 Jan 2023 19:43:20 +0000 (20:43 +0100)]
Rollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco

Fix process-panic-after-fork.rs to pass on newer versions of Android.

The test process-panic-after-fork.rs was checking that abort() resulted in SIGSEGV on Android. This non-standard behavior was fixed back in 2013, so let's fix the test to also accept the standard behavior on Android.

17 months agoRollup merge of #105128 - Sp00ph:vec_vec_deque_conversion, r=dtolnay
Matthias Krüger [Sat, 7 Jan 2023 19:43:20 +0000 (20:43 +0100)]
Rollup merge of #105128 - Sp00ph:vec_vec_deque_conversion, r=dtolnay

Add O(1) `Vec -> VecDeque` conversion guarantee

(See #105072)

17 months agoRollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs...
Matthias Krüger [Sat, 7 Jan 2023 19:43:19 +0000 (20:43 +0100)]
Rollup merge of #104543 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt3, r=davidtwco

Migrate `codegen_ssa` to diagnostics structs - [Part 3]

Completes migrating `codegen_ssa` module except 2 outstanding errors that depend on other crates:
1. [`rustc_middle::mir::interpret::InterpError`](https://github.com/rust-lang/rust/blob/b6097f2e1b2ca62e188ba53cf43bd66b06b36915/compiler/rustc_middle/src/mir/interpret/error.rs#L475): I saw `rustc_middle` is unassigned, I am open to take this work.

2.  `codegen_llvm`'s use of `fn span_invalid_monomorphization_error`, which I started to replace in the [last commit](https://github.com/rust-lang/rust/commit/9a31b3cdda78a2c0891828254fe9886e0a1cfd16) of this PR, but would like to know the team's preference on how we should keep replacing the other macros:
2.1. Update macros to expect a `Diagnostic`
2.2. Remove macros and expand the code on each use.
See [some examples of the different options in this experimental commit](https://github.com/JhonnyBillM/rust/commit/64aee83e80857dcfa450f0c6e31d5f29c6d577e6)

_Part 2 - https://github.com/rust-lang/rust/pull/103792_

r? ``@davidtwco``
Cc ``@compiler-errors``

17 months agoRollup merge of #104081 - joshlf:patch-6, r=dtolnay
Matthias Krüger [Sat, 7 Jan 2023 19:43:19 +0000 (20:43 +0100)]
Rollup merge of #104081 - joshlf:patch-6, r=dtolnay

PhantomData layout guarantees

17 months agoRollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-errors
Matthias Krüger [Sat, 7 Jan 2023 19:43:18 +0000 (20:43 +0100)]
Rollup merge of #101936 - IntQuant:issue-100717-infer-4, r=compiler-errors

Migrating rustc_infer to session diagnostics (part 3)

``@rustbot`` label +A-translation
r? rust-lang/diagnostics
cc https://github.com/rust-lang/rust/issues/100717

Seems like a part of static_impl_trait.rs emits suggestions in a loop, and note.rs needs to have two instances of the same subdiagnostic, so these will need to wait until we have eager translation/list support.
Other than that, there is only error_reporting/mod.rs left to migrate.

17 months agoDon't derive Debug for `OnceWith` & `RepeatWith`
Sky [Sat, 7 Jan 2023 19:16:59 +0000 (14:16 -0500)]
Don't derive Debug for `OnceWith` & `RepeatWith`

17 months agoAuto merge of #106036 - JohnTitor:issue-86106, r=nikic
bors [Sat, 7 Jan 2023 19:26:25 +0000 (19:26 +0000)]
Auto merge of #106036 - JohnTitor:issue-86106, r=nikic

Add regression test for #86106

Closes #86106
r? `@nikic`

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
17 months agoAuto merge of #105323 - cjgillot:simplify-const-prop, r=davidtwco
bors [Sat, 7 Jan 2023 16:13:18 +0000 (16:13 +0000)]
Auto merge of #105323 - cjgillot:simplify-const-prop, r=davidtwco

Perform SimplifyLocals before ConstProp.

MIR before `ConstProp` may have a lot of dead writes, this makes `ConstProp` do unnecessary work.

r? `@ghost`

17 months agoChange to immutable borrow when cloning element of RepeatN
Folyd [Sat, 7 Jan 2023 15:50:07 +0000 (23:50 +0800)]
Change to immutable borrow when cloning element of RepeatN

17 months agoClarify examples for `VecDeque::get/get_mut`
clubby789 [Sat, 7 Jan 2023 14:38:21 +0000 (14:38 +0000)]
Clarify examples for `VecDeque::get/get_mut`

17 months agoAuto merge of #106519 - estebank:tail-unit, r=cjgillot
bors [Sat, 7 Jan 2023 13:24:12 +0000 (13:24 +0000)]
Auto merge of #106519 - estebank:tail-unit, r=cjgillot

Detect bindings assigned blocks without tail expressions

Fix #44173.