Commit Graph

227176 Commits

Author SHA1 Message Date
bors
677710eaf0 Auto merge of #112638 - lqd:rpo, r=cjgillot
Switch the BB CFG cache from postorder to RPO

The `BasicBlocks` CFG cache is interesting:
- it stores a postorder, but `traversal::postorder` doesn't use it
- `traversal::reverse_postorder` does traverse the postorder cache backwards
- we do more RPO traversals than postorder traversals (around 20x on the perf.rlo benchmarks IIRC) but it's not cached
- a couple places here and there were manually reversing the non-cached postorder traversal

This PR switches the order of the cache, and makes a bit more use of it. This is a tiny win locally, but it's also for consistency and aesthetics.

r? `@ghost`
2023-06-18 12:45:41 +00:00
Jakub Beránek
f3a4cf13a7
Merge mingw-1/2 CI jobs 2023-06-18 14:40:52 +02:00
Tom Martin
4b5a5a4529
Add translatable diagnostic for various strings in resolve::unresolved_macro_suggestions 2023-06-18 12:32:40 +01:00
Tom Martin
355a689542
Add translatable diagnostic for cannot find in this scope 2023-06-18 12:28:17 +01:00
Tom Martin
50c971a0b7
Add translatable diagnostic for invalid imports 2023-06-18 12:28:17 +01:00
Tom Martin
8fa9003621
Add translatable diagnostic for changing import binding 2023-06-18 12:28:16 +01:00
bors
cd3bf9fe51 Auto merge of #15076 - Veykril:bindings, r=Veykril
internal: Shrink size of hir::Binding
2023-06-18 10:19:27 +00:00
Lukas Wirth
c3186202a2 Shrink size of hir::Binding 2023-06-18 12:03:04 +02:00
bors
76fb0e3808 Auto merge of #112755 - matthiaskrgr:rollup-e4bhbgn, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #107200 (io: soften ‘at most one write attempt’ requirement in io::Write::write)
 - #112667 (Move WF/ConstEvaluatable goal to clause)
 - #112685 (std: only depend on dlmalloc for wasm*-unknown)
 - #112722 (bootstrap: check for dry run when copying env vars for msvc)
 - #112734 (Make `Bound::predicates`  use `Clause`)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-18 10:02:56 +00:00
Daniel Henry-Mantilla
94f7a7931c [doc] poll_fn: explain how to pin captured state safely
Usage of `Pin::new_unchecked(&mut …)` is dangerous with `poll_fn`, even
though the `!Unpin`-infectiousness has made things smoother.
Nonetheless, there are easy ways to avoid the need for any `unsafe`
altogether, be it through `Box::pin`ning, or the `pin!` macro. Since the
latter only works within an `async` context, showing an example
artifically introducing one ought to help people navigate this subtlety
with safety and confidence.
2023-06-18 09:56:13 +00:00
Jakub Beránek
d25e8d79a1
Test x.ps1 in msvc CI job 2023-06-18 11:50:05 +02:00
bors
5dccf3010b Auto merge of #15075 - Veykril:bindings, r=Veykril
fix: Add binding definition for for-expr iterator desugared binding
2023-06-18 09:45:49 +00:00
Lukas Wirth
83d7724629 fix: Add binding definition for for-expr iterator desugared binding 2023-06-18 11:44:01 +02:00
bors
a1b536ec6f Auto merge of #15054 - ponyii:fix/implement-missing-members-do-not-transform-const-params, r=lowr
fix: implement missing members doesn't transform const params and default types

Fixes https://github.com/rust-lang/rust-analyzer/issues/13363
2023-06-18 09:30:13 +00:00
Rémy Rakic
08a9f25245 remove redundant combinators between PO and RPO 2023-06-18 09:16:40 +00:00
David Weikersdorfer
09707ee12a
Same for BorrowRef 2023-06-18 01:14:45 -07:00
David Weikersdorfer
c4c428b6da
Use BorrowFlag instead of explicit isize
The integer type tracking borrow count has a typedef called `BorrowFlag`. This type should be used instead of explicit `isize`.
2023-06-18 00:46:51 -07:00
Matthias Krüger
3436069c34
Rollup merge of #112734 - dswij:bounds-predicates-clause, r=compiler-errors
Make `Bound::predicates`  use `Clause`

