Commit Graph

163830 Commits

Author SHA1 Message Date
bors
4a56cbec59 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`
2022-03-01 08:57:46 +00:00
bors
6e5a6ffb14 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 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-03-01 06:15:54 +00:00
Matthias Krüger
6aab954645
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
2022-03-01 06:22:32 +01:00
Matthias Krüger
2353e835c5
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.
2022-03-01 06:22:32 +01:00
Laurențiu Nicola
276d5fef3f ⬆️ rust-analyzer 2022-03-01 07:20:26 +02:00
bors
6343edfa11 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
2022-03-01 03:26:11 +00:00
Dylan DPC
4001d98019
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`
2022-03-01 03:41:53 +01:00
Dylan DPC
bf6954b2fc
Rollup merge of #94448 - c410-f3r:yet-more-let-chains, r=estebank
5 - Make more use of `let_chains`

Continuation of #94376.

cc #53667
2022-03-01 03:41:52 +01:00
Dylan DPC
5bd119da84
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
2022-03-01 03:41:51 +01:00
Dylan DPC
06d47a414b
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]: d6ea38f32d
[^2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-setsockopt
2022-03-01 03:41:50 +01:00
Dylan DPC
daed86445d
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.
2022-03-01 03:41:49 +01:00
Dylan DPC
2fb5a16438
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`
2022-03-01 03:41:47 +01:00
Dylan DPC
4bd40d67d8
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)
2022-03-01 03:41:46 +01:00
Caio
fe94f78b9b 6 - Make more use of let_chains
Continuation of #94376.

cc #53667
2022-02-28 21:12:52 -03:00
Simonas Kazlauskas
df701a292c Querify global_backend_features
At the very least this serves to deduplicate the diagnostics that are
output about unknown target features provided via CLI.
2022-03-01 01:57:25 +02:00
Simonas Kazlauskas
c97c216efd Direct users towards using Rust feature names in CLI
If they are trying to use features rustc doesn't yet know about,
request a feature request.

Additionally, also warn against using feature names without leading `+`
or `-` signs.
2022-03-01 01:57:10 +02:00
bors
8d6f527530 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?
2022-02-28 23:38:05 +00:00
Fausto
abcccc9143 Suggest adding a new lifetime parameter when two elided lifetimes should match up for traits and impls.
Issue #94462
2022-02-28 18:16:19 -05:00
bors
4ce3749235 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
2022-02-28 21:17:11 +00:00
Tomasz Miąsko
99a77798d3 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.
2022-02-28 21:48:42 +01:00
Jon Gjengset
6b476fe6de 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
2022-02-28 12:42:09 -08:00
Matthias Krüger
34657ccbe7
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`
2022-02-28 20:05:18 +01:00
Matthias Krüger
5be38d2bb3
Rollup merge of #94445 - c410-f3r:more-let-chains, r=cjgillot
4 - Make more use of `let_chains`

Continuation of #94376.

cc #53667
2022-02-28 20:05:17 +01:00
Matthias Krüger
975a0e0141
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).
2022-02-28 20:05:15 +01:00
Matthias Krüger
934079180d
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.
2022-02-28 20:05:14 +01:00
Matthias Krüger
a040e2f4f5
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).
2022-02-28 20:05:13 +01:00
Matthias Krüger
9d23c320e4
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.
2022-02-28 20:05:13 +01:00
Caio
d956c8b816 5 - Make more use of let_chains 2022-02-28 15:52:36 -03:00
Esteban Kuber
f42b4f595e 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).
2022-02-28 18:22:45 +00:00
Jubilee Young
4de99e187c Sync rust-lang/portable-simd@5f49d4c843 2022-02-28 10:17:40 -08:00
Guillaume Gomez
8f36d4a536 Update ui test with the add of E0726 explanation 2022-02-28 15:51:05 +01:00
Guillaume Gomez
911de7b98c Add explanation for E0726 2022-02-28 15:51:05 +01:00
Eric Huss
31267e8007 Fix extracting submodules on windows. 2022-02-28 06:31:50 -08:00
Eric Huss
fa73cf932b Error if submodule fetch fails. 2022-02-28 06:30:45 -08:00
bors
97cde9fe08 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
2022-02-28 14:20:13 +00:00
Matthias Krüger
ea39f46cad
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.
2022-02-28 12:57:48 +01:00
Matthias Krüger
01ffa5fa0c
Rollup merge of #93413 - lsimons:patch-1, r=Dylan-DPC
Fix broken link from rustdoc docs to ayu theme
2022-02-28 12:57:47 +01:00
Matthias Krüger
4115c3f1ac
Rollup merge of #93389 - cameron1024:issue-90847-regression, r=Mark-Simulacrum
regression for issue 90847

Adds a regression test for issue #90847
2022-02-28 12:57:46 +01:00
Matthias Krüger
354e014b84
Rollup merge of #92642 - avborhanian:master, r=Dylan-DPC
Update search location from a relative path to absolute

This should address issue #90311.
2022-02-28 12:57:45 +01:00
Matthias Krüger
770ee32b34
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}`.
2022-02-28 12:57:44 +01:00
bors
edda7e959d 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.
2022-02-28 11:54:17 +00:00
Caio
e3e902bb06 4 - Make more use of let_chains
Continuation of #94376.

cc #53667
2022-02-28 07:49:56 -03:00
bors
48132caac2 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.
2022-02-28 08:25:26 +00:00
bors
427cf81206 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.
2022-02-28 06:11:20 +00:00
Erik Desjardins
dce14cfacc Remove LLVM attribute removal
This was necessary before, because `declare_raw_fn` would always apply
the default optimization attributes to every declared function,
and then `attributes::from_fn_attrs` would have to remove the default
attributes in the case of, e.g. `#[optimize(speed)]` in a `-Os` build.

However, every relevant callsite of `declare_raw_fn` (i.e. where we
actually generate code for the function, and not e.g. a call to an
intrinsic, where optimization attributes don't [?] matter)
calls `from_fn_attrs`, so we can simply remove the attribute setting
from `declare_raw_fn`, and rely on `from_fn_attrs` to apply the correct
attributes all at once.
2022-02-28 00:02:11 -05:00
DrMeepster
d316aba04c expadn abi check + condese & fix tests 2022-02-27 20:25:16 -08:00
Erik Desjardins
0c78433749 update vec-shrink-panik test to allow panic_no_unwind in landingpads 2022-02-27 23:15:49 -05:00
Erik Desjardins
851fcc7a54 Revert "Auto merge of #92419 - erikdesjardins:coldland, r=nagisa"
This reverts commit 4f49627c6f, reversing
changes made to 028c6f1454.
2022-02-27 23:11:03 -05:00
Michael Goulet
75430670b3 only check method inputs once 2022-02-27 19:47:40 -08:00
bors
ec0ab61e8a Auto merge of #94437 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/94318
r? `@ghost`
2022-02-28 03:44:19 +00:00