]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #94477 - matthiaskrgr:rollup-8h29qek, r=matthiaskrgr
bors [Tue, 1 Mar 2022 11:24:10 +0000 (11:24 +0000)]
Auto merge of #94477 - matthiaskrgr:rollup-8h29qek, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #94359 (Fix inconsistent symbol mangling of integers constants with -Zverbose)
 - #94465 (6 - Make more use of `let_chains`)
 - #94470 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agoRollup merge of #94470 - lnicola:rust-analyzer-2022-03-01, r=lnicola
Matthias Krüger [Tue, 1 Mar 2022 11:00:45 +0000 (12:00 +0100)]
Rollup merge of #94470 - lnicola:rust-analyzer-2022-03-01, r=lnicola

:arrow_up: rust-analyzer

r? ``@ghost``

2 years agoRollup merge of #94465 - c410-f3r:more-let-chains, r=Dylan-DPC
Matthias Krüger [Tue, 1 Mar 2022 11:00:44 +0000 (12:00 +0100)]
Rollup merge of #94465 - c410-f3r:more-let-chains, r=Dylan-DPC

6 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agoRollup merge of #94359 - tmiasko:legacy-verbose-const, r=petrochenkov
Matthias Krüger [Tue, 1 Mar 2022 11:00:43 +0000 (12:00 +0100)]
Rollup merge of #94359 - tmiasko:legacy-verbose-const, r=petrochenkov

Fix inconsistent symbol mangling of integers constants with -Zverbose

The `PrettyPrinter` changes formatting of array size and integer
constants based on `-Zverbose`, so its implementation cannot be used in
legacy symbol mangling.

Example symbol demangling before changes:

```console
$ cat a.rs
pub struct A<T>(T);
impl A<[u8; 128]> { pub fn f() {} }
$ rustc --crate-type=lib a.rs -Zverbose=n && nm -C ./liba.rlib
00000000 T a::A<[u8; 128]>::f
$ rustc --crate-type=lib a.rs -Zverbose=y && nm -C ./liba.rlib
00000000 T a::A<[u8; Const { ty. usize, val. Value(Scalar(0x0000000000000080)) }]>::f
```

2 years agoAuto merge of #94402 - erikdesjardins:revert-coldland, r=nagisa
bors [Tue, 1 Mar 2022 08:57:46 +0000 (08:57 +0000)]
Auto merge of #94402 - erikdesjardins:revert-coldland, r=nagisa

Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"

Should fix (untested) #94390

Reopens #46515, #87055

r? `@ehuss`

2 years agoAuto merge of #94471 - matthiaskrgr:rollup-ffz65qt, r=matthiaskrgr
bors [Tue, 1 Mar 2022 06:15:54 +0000 (06:15 +0000)]
Auto merge of #94471 - matthiaskrgr:rollup-ffz65qt, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #94438 (Check method input expressions once)
 - #94459 (Update cargo)
 - #94470 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agoRollup merge of #94459 - jonhoo:bump-cargo, r=Dylan-DPC
Matthias Krüger [Tue, 1 Mar 2022 05:22:32 +0000 (06:22 +0100)]
Rollup merge of #94459 - jonhoo:bump-cargo, r=Dylan-DPC

Update cargo

11 changes in
d6cdde584a1f15ea086bae922e20fd27f7165431..3d6970d50e30e797b8e26b2b9b1bdf92dc381f34
2022-02-22 19:55:51 +0000 to 2022-02-28 19:29:07 +0000:

 - https://github.com/rust-lang/cargo/pull/10395
 - https://github.com/rust-lang/cargo/pull/10425
 - https://github.com/rust-lang/cargo/pull/10428
 - https://github.com/rust-lang/cargo/pull/10388
 - https://github.com/rust-lang/cargo/pull/10167
 - https://github.com/rust-lang/cargo/pull/10429
 - https://github.com/rust-lang/cargo/pull/10426
 - https://github.com/rust-lang/cargo/pull/10372
 - https://github.com/rust-lang/cargo/pull/10420
 - https://github.com/rust-lang/cargo/pull/10416
 - https://github.com/rust-lang/cargo/pull/10417

2 years agoRollup merge of #94438 - compiler-errors:check-method-inputs-once, r=davidtwco
Matthias Krüger [Tue, 1 Mar 2022 05:22:32 +0000 (06:22 +0100)]
Rollup merge of #94438 - compiler-errors:check-method-inputs-once, r=davidtwco

Check method input expressions once

If the user mistakenly forgets to wrap their method args in a tuple, then the compiler tries to check that  types within the tuple match the expression args. This means we call `check_expr` once within this diagnostic code, so when we check the expr once again in `demand_compatible`, we attempt to apply expr adjustments twice, leading to ICEs.

This PR attempts to fix this by skipping the expression type check in `demand_compatible` if we have detected an method arg mismatch at all.

This does lead to a single UI test regressing slightly, due to a diagnostic disappearing, though I don't know if it is generally meaningful to even raise an type error after noting that the argument count is incorrect in a function call, since the user might be providing (in-context) meaningless expressions to the wrong method.

I can adjust this to be a bit more targeted (to just skip checking exprs in `demand_compatible` in the tuple case) if this UI test regression is a problem.

fixes #94334
cc #94291

Also drive-by fixup of `.node_type(expr.hir_id)` to `.expr_ty(expr)`, since that method exists.

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 1 Mar 2022 05:20:26 +0000 (07:20 +0200)]
:arrow_up: rust-analyzer