Part of #107250

`Bound::predicates` returns an iterator over `Binder<_, Clause>` instead of `Predicate`.

I tried updating `explicit_predicates_of` as well, but it seems that it needs a lot more change than I thought. Will do it in a separate PR instead.
2023-06-18 08:06:43 +02:00
Matthias Krüger
a066e1b7a6
Rollup merge of #112722 - DrMeepster:patch-2, r=clubby789
bootstrap: check for dry run when copying env vars for msvc

The new synthetic targets for mir-opt blessing aren't added to `builder.cc` during dry runs, causing `x.py test tests/mir-opt --bless`  to crash on MSVC when it tries to copy env vars to the C compiler invocation. This PR adds a check for dry run to fix the panic.
2023-06-18 08:06:42 +02:00
Matthias Krüger
eb40590579
Rollup merge of #112685 - cuviper:wasm-dlmalloc, r=Mark-Simulacrum
std: only depend on dlmalloc for wasm*-unknown

It was already filtered out for emscripten, but wasi doesn't need dlmalloc
either since it reuses `unix/alloc.rs`.
2023-06-18 08:06:42 +02:00
Matthias Krüger
8d3d3cc0ba
Rollup merge of #112667 - compiler-errors:wf-goal-is-clause, r=lcnr
Move WF/ConstEvaluatable goal to clause

It can show up in a param-env, so I think it needs to be a clause kind.

r? ```@lcnr``` or ```@oli-obk```
2023-06-18 08:06:41 +02:00
Matthias Krüger
876f00a655
Rollup merge of #107200 - mina86:c, r=Amanieu
io: soften ‘at most one write attempt’ requirement in io::Write::write

At the moment, documentation of std::io::Write::write indicates that
call to it ‘represents at most one attempt to write to any wrapped
object’.  It seems that such wording was put there to contrast it with
pre-1.0 interface which attempted to write all the data (it has since
been changed in [RFC 517]).

However, the requirement puts unnecessary constraints and may
complicate adaptors which perform non-trivial transformations on the
data.  For example, they may maintain an internal buffer which needs
to be written out before the write method accepts more data.  It might
be natural to code the method such that it flushes the buffer and then
grabs another chunk of user data.  With the current wording in the
documentation, the adaptor would be forced to return Ok(0).

This commit softens the wording such that implementations can choose
code structure which makes most sense for their particular use case.

While at it, elaborate on the meaning of `Ok(0)` return pointing out
that the write_all methods interprets it as an error.

[RFC 517]: https://rust-lang.github.io/rfcs/0517-io-os-reform.html
2023-06-18 08:06:41 +02:00
Deadbeef
89c24af133 Better error for non const PartialEq call generated by match 2023-06-18 05:24:38 +00:00
bors
0c2c243342 Auto merge of #112599 - saethlin:cleaner-panics, r=thomcc
Launch a non-unwinding panic for misaligned pointer deref

This panic already never unwinds, but that's only because it always hits the unwind guard that's created by our `UnwindAction::Terminate`. Hitting the unwind guard generates a huge double-panic backtrace. Now we generate a normal-looking panic message when this check is hit.

r? `@thomcc`
2023-06-18 01:58:51 +00:00
Zalathar
b198589214 Don't try to auto-bless 32-bit mir-opt tests on ARM Mac hosts
Blessing 32-bit tests on 64-bit hosts relies on having a corresponding 32-bit
target that can be built "easily" on those hosts.

ARM Macs don't have a corresponding 32-bit target, so trying to build one is
usually going to fail.
2023-06-18 11:17:19 +10:00
bors
ed7281e784 Auto merge of #112595 - hargoniX:l4re_fix, r=Mark-Simulacrum
fix: get the l4re target working again

This is based on work from https://github.com/rust-lang/rust/pull/103966, addressing the review comment by `@m-ou-se` at the time and "fixing" the (probably newly) missing read_buf.
2023-06-17 21:59:08 +00:00
Michael Goulet
4343d36079 Move some bounds computation out of astconv into its own file 2023-06-17 21:27:13 +00:00
Michael Goulet
6594c75449 Move ConstEvaluatable to Clause 2023-06-17 21:27:13 +00:00
Michael Goulet
52d3fc93f2 Move WF goal to clause 2023-06-17 21:20:20 +00:00
bors
3b2073f076 Auto merge of #112746 - matthiaskrgr:rollup-se59bfd, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #110805 (Github action to periodically `cargo update` to keep dependencies current)
 - #112435 (Allow overwriting the sysroot compile flag via --rustc-args)
 - #112610 (Bump stdarch)
 - #112619 (Suggest bumping download-ci-llvm-stamp if the build config for llvm changes)
 - #112738 (make ice msg "Unknown runtime phase" a bit nicer)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-17 19:16:11 +00:00
Matthias Krüger
5518eb863f
Rollup merge of #112738 - matthiaskrgr:ice_msg, r=oli-obk
make ice msg "Unknown runtime phase" a bit nicer
2023-06-17 18:27:31 +02:00
Matthias Krüger
27af5ed4a0
Rollup merge of #112619 - jyn514:llvm-reminder, r=Mark-Simulacrum
Suggest bumping download-ci-llvm-stamp if the build config for llvm changes

This will hopefully avoid issues like https://github.com/rust-lang/rust/issues/110474 where the uploaded `rust-dev` component doesn't match the one you'd get if you built LLVM from source.

cc https://github.com/rust-lang/rust/issues/110474#issuecomment-1516403887
2023-06-17 18:27:31 +02:00
Matthias Krüger
703b728ce2
Rollup merge of #112610 - scottmcm:update-stdarch, r=Amanieu
Bump stdarch

In particular to pick up the stabilization of the AVX512 types (but not intrinsics) that was FCPed in https://github.com/rust-lang/stdarch/pull/1436.
2023-06-17 18:27:31 +02:00
Matthias Krüger
9fff866193
Rollup merge of #112435 - antoyo:allow-overwrite-sysroot, r=Mark-Simulacrum
Allow overwriting the sysroot compile flag via --rustc-args

Hi.
As discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/How.20to.20overwrite.20sysroot.20in.20x.2Epy.20test/near/364272269), this is a solution to allow the codegens to overwrite the sysroot as part of their test suite.
Thanks for the review.
2023-06-17 18:27:30 +02:00
Matthias Krüger
be0f3bdc3e
Rollup merge of #110805 - pitaj:master, r=Mark-Simulacrum
Github action to periodically `cargo update` to keep dependencies current

Opens a PR periodically with the results of `cargo update`. If an unmerged PR for the branch `cargo_update` already exists, it will edit then reopen it if necessary.