2 years agoAuto merge of #94469 - Dylan-DPC:rollup-2tcq6s5, r=Dylan-DPC
bors [Tue, 1 Mar 2022 03:26:11 +0000 (03:26 +0000)]
Auto merge of #94469 - Dylan-DPC:rollup-2tcq6s5, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #91545 (Generalize "remove `&`"  and "add `*`" suggestions to more than one deref)
 - #93385 (Rustdoc ty consistency fixes)
 - #93926 (Lint against more useless `#[must_use]` attributes)
 - #94094 (use BOOL for TCP_NODELAY setsockopt value on Windows)
 - #94384 (Add Atomic*::from_mut_slice)
 - #94448 (5 - Make more use of `let_chains`)
 - #94452 (Sync portable-simd for bitmasks &c.)

Failed merges:

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

2 years agoRollup merge of #94452 - workingjubilee:sync-simd-bitmasks, r=workingjubilee
Dylan DPC [Tue, 1 Mar 2022 02:41:53 +0000 (03:41 +0100)]
Rollup merge of #94452 - workingjubilee:sync-simd-bitmasks, r=workingjubilee

Sync portable-simd for bitmasks &c.

In the ideal case, where everything works easily and nothing has to be rearranged, it is as simple as:
- `git subtree pull -P library/portable-simd https://github.com/rust-lang/portable-simd - ${branch}`
- write the commit message
- `python x.py test --stage 1` to make sure it runs
- `git push` to your PR-to-rustc branch

If anything borks up this flow, you can fix it with sufficient git wizardry but you are usually better off going back to the source, fixing it, and starting over, before you open the PR.

r? `@calebzulawski`

2 years agoRollup merge of #94448 - c410-f3r:yet-more-let-chains, r=estebank
Dylan DPC [Tue, 1 Mar 2022 02:41:52 +0000 (03:41 +0100)]
Rollup merge of #94448 - c410-f3r:yet-more-let-chains, r=estebank

5 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agoRollup merge of #94384 - cuviper:atomic-slice, r=dtolnay
Dylan DPC [Tue, 1 Mar 2022 02:41:51 +0000 (03:41 +0100)]
Rollup merge of #94384 - cuviper:atomic-slice, r=dtolnay

Add Atomic*::from_mut_slice

Tracking issue #76314 for `from_mut` has a question about the possibility of `from_mut_slice`, and I found a real case for it. A user in the forum had a parallelism problem that could be solved by open-indexing updates to a vector of atomics, but they didn't want to affect the other code using that vector. Using `from_mut_slice`, they could borrow that data as atomics just long enough for their parallel loop.

ref: https://users.rust-lang.org/t/sharing-vector-with-rayon-par-iter-correctly/72022

2 years agoRollup merge of #94094 - chrisnc:tcp-nodelay-windows-bool, r=dtolnay
Dylan DPC [Tue, 1 Mar 2022 02:41:50 +0000 (03:41 +0100)]
Rollup merge of #94094 - chrisnc:tcp-nodelay-windows-bool, r=dtolnay

use BOOL for TCP_NODELAY setsockopt value on Windows

This issue was found by the Wine project and mitigated there [^1].

Windows' setsockopt expects a BOOL (a typedef for int) for TCP_NODELAY
[^2]. Windows itself is forgiving and will accept any positive optlen and
interpret the first byte of *optval as the value, so this bug does not
affect Windows itself, but does affect systems implementing Windows'
interface more strictly, such as Wine. Wine was previously passing this
through to the host's setsockopt, where, e.g., Linux requires that
optlen be correct for the chosen option, and TCP_NODELAY expects an int.