~~This also uses [`cargo-upgrades`](https://gitlab.com/kornelski/cargo-upgrades) to provide a list of available major upgrades in the PR body.~~

It includes the list of changes output by `cargo update` in the commit message and PR body. Note that this output is currently sub-optimal due to https://github.com/rust-lang/cargo/issues/9408, but if updates are made more regularly that is less likely to show up.

Example PR: https://github.com/pitaj/rust/pull/2
Example action run: https://github.com/pitaj/rust/actions/runs/5035731903
Prior discussion: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/dependabot.20updates.3F

Up for discussion:
- What period do we want? Currently weekly
- What user should it use? Currently "Github Actions"
- Do we need the extra security of provided by executing `cargo update` and `cargo-upgrades` in a separate job?
  If not I can simplify it to not need artifacts.
- PR message wording
- PR should probably always be `rollup=always`?
- What branch should it use?
- What should it do if no updates are available? Currently fails the job on empty commit
- Should the yml file live in `src/ci` instead of directly under workflows?
- ~~Is using the latest nightly toolchain enough to ensure compatibility with `Cargo.lock` and `Cargo.toml`s in master?~~
  Now pulls the bootstrap version from stage0.json

r? infra
2023-06-17 18:27:30 +02:00
bors
a8a29070f0 Auto merge of #100036 - DrMeepster:box_free_free_box, r=oli-obk
Remove `box_free` lang item

This PR removes the `box_free` lang item, replacing it with `Box`'s `Drop` impl. Box dropping is still slightly magic because the contained value is still dropped by the compiler.
2023-06-17 16:10:57 +00:00
bors
e1c29d137d Auto merge of #112739 - matthiaskrgr:rollup-8cfggml, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #112352 (Fix documentation build on FreeBSD)
 - #112644 (Correct types in method descriptions of `NonZero*` types)
 - #112683 (fix ICE on specific malformed asm clobber_abi)
 - #112707 ([rustdoc] Fix invalid handling of "going back in history" when "go to only search result" setting is enabled)
 - #112719 (Replace fvdl with ffx, allow test without install)
 - #112728 (Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` output)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-06-17 13:19:29 +00:00
Matthias Krüger
32aee06448 make ice msg "Unknown runtime phase" a bit nicer 2023-06-17 13:55:11 +02:00
Matthias Krüger
981a2a2c00
Rollup merge of #112728 - Zalathar:spanview-charset, r=Nilstrieb
Add `<meta charset="utf-8">` to `-Zdump-mir-spanview` output

Without an explicit `<meta charset>` declaration, some browsers (e.g. Safari) won't detect the page encoding as UTF-8, causing unicode characters in the dump output to display incorrectly.
2023-06-17 12:43:32 +02:00
Matthias Krüger
c3425931d2
Rollup merge of #112719 - djkoloski:fuchsia_test_runner_remove_fvdl, r=tmandry
Replace fvdl with ffx, allow test without install

Along with replacing fvdl uses with the equivalent ffx commands, this also switches from using the install path for libstd-*.so and libtest-*.so to using the build directory (now passed on the command line). The user no longer needs to run x.py install before running tests now, and the correct libstd and libtest are detected on run instead of startup so the test runner can handle recompilations after starting the testing environment.

r? ``@tmandry``
2023-06-17 12:43:31 +02:00
Matthias Krüger
63799ba549
Rollup merge of #112707 - GuillaumeGomez:back-in-history-fix, r=notriddle
[rustdoc] Fix invalid handling of "going back in history" when "go to only search result" setting is enabled

You can test the fix [here](https://rustdoc.crud.net/imperio/back-in-history-fix/lib2/index.html). Enable "Directly go to item in search if there is only one result", then search for `HasALongTraitWithParams` and finally go back to previous page. It should be back on the `index.html` page.

The reason for this bug is that the JS state is cached as is, so when we go back to the page, it resumes where it was left, somewhat (very weird), meaning the search is run again etc. The best way to handle this is to force the JS re-execution in this case so that it doesn't try to resume from where it left and then lead us back to the current page.

r? ``@notriddle``
2023-06-17 12:43:31 +02:00
Matthias Krüger
7051c84326
Rollup merge of #112683 - asquared31415:asm_clobber_ice, r=compiler-errors
fix ICE on specific malformed asm clobber_abi

fixes #112635
2023-06-17 12:43:30 +02:00
Matthias Krüger
ba3e535c07
Rollup merge of #112644 - zica87:nonZeroTypes, r=Mark-Simulacrum
Correct types in method descriptions of `NonZero*` types

- `$Int`: e.g. i32, usize
- `$Ty`: e.g. NonZeroI32, NonZeroUsize

|method|current description|after my changes|
|-|-|-|
|`saturating_add`|...Return `$Int`::MAX on overflow.|...Return `$Ty`::MAX on overflow.|
|`checked_abs`|...returns None if self == `$Int`::MIN.|...returns None if self == `$Ty`::MIN.|
|`checked_neg`|...returning None if self == i32::MIN.|...returning None if self == `$Ty`::MIN.|
|`saturating_neg`|...returning MAX if self == i32::MIN...|...returning `$Ty`::MAX if self == `$Ty`::MIN...|
|`saturating_mul`|...Return `$Int`::MAX...|...Return `$Ty`::MAX...|
|`saturating_pow`|...Return `$Int`::MIN or `$Int`::MAX...|...Return `$Ty`::MIN or `$Ty`::MAX...|

---

For example:

```rust
pub const fn saturating_neg(self) -> NonZeroI128
```

- current
  - Saturating negation. Computes `-self`, returning `MAX` if `self == i32::MIN` instead of overflowing.
- after my changes
  - Saturating negation. Computes `-self`, returning `NonZeroI128::MAX` if `self == NonZeroI128::MIN` instead of overflowing.
2023-06-17 12:43:30 +02:00
Matthias Krüger
d2120b7d42
Rollup merge of #112352 - dankm:fbsd_doc_fix, r=thomcc
Fix documentation build on FreeBSD

After the socket ancillary data implementation was introduced, the documentation build was broken on FreeBSD hosts, add the same workaround as for the existing implementations.

Fixes the doc build after #91793
2023-06-17 12:43:29 +02:00
bors
7513407ac8 Auto merge of #112330 - the8472:use-buf-reader-buffer, r=thomcc
Extend io::copy buffer reuse to BufReader too

previously it was only able to use BufWriter. This was due to a limitation in the BufReader generics that prevented specialization. This change works around the issue by using `BufReader where Self: Read` instead of `BufReader<I> where I: Read`. This limits our options, e.g. we can't access the inner reader, but it happens to work out if we rely on some implementation details.

Copying 1MiB from `/dev/zero` to `/dev/null` through a 256KiB BufReader yields following improvements

```
OLD:
    io::copy::tests::bench_copy_buf_reader  51.44µs/iter +/- 703.00ns
NEW:
    io::copy::tests::bench_copy_buf_reader  18.55µs/iter +/- 237.00ns
```

Previously this would read 256KiB into the reader but then copy 8KiB chunks to the writer through an additional intermediate buffer inside `io::copy`. Since those devices don't do much work most of the speedup should come from fewer syscalls and avoided memcopies.

The b3sum crate [notes that the default buffer size in io::copy is too small](4108923f52/b3sum/src/main.rs (L235-L239)). With this optimization they could achieve the desired performance by wrapping the reader in a `BufReader` instead of handrolling it.

Currently the optimization doesn't apply to things like `StdinLock`, but this can be addressed with an additional `AsMutBufReader` specialization trait.
2023-06-17 10:30:59 +00:00
dswij
f874345784 Bound::predicates to return Clause 2023-06-17 17:16:30 +08:00
The 8472
3738785735 Extend io::copy buffer reuse to BufReader too
previously it was only able to use BufWriter. This was due to a limitation in the
BufReader generics that prevented specialization. This change works around the issue
by using `where Self: Read` instead of `where I: Read`. This limits our options, e.g.
we can't access BufRead methods, but it happens to work out if we rely on some
implementation details.
2023-06-17 11:07:04 +02:00
bors
fcfc6afe05 Auto merge of #15069 - Veykril:analysis-stat-stuff, r=Veykril
analysis-stats: Add body lowering step, track time of each step separtely
2023-06-17 08:58:10 +00:00
Lukas Wirth
b5e0452c71 Lazy progress reporting 2023-06-17 10:34:44 +02:00
Zalathar
3eddb29555 Add <meta charset="utf-8"> to -Zdump-mir-spanview output 2023-06-17 18:31:35 +10:00