[^1]: https://source.winehq.org/git/wine.git/commit/d6ea38f32dfd3edbe107a255c37e9f7f3da06ae7
[^2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-setsockopt

2 years agoRollup merge of #93926 - PatchMixolydic:bugfix/must_use-on-exprs, r=cjgillot
Dylan DPC [Tue, 1 Mar 2022 02:41:49 +0000 (03:41 +0100)]
Rollup merge of #93926 - PatchMixolydic:bugfix/must_use-on-exprs, r=cjgillot

Lint against more useless `#[must_use]` attributes

This expands the existing `#[must_use]` check in `unused_attributes` to lint against pretty much everything `#[must_use]` doesn't support.
Fixes #93906.

2 years agoRollup merge of #93385 - CraftSpider:rustdoc-ty-fixes, r=camelid
Dylan DPC [Tue, 1 Mar 2022 02:41:47 +0000 (03:41 +0100)]
Rollup merge of #93385 - CraftSpider:rustdoc-ty-fixes, r=camelid

Rustdoc ty consistency fixes

Changes to make rustdoc cleaning of ty more consistent with hir, and hopefully use it in more places.

r? `@camelid`

2 years agoRollup merge of #91545 - compiler-errors:deref-suggestion-improvements, r=estebank
Dylan DPC [Tue, 1 Mar 2022 02:41:46 +0000 (03:41 +0100)]
Rollup merge of #91545 - compiler-errors:deref-suggestion-improvements, r=estebank

Generalize "remove `&`"  and "add `*`" suggestions to more than one deref

Suggest removing more than one `&` and `&mut`, along with suggesting adding more than one `*` (or a combination of the two).

r? `@estebank`
(since you're experienced with these types of suggestions, feel free to reassign)

2 years ago6 - Make more use of `let_chains`
Caio [Tue, 1 Mar 2022 00:12:52 +0000 (21:12 -0300)]
6 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agoAuto merge of #94299 - oli-obk:stable_hash_ty, r=michaelwoerister
bors [Mon, 28 Feb 2022 23:38:05 +0000 (23:38 +0000)]
Auto merge of #94299 - oli-obk:stable_hash_ty, r=michaelwoerister

Caching the stable hash of Ty within itself

Instead of computing stable hashes on types as needed, we compute it during interning.

This way we can, when a hash is requested, just hash that hash, which is significantly faster than traversing the type itself.

We only do this for incremental for now, as incremental is the only frequent user of stable hashing.

As a next step we can try out

* moving the hash and TypeFlags to Interner, so projections and regions get the same benefit (tho regions are not nested, so maybe that's not a good idea? Would be nice for dedup tho)
* start comparing types via their stable hash instead of their address?

2 years agoAuto merge of #94453 - matthiaskrgr:rollup-xv9y98j, r=matthiaskrgr
bors [Mon, 28 Feb 2022 21:17:11 +0000 (21:17 +0000)]
Auto merge of #94453 - matthiaskrgr:rollup-xv9y98j, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #92399 (fix typo in btree/vec doc: Self -> self)
 - #92823 (Tweak diagnostics)
 - #94248 (Fix ICE when passing block to while-loop condition)
 - #94414 (Fix ICE when using Box<T, A> with large A)
 - #94445 (4 - Make more use of `let_chains`)
 - #94449 (Add long explanation for E0726)

Failed merges:

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

2 years agoFix inconsistent symbol mangling of integers constants with -Zverbose
Tomasz Miąsko [Fri, 25 Feb 2022 00:00:00 +0000 (00:00 +0000)]
Fix inconsistent symbol mangling of integers constants with -Zverbose

The `PrettyPrinter` changes formatting of array size and integer
constants based on `-Zverbose`, so its implementation cannot be used in
legacy symbol mangling.

2 years agoUpdate cargo
Jon Gjengset [Mon, 28 Feb 2022 20:41:51 +0000 (12:41 -0800)]
Update cargo

11 changes in
d6cdde584a1f15ea086bae922e20fd27f7165431..3d6970d50e30e797b8e26b2b9b1bdf92dc381f34
2022-02-22 19:55:51 +0000 to 2022-02-28 19:29:07 +0000:

 - https://github.com/rust-lang/cargo/pull/10395
 - https://github.com/rust-lang/cargo/pull/10425
 - https://github.com/rust-lang/cargo/pull/10428
 - https://github.com/rust-lang/cargo/pull/10388
 - https://github.com/rust-lang/cargo/pull/10167
 - https://github.com/rust-lang/cargo/pull/10429
 - https://github.com/rust-lang/cargo/pull/10426
 - https://github.com/rust-lang/cargo/pull/10372
 - https://github.com/rust-lang/cargo/pull/10420
 - https://github.com/rust-lang/cargo/pull/10416
 - https://github.com/rust-lang/cargo/pull/10417

2 years agoRollup merge of #94449 - GuillaumeGomez:explanation-e0726, r=Urgau
Matthias Krüger [Mon, 28 Feb 2022 19:05:18 +0000 (20:05 +0100)]
Rollup merge of #94449 - GuillaumeGomez:explanation-e0726, r=Urgau

Add long explanation for E0726

This is the cleaned up version of #87655 with the missing fixes.

Part of https://github.com/rust-lang/rust/issues/61137.

r? `@Urgau`

2 years agoRollup merge of #94445 - c410-f3r:more-let-chains, r=cjgillot
Matthias Krüger [Mon, 28 Feb 2022 19:05:17 +0000 (20:05 +0100)]
Rollup merge of #94445 - c410-f3r:more-let-chains, r=cjgillot

4 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agoRollup merge of #94414 - DrMeepster:box_alloc_ice2, r=tmiasko
Matthias Krüger [Mon, 28 Feb 2022 19:05:15 +0000 (20:05 +0100)]
Rollup merge of #94414 - DrMeepster:box_alloc_ice2, r=tmiasko

Fix ICE when using Box<T, A> with large A

A sequel to #94043 that fixes #81270 and #92054 (duplicate).

2 years agoRollup merge of #94248 - compiler-errors:fix-while-loop-bad-delay, r=petrochenkov
Matthias Krüger [Mon, 28 Feb 2022 19:05:14 +0000 (20:05 +0100)]
Rollup merge of #94248 - compiler-errors:fix-while-loop-bad-delay, r=petrochenkov

Fix ICE when passing block to while-loop condition

We were incorrectly delaying a bug when we passed _any_ block (that evaluated to `()`) to a while loop. This PR makes the check a bit more sophisticated.

We should only suppress the error here in cases that are equivalent to those we find in #93574 (i.e. only while loop conditions that have destructuring assignment expressions in them).

Fixes #93997
cc `@estebank` who added this code

I would not be opposed to removing the delay-bug altogether, and just emitting this error always. I much prefer duplicate errors over no errors.

2 years agoRollup merge of #92823 - estebank:tweak-diag, r=jackh726
Matthias Krüger [Mon, 28 Feb 2022 19:05:13 +0000 (20:05 +0100)]
Rollup merge of #92823 - estebank:tweak-diag, r=jackh726

Tweak diagnostics

* Recover from invalid `'label: ` before block.
* Make suggestion to enclose statements in a block multipart.
* Point at `match`, `while`, `loop` and `unsafe` keywords when failing
  to parse their expression. (Fix #92705.)
* Do not suggest `{ ; }`.
* Do not suggest `|` when very unlikely to be what was wanted (in `let`
  statements).

2 years agoRollup merge of #92399 - Veeupup:fix_vec_typo, r=Dylan-DPC
Matthias Krüger [Mon, 28 Feb 2022 19:05:13 +0000 (20:05 +0100)]
Rollup merge of #92399 - Veeupup:fix_vec_typo, r=Dylan-DPC

fix typo in btree/vec doc: Self -> self

this pr fixes #92345
the documentation refers to the object the method is called for, not the type, so it should be using the lower case self.

2 years ago5 - Make more use of let_chains
Caio [Mon, 28 Feb 2022 18:52:36 +0000 (15:52 -0300)]
5 - Make more use of let_chains

2 years agoTweak diagnostics
Esteban Kuber [Wed, 12 Jan 2022 20:43:24 +0000 (20:43 +0000)]
Tweak diagnostics

* Recover from invalid `'label: ` before block.
* Make suggestion to enclose statements in a block multipart.
* Point at `match`, `while`, `loop` and `unsafe` keywords when failing
  to parse their expression.
* Do not suggest `{ ; }`.
* Do not suggest `|` when very unlikely to be what was wanted (in `let`
  statements).

2 years agoSync rust-lang/portable-simd@5f49d4c8435a25d804b2f375e949cb25479f5be9
Jubilee Young [Mon, 28 Feb 2022 18:17:40 +0000 (10:17 -0800)]
Sync rust-lang/portable-simd@5f49d4c8435a25d804b2f375e949cb25479f5be9

2 years agoUpdate ui test with the add of E0726 explanation
Guillaume Gomez [Mon, 28 Feb 2022 13:37:27 +0000 (14:37 +0100)]
Update ui test with the add of E0726 explanation

2 years agoAdd explanation for E0726
Guillaume Gomez [Mon, 28 Feb 2022 13:23:11 +0000 (14:23 +0100)]
Add explanation for E0726

2 years agoAuto merge of #94447 - matthiaskrgr:rollup-d8rj2xv, r=matthiaskrgr
bors [Mon, 28 Feb 2022 14:20:13 +0000 (14:20 +0000)]
Auto merge of #94447 - matthiaskrgr:rollup-d8rj2xv, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #89793 (Add `slice::{from_ptr_range, from_mut_ptr_range} `)
 - #92642 (Update search location from a relative path to absolute)
 - #93389 (regression for issue 90847)
 - #93413 (Fix broken link from rustdoc docs to ayu theme)
 - #94365 (Fix MinGW target detection in raw-dylib)

Failed merges:

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

2 years agoRollup merge of #94365 - mati865:fix-mingw-detection-for-rawdylib, r=michaelwoerister
Matthias Krüger [Mon, 28 Feb 2022 11:57:48 +0000 (12:57 +0100)]
Rollup merge of #94365 - mati865:fix-mingw-detection-for-rawdylib, r=michaelwoerister

Fix MinGW target detection in raw-dylib

LLVM target doesn't have to be the same as Rust target so relying on it is wrong.

It was one of concerns in https://github.com/rust-lang/rust/pull/88801 that was not fixed in https://github.com/rust-lang/rust/pull/90782.

2 years agoRollup merge of #93413 - lsimons:patch-1, r=Dylan-DPC
Matthias Krüger [Mon, 28 Feb 2022 11:57:47 +0000 (12:57 +0100)]
Rollup merge of #93413 - lsimons:patch-1, r=Dylan-DPC

Fix broken link from rustdoc docs to ayu theme

2 years agoRollup merge of #93389 - cameron1024:issue-90847-regression, r=Mark-Simulacrum
Matthias Krüger [Mon, 28 Feb 2022 11:57:46 +0000 (12:57 +0100)]
Rollup merge of #93389 - cameron1024:issue-90847-regression, r=Mark-Simulacrum

regression for issue 90847

Adds a regression test for issue #90847

2 years agoRollup merge of #92642 - avborhanian:master, r=Dylan-DPC
Matthias Krüger [Mon, 28 Feb 2022 11:57:45 +0000 (12:57 +0100)]
Rollup merge of #92642 - avborhanian:master, r=Dylan-DPC

Update search location from a relative path to absolute

This should address issue #90311.

2 years agoRollup merge of #89793 - ibraheemdev:from_ptr_range, r=m-ou-se
Matthias Krüger [Mon, 28 Feb 2022 11:57:44 +0000 (12:57 +0100)]
Rollup merge of #89793 - ibraheemdev:from_ptr_range, r=m-ou-se

Add `slice::{from_ptr_range, from_mut_ptr_range} `

Adds `slice::{from_ptr_range, from_mut_ptr_range}` as counterparts to `slice::{as_ptr_range, as_mut_ptr_range}`.

2 years agoAuto merge of #94216 - psumbera:sparc64-abi-fix2, r=nagisa
bors [Mon, 28 Feb 2022 11:54:17 +0000 (11:54 +0000)]
Auto merge of #94216 - psumbera:sparc64-abi-fix2, r=nagisa

more complete sparc64 ABI fix for aggregates with floating point members

Previous fix didn't handle nested structures at all.

2 years ago4 - Make more use of `let_chains`
Caio [Mon, 28 Feb 2022 10:49:56 +0000 (07:49 -0300)]
4 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agoAuto merge of #94427 - cjgillot:inline-fresh-expn, r=oli-obk
bors [Mon, 28 Feb 2022 08:25:26 +0000 (08:25 +0000)]
Auto merge of #94427 - cjgillot:inline-fresh-expn, r=oli-obk

Only create a single expansion for each inline integration.

The inlining integrator used to create one expansion for each span from the callee body.
This PR reverses the logic to create a single expansion for the whole call,
which is more consistent with how macro expansions work for macros.

This should remove the large memory regression in #91743.

2 years agoAuto merge of #94158 - erikdesjardins:more-more-noundef, r=nikic
bors [Mon, 28 Feb 2022 06:11:20 +0000 (06:11 +0000)]
Auto merge of #94158 - erikdesjardins:more-more-noundef, r=nikic

Apply noundef metadata to loads of types that do not permit raw init

This matches the noundef attributes we apply on arguments/return types.

Fixes (partially) #74378.

2 years agoexpadn abi check + condese & fix tests
DrMeepster [Mon, 28 Feb 2022 04:25:16 +0000 (20:25 -0800)]
expadn abi check + condese & fix tests

2 years agoupdate vec-shrink-panik test to allow panic_no_unwind in landingpads
Erik Desjardins [Mon, 28 Feb 2022 04:15:49 +0000 (23:15 -0500)]
update vec-shrink-panik test to allow panic_no_unwind in landingpads

2 years agoRevert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"
Erik Desjardins [Sat, 26 Feb 2022 17:52:07 +0000 (12:52 -0500)]
Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"

This reverts commit 4f49627c6fe2a32d1fed6310466bb0e1c535c0c0, reversing
changes made to 028c6f1454787c068ff5117e9000a1de4fd98374.

2 years agoonly check method inputs once
Michael Goulet [Sat, 26 Feb 2022 04:20:26 +0000 (20:20 -0800)]
only check method inputs once

2 years agoAuto merge of #94437 - RalfJung:miri, r=RalfJung
bors [Mon, 28 Feb 2022 03:44:19 +0000 (03:44 +0000)]
Auto merge of #94437 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/94318
r? `@ghost`

2 years agofix ICE when passing empty block to while-loop condition
Michael Goulet [Tue, 22 Feb 2022 03:49:15 +0000 (19:49 -0800)]
fix ICE when passing empty block to while-loop condition

2 years agoupdate Miri
Ralf Jung [Mon, 28 Feb 2022 03:04:00 +0000 (22:04 -0500)]
update Miri

2 years agoAuto merge of #94431 - matthiaskrgr:rollup-1jsj0wu, r=matthiaskrgr
bors [Mon, 28 Feb 2022 01:18:01 +0000 (01:18 +0000)]
Auto merge of #94431 - matthiaskrgr:rollup-1jsj0wu, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #94396 (1 - Make more use of `let_chains`)
 - #94397 (Document that pre-expansion lint passes are softly deprecated)
 - #94399 (Add test for #79465 to prevent regression)
 - #94409 (avoid rebuilding bootstrap when PATH changes)
 - #94415 (Use the first codegen backend in the config.toml as default)
 - #94417 (Fix duplicated impl links)
 - #94420 (3 - Make more use of `let_chains`)

Failed merges:

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

2 years agoMake deref suggestion better
Michael Goulet [Sun, 5 Dec 2021 04:51:36 +0000 (04:51 +0000)]
Make deref suggestion better

2 years agoadd `slice::{from_ptr_range, from_mut_ptr_range}`
Ibraheem Ahmed [Mon, 11 Oct 2021 21:41:25 +0000 (17:41 -0400)]
add `slice::{from_ptr_range, from_mut_ptr_range}`

2 years agoAuto merge of #94157 - erikdesjardins:more-noundef, r=nikic
bors [Sun, 27 Feb 2022 21:41:06 +0000 (21:41 +0000)]
Auto merge of #94157 - erikdesjardins:more-noundef, r=nikic

Apply noundef attribute to all scalar types which do not permit raw init

Beyond `&`/`&mut`/`Box`, this covers `char`, enum discriminants, `NonZero*`, etc.
All such types currently cause a Miri error if left uninitialized,
and an `invalid_value` lint in cases like `mem::uninitialized::<char>()`.

Note that this _does not_ change whether or not it is UB for `u64` (or
other integer types with no invalid values) to be undef.

Fixes (partially) #74378.

r? `@ghost` (blocked on #94127)

`@rustbot` label S-blocked

2 years agoRollup merge of #94420 - c410-f3r:more-let-chains, r=Dylan-DPC
Matthias Krüger [Sun, 27 Feb 2022 20:46:38 +0000 (21:46 +0100)]
Rollup merge of #94420 - c410-f3r:more-let-chains, r=Dylan-DPC

3 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agoRollup merge of #94417 - GuillaumeGomez:fix-duplicated-impl-links, r=notriddle
Matthias Krüger [Sun, 27 Feb 2022 20:46:37 +0000 (21:46 +0100)]
Rollup merge of #94417 - GuillaumeGomez:fix-duplicated-impl-links, r=notriddle

Fix duplicated impl links

Fixes #78701.

The problem is that the blanket impl has the same ID as the other impl, except that we don't derive IDs when we generate the sidebar. We now do.

r? ``@notriddle``

2 years agoRollup merge of #94415 - bjorn3:cfg_default_backend, r=Mark-Simulacrum
Matthias Krüger [Sun, 27 Feb 2022 20:46:36 +0000 (21:46 +0100)]
Rollup merge of #94415 - bjorn3:cfg_default_backend, r=Mark-Simulacrum

Use the first codegen backend in the config.toml as default

It is currently hard coded to llvm if enabled and cranelift otherwise.
This made some sense when cranelift was the only alternative codegen
backend. Since the introduction of the gcc backend this doesn't make
much sense anymore. Before this PR bootstrapping rustc using a backend
other than llvm or cranelift required changing the source of
rustc_interface. With this PR it becomes a matter of putting the right
backend as first enabled backend in config.toml.

cc ```@antoyo```

2 years agoRollup merge of #94409 - RalfJung:path, r=Mark-Simulacrum
Matthias Krüger [Sun, 27 Feb 2022 20:46:35 +0000 (21:46 +0100)]
Rollup merge of #94409 - RalfJung:path, r=Mark-Simulacrum

avoid rebuilding bootstrap when PATH changes

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

r? ```@Mark-Simulacrum```

2 years agoRollup merge of #94399 - GuillaumeGomez:regression-test-79465, r=matthiaskrgr
Matthias Krüger [Sun, 27 Feb 2022 20:46:34 +0000 (21:46 +0100)]
Rollup merge of #94399 - GuillaumeGomez:regression-test-79465, r=matthiaskrgr

Add test for #79465 to prevent regression

Fixes #79465.

Like this we will be able to close the issue.

r? ````@matthiaskrgr````

2 years agoRollup merge of #94397 - xFrednet:69838-deprecate-pre-expansion, r=cjgillot
Matthias Krüger [Sun, 27 Feb 2022 20:46:34 +0000 (21:46 +0100)]
Rollup merge of #94397 - xFrednet:69838-deprecate-pre-expansion, r=cjgillot

Document that pre-expansion lint passes are softly deprecated

The pre-expansion lint pass has been softly deprecated since https://github.com/rust-lang/rust/pull/69838. Every once in a while I see someone mention it as a possibility, only get the feedback that it's deprecated. This PR officially documents that the method is soft deprecated to have a single point of truth for it.

That's it. Have a great rest of the day :upside_down_face:

---

* See [rust#69838](https://github.com/rust-lang/rust/pull/69838)
* See [rust-clippy#5518](https://github.com/rust-lang/rust-clippy/pull/5518)

2 years agoRollup merge of #94396 - c410-f3r:yet-more-let-chains, r=Dylan-DPC
Matthias Krüger [Sun, 27 Feb 2022 20:46:33 +0000 (21:46 +0100)]
Rollup merge of #94396 - c410-f3r:yet-more-let-chains, r=Dylan-DPC

1 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agomake pgo-branch-weights test not dependent on argument attributes
Erik Desjardins [Sun, 27 Feb 2022 18:40:50 +0000 (13:40 -0500)]
make pgo-branch-weights test not dependent on argument attributes

2 years agoOnly create a single expansion for each inline integration.
Camille GILLOT [Sun, 27 Feb 2022 15:09:52 +0000 (16:09 +0100)]
Only create a single expansion for each inline integration.

2 years agoAuto merge of #94412 - scottmcm:cfg-out-miri-from-swap, r=oli-obk
bors [Sun, 27 Feb 2022 17:42:48 +0000 (17:42 +0000)]
Auto merge of #94412 - scottmcm:cfg-out-miri-from-swap, r=oli-obk

For MIRI, cfg out the swap vectorization logic from 94212

Because of #69488 the swap logic from #94212 doesn't currently work in MIRI.

Copying in smaller pieces is probably much worse for its performance anyway, so it'd probably rather just use the simple path regardless.

Part of #94371, though another PR will be needed for the CTFE aspect.

r? `@oli-obk`
cc `@RalfJung`

2 years agoApply noundef metadata to loads of types that do not permit raw init
Erik Desjardins [Sat, 12 Feb 2022 19:01:33 +0000 (14:01 -0500)]
Apply noundef metadata to loads of types that do not permit raw init

This matches the noundef attributes we apply on arguments/return types.

2 years agoLint against more useless `#[must_use]` attributes
Ruby Lazuli [Sat, 12 Feb 2022 00:21:02 +0000 (18:21 -0600)]
Lint against more useless `#[must_use]` attributes

This expands the existing `#[must_use]` check in `unused_attributes`
to lint against pretty much everything `#[must_use]` doesn't support.
Fixes #93906.

2 years ago3 - Make more use of let_chains
Caio [Sun, 27 Feb 2022 14:10:20 +0000 (11:10 -0300)]
3 - Make more use of let_chains

Continuation of #94376.

cc #53667

2 years agoAuto merge of #94084 - Mark-Simulacrum:drop-sharded, r=cjgillot
bors [Sun, 27 Feb 2022 14:04:07 +0000 (14:04 +0000)]
Auto merge of #94084 - Mark-Simulacrum:drop-sharded, r=cjgillot

Avoid query cache sharding code in single-threaded mode

In non-parallel compilers, this is just adding needless overhead at compilation time (since there is only one shard statically anyway). This amounts to roughly ~10 seconds reduction in bootstrap time, with overall neutral (some wins, some losses) performance results.

Parallel compiler performance should be largely unaffected by this PR; sharding is kept there.

2 years agoAuto merge of #94400 - c410-f3r:more-let-chains, r=Dylan-DPC
bors [Sun, 27 Feb 2022 11:45:55 +0000 (11:45 +0000)]
Auto merge of #94400 - c410-f3r:more-let-chains, r=Dylan-DPC

2 - Make more use of `let_chains`

Continuation of #94376.

cc #53667

2 years agoAdd test to ensure that links to impls are correctly generated
Guillaume Gomez [Sun, 27 Feb 2022 11:07:54 +0000 (12:07 +0100)]
Add test to ensure that links to impls are correctly generated

2 years agoCorrectly generate links in the sidebar for impls
Guillaume Gomez [Sun, 27 Feb 2022 11:07:38 +0000 (12:07 +0100)]
Correctly generate links in the sidebar for impls

2 years agoUse the first codegen backend in the config.toml as default
bjorn3 [Sun, 27 Feb 2022 09:59:10 +0000 (10:59 +0100)]
Use the first codegen backend in the config.toml as default

It is currently hard coded to llvm if enabled and cranelift otherwise.
This made some sense when cranelift was the only alternative codegen
backend. Since the introduction of the gcc backend this doesn't make
much sense anymore. Before this PR bootstrapping rustc using a backend
other than llvm or cranelift required changing the source of
rustc_interface. With this PR it becomes a matter of putting the right
backend as first enabled backend in config.toml.

2 years agoAuto merge of #94221 - erikdesjardins:addattr, r=nikic
bors [Sun, 27 Feb 2022 09:23:24 +0000 (09:23 +0000)]
Auto merge of #94221 - erikdesjardins:addattr, r=nikic

Add LLVM attributes in batches instead of individually

This should improve performance.

~r? `@ghost` (blocked on #94127)~

2 years agofix box icing when it has aggregate abi
DrMeepster [Sun, 27 Feb 2022 08:48:17 +0000 (00:48 -0800)]
fix box icing when it has aggregate abi

2 years agoAuto merge of #94144 - est31:let_else_trait_selection, r=cjgillot
bors [Sun, 27 Feb 2022 07:02:46 +0000 (07:02 +0000)]
Auto merge of #94144 - est31:let_else_trait_selection, r=cjgillot

rustc_trait_selection: adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This PR handles rustc_trait_selection.

2 years agoAuto merge of #94361 - nikic:s390x-update, r=Mark-Simulacrum
bors [Sun, 27 Feb 2022 04:08:50 +0000 (04:08 +0000)]
Auto merge of #94361 - nikic:s390x-update, r=Mark-Simulacrum

Update dist-s390x-dist image

Update to Ubuntu 20.04 and crosstool-ng 1.24.0. I've upgraded the
ct-ng config and then manually reset the kernel and glibc versions
to the oldest supported.

Specifically, we're updating from kernel 2.6.32.68 to 2.6.32.71
and glibc 2.11.1 to 2.12.1 here. The compiler toolchain is also
updated, but I don't think that's relevant for compatibility.

I've also enabled LLD, so this fixes #94324.

r? `@Mark-Simulacrum` cc `@uweigand`

2 years agoFor MIRI, cfg out the swap logic from 94212
Scott McMurray [Sun, 27 Feb 2022 02:57:15 +0000 (18:57 -0800)]
For MIRI, cfg out the swap logic from 94212

2 years agoAuto merge of #94373 - erikdesjardins:getitinl, r=Mark-Simulacrum
bors [Sun, 27 Feb 2022 01:23:48 +0000 (01:23 +0000)]
Auto merge of #94373 - erikdesjardins:getitinl, r=Mark-Simulacrum

Make TLS __getit #[inline(always)] on non-Windows

This may improve perf, and/or stop `externs` perf benchmarks from being flaky.

r? `@ghost`

2 years agoavoid rebuilding bootstrap when PATH changes
Ralf Jung [Sun, 27 Feb 2022 00:07:02 +0000 (19:07 -0500)]
avoid rebuilding bootstrap when PATH changes

2 years agoUpdate dist-s390x-dist image
Nikita Popov [Fri, 25 Feb 2022 13:31:12 +0000 (14:31 +0100)]
Update dist-s390x-dist image

Update to Ubuntu 20.04 and crosstool-ng 1.24.0. I've updated the
ct-ng config and then manually reset the kernel and glibc versions
to the oldest supported.

Specifically, we're updating from kernel 2.6.32.68 to 2.6.32.71
and glibc 2.11.1 to 2.12.1 here. The compiler toolchain is also
updated, but I don't think that's relevant for compatibility.

2 years agoAttrBuilder doesn't take a context in old LLVM
Erik Desjardins [Sat, 26 Feb 2022 22:16:01 +0000 (17:16 -0500)]
AttrBuilder doesn't take a context in old LLVM

2 years agouse attrbuilder to remove attrs in old LLVM
Erik Desjardins [Sat, 26 Feb 2022 21:58:45 +0000 (16:58 -0500)]
use attrbuilder to remove attrs in old LLVM

2 years agojust put smallvec lengths in the signature
Erik Desjardins [Sat, 26 Feb 2022 21:58:17 +0000 (16:58 -0500)]
just put smallvec lengths in the signature

2 years agoAuto merge of #93516 - nagisa:branch-protection, r=cjgillot
bors [Sat, 26 Feb 2022 21:53:03 +0000 (21:53 +0000)]
Auto merge of #93516 - nagisa:branch-protection, r=cjgillot

No branch protection metadata unless enabled

Even if we emit metadata disabling branch protection, this metadata may
conflict with other modules (e.g. during LTO) that have different branch
protection metadata set.

This is an unstable flag and feature, so ideally the flag not being
specified should act as if the feature wasn't implemented in the first
place.

Additionally this PR also ensures we emit an error if
`-Zbranch-protection` is set on targets other than the supported
aarch64. For now the error is being output from codegen, but ideally it
should be moved to earlier in the pipeline before stabilization.

2 years agoApply noundef attribute to all scalar types which do not permit raw init
Erik Desjardins [Sat, 12 Feb 2022 06:38:24 +0000 (01:38 -0500)]
Apply noundef attribute to all scalar types which do not permit raw init

Beyond `&`/`&mut`/`Box`, this covers `char`, discriminants, `NonZero*`, etc.
All such types currently cause a Miri error if left uninitialized,
and an `invalid_value` lint in cases like `mem::uninitialized::<char>()`

Note that this _does not_ change whether or not it is UB for `u64` (or
other integer types with no invalid values) to be undef.

2 years agorust-lang/portable-simd#239: Bitmask conversion trait
Jubilee [Sat, 26 Feb 2022 20:56:23 +0000 (12:56 -0800)]
rust-lang/portable-simd#239: Bitmask conversion trait

Another approach that fixes rust-lang/portable-simd#223, as an alternative to rust-lang/portable-simd#238.

This adds the `ToBitMask` trait, which is implemented on a vector for each bitmask type it supports.  This includes all unsigned integers with enough bits to contain it.  The byte array variant has been separated out for now into rust-lang/portable-simd#246 and still requires `generic_const_exprs`, but the integer variants no longer require it and can make it to nightly.

2 years agoAuto merge of #93449 - JakobDegen:restrict-hasdrop-optimization, r=cjgillot
bors [Sat, 26 Feb 2022 19:25:04 +0000 (19:25 +0000)]
Auto merge of #93449 - JakobDegen:restrict-hasdrop-optimization, r=cjgillot

Restrict query recursion in `needs_significant_drop`

Overly aggressive use of the query system to improve caching lead to query cycles and consequently ICEs. This patch fixes this by restricting the use of the query system as a cache to those cases where it is definitely correct.

Closes #92725 .

This is essentially a revert of #90845 for the significant drop case only. The general `needs_drop` still does the same thing. The hope is that this is enough to preserve the performance improvements of that PR while fixing the ICE. Should get a perf run to verify that this is the case.

cc `@cjgillot`

2 years agoAdd LLVM attributes in batches instead of individually
Erik Desjardins [Mon, 21 Feb 2022 16:19:16 +0000 (11:19 -0500)]
Add LLVM attributes in batches instead of individually

This should improve performance.

2 years ago2 - Make more use of let_chains
Caio [Sat, 26 Feb 2022 16:45:36 +0000 (13:45 -0300)]
2 - Make more use of let_chains

Continuation of #94376.

cc #53667

2 years agoAuto merge of #94329 - flip1995:clippyup, r=Manishearth
bors [Sat, 26 Feb 2022 16:44:17 +0000 (16:44 +0000)]
Auto merge of #94329 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoAdd test for #79465 to prevent regression
Guillaume Gomez [Sat, 26 Feb 2022 15:58:21 +0000 (16:58 +0100)]
Add test for #79465 to prevent regression

2 years agoAuto merge of #94376 - c410-f3r:more-let-chains, r=petrochenkov
bors [Sat, 26 Feb 2022 14:23:27 +0000 (14:23 +0000)]
Auto merge of #94376 - c410-f3r:more-let-chains, r=petrochenkov

Initiate the inner usage of `let_chains`

The intention here is create a strong and robust foundation for a possible future stabilization so please, do not let the lack of any external tool support prevent the merge of this PR. Besides, `let_chains` is useful by itself.

cc #53667

2 years agoUpdate Cargo.lock (Clippy version bump)
flip1995 [Sat, 26 Feb 2022 13:43:58 +0000 (14:43 +0100)]
Update Cargo.lock (Clippy version bump)

2 years agoMerge commit 'e329249b6a3a98830d860c74c8234a8dd9407436' into clippyup
flip1995 [Sat, 26 Feb 2022 13:26:21 +0000 (14:26 +0100)]
Merge commit 'e329249b6a3a98830d860c74c8234a8dd9407436' into clippyup

2 years agoAuto merge of #94078 - TaKO8Ki:suggest-float-literal-for-float-divided-by-integer...
bors [Sat, 26 Feb 2022 11:58:12 +0000 (11:58 +0000)]
Auto merge of #94078 - TaKO8Ki:suggest-float-literal-for-float-divided-by-integer, r=estebank

Suggest a float literal when dividing a floating-point type by `{integer}`

closes #93829

2 years agoMake more use of `let_chains`
Caio [Sat, 26 Feb 2022 10:43:47 +0000 (07:43 -0300)]
Make more use of `let_chains`

2 years agoDocument that pre-expansion lint passes are deprecated
xFrednet [Sat, 26 Feb 2022 10:32:07 +0000 (11:32 +0100)]
Document that pre-expansion lint passes are deprecated

2 years agoAuto merge of #94127 - erikdesjardins:debugattr, r=nikic
bors [Sat, 26 Feb 2022 09:41:19 +0000 (09:41 +0000)]
Auto merge of #94127 - erikdesjardins:debugattr, r=nikic

At opt-level=0, apply only ABI-affecting attributes to functions

This should provide a small perf improvement for debug builds,
and should more than cancel out the perf regression from adding noundef (https://github.com/rust-lang/rust/pull/93670#issuecomment-1038347581, #94106).

r? `@nikic`

2 years agoAuto merge of #94392 - matthiaskrgr:rollup-npscf95, r=matthiaskrgr
bors [Sat, 26 Feb 2022 07:00:33 +0000 (07:00 +0000)]
Auto merge of #94392 - matthiaskrgr:rollup-npscf95, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #93400 (Do not suggest using a const parameter when there are bounds on an unused type parameter)
 - #93982 (Provide extra note if synthetic type args are specified)
 - #94087 (Remove unused `unsound_ignore_borrow_on_drop`)
 - #94235 (chalk: Fix wrong debrujin index in opaque type handling.)
 - #94306 (Avoid exhausting stack space in dominator compression)

Failed merges:

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

2 years agoRollup merge of #94306 - Mark-Simulacrum:dom-fixups, r=jackh726
Matthias Krüger [Sat, 26 Feb 2022 06:52:44 +0000 (07:52 +0100)]
Rollup merge of #94306 - Mark-Simulacrum:dom-fixups, r=jackh726

Avoid exhausting stack space in dominator compression

Doesn't add a test case -- I ended up running into this while playing with the generated example from #43578, which we could do with a run-make test (to avoid checking a large code snippet into tree), but I suspect we don't want to wait for it to compile (locally it takes ~14s -- not terrible, but doesn't seem worth it to me). In practice stack space exhaustion is difficult to test for, too, since if we set the bound too low a different call structure above us (e.g., a nearer ensure_sufficient_stack call) would let the test pass even with the old impl, most likely.

Locally it seems like this manages to perform approximately equivalently to the recursion, but will run perf to confirm.