Commit Graph

250705 Commits

Author SHA1 Message Date
Matthias Krüger
d1fca06662
Rollup merge of #122995 - Zalathar:flags-mir-opt, r=Mark-Simulacrum
Clean up unnecessary headers/flags in coverage mir-opt tests

During #122542, I noticed that some of the headers and flags I had copied over from `tests/mir-opt/instrument_coverage.rs`  were unnecessary. And while working to remove those, I noticed even more that could be removed or replaced.
2024-03-25 11:00:13 +01:00
Matthias Krüger
e3fbaa87c9
Rollup merge of #122990 - SkiFire13:transmute-may-copy, r=jhpratt
Clarify transmute example

The example claims using an iterator will copy the entire vector, but this is not true in practice thanks to internal specializations in the stdlib (see https://godbolt.org/z/cnxo3MYs5 for confirmation that this doesn't reallocate nor iterate over the vec's elements). Since neither the copy nor the optimization is guaranteed I opted for saying that they _may_ happen.
2024-03-25 11:00:13 +01:00
Matthias Krüger
fbb81fa89c
Rollup merge of #122982 - Zalathar:bootstrap-coverage-docs, r=onur-ozkan
Add more comments to the bootstrap code that handles `tests/coverage`

At the bootstrap level, coverage tests are a bit more complicated than other test suites, because we want to run the same set of test files in multiple different modes, in a way that's convenient and flexible when invoked manually.

This PR adds a few more comments to explain what's going on.
2024-03-25 11:00:12 +01:00
Matthias Krüger
4cae68b0cf
Rollup merge of #122858 - nnethercote:tweak-parse_dot_suffix_expr, r=est31
Tweak `parse_dot_suffix_expr`

I find this function hard to understand, so I rewrote it.

r? ```@est31```
2024-03-25 11:00:12 +01:00
bors
dda2372cf3 Auto merge of #122802 - estebank:unconstrained-generic-const, r=Nadrieril
Provide structured suggestion for unconstrained generic constant

```
error: unconstrained generic constant
  --> $DIR/const-argument-if-length.rs:18:10
   |
LL |     pad: [u8; is_zst::<T>()],
   |          ^^^^^^^^^^^^^^^^^^^
   |
help: try adding a `where` bound
   |
LL | pub struct AtLeastByte<T: ?Sized> where [(); is_zst::<T>()]: {
   |                                   ++++++++++++++++++++++++++
```

Detect when the constant expression isn't `usize` and suggest casting:

```
error: unconstrained generic constant
 --> f300.rs:6:10
  |
6 |     bb::<{!N}>();
  |          ^^^^
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs:3539:36
  |
help: try adding a `where` bound
  |
5 | fn b<const N: bool>() where [(); {!N} as usize]: {
  |                       ++++++++++++++++++++++++++
```

Fix #122395.
2024-03-25 09:59:37 +00:00
bors
42198bf562 Auto merge of #122968 - rust-lang:cargo_update, r=Mark-Simulacrum
Weekly `cargo update`

Automation to keep dependencies in `Cargo.lock` current.

The following is the output from `cargo update`:

```txt
    Updating aho-corasick v1.1.2 -> v1.1.3
    Updating backtrace v0.3.69 -> v0.3.71
    Updating bitflags v2.4.2 -> v2.5.0
    Updating bytes v1.5.0 -> v1.6.0
    Updating cargo-platform v0.1.7 -> v0.1.8
    Updating fastrand v2.0.1 -> v2.0.2
    Updating indexmap v2.2.5 -> v2.2.6
    Updating libz-sys v1.1.15 -> v1.1.16
    Updating rayon v1.9.0 -> v1.10.0
    Updating reqwest v0.11.26 -> v0.11.27 (latest: v0.12.1)
    Updating rustix v0.38.31 -> v0.38.32
    Updating smallvec v1.13.1 -> v1.13.2
    Updating syn v2.0.53 -> v2.0.55
    Updating uuid v1.7.0 -> v1.8.0
note: pass `--verbose` to see 87 unchanged dependencies behind latest
```
2024-03-25 06:39:44 +00:00
bors
fa374a8071 Auto merge of #122951 - Nilstrieb:nodejs20, r=Kobzol
Update upload-artifact to v4

This contains a breaking change around artifact merging no longer being done. This was not relied on, so it's fine.
2024-03-25 04:39:30 +00:00
Zalathar
1bbab7148b Add more comments to the bootstrap code that handles tests/coverage 2024-03-25 15:31:33 +11:00
Nicholas Nethercote
dce0f7f5c2 Clarify parse_dot_suffix_expr.
For the `MiddleDot` case, current behaviour:
- For a case like `1.2`, `sym1` is `1` and `sym2` is `2`, and `self.token`
  holds `1.2`.
- It creates a new ident token from `sym1` that it puts into `self.token`.
- Then it does `bump_with` with a new dot token, which moves the `sym1`
  token into `prev_token`.
- Then it does `bump_with` with a new ident token from `sym2`, which moves the
  `dot` token into `prev_token` and discards the `sym1` token.
- Then it does `bump`, which puts whatever is next into `self.token`,
  moves the `sym2` token into `prev_token`, and discards the `dot` token
  altogether.

New behaviour:
- Skips creating and inserting the `sym1` and dot tokens, because they are
  unnecessary.
- This also demonstrates that the comment about `Spacing::Alone` is
  wrong -- that value is never used. That comment was added in #77250,
  and AFAICT it has always been incorrect.

The commit also expands comments. I found this code hard to read
previously, the examples in comments make it easier.
2024-03-25 13:08:07 +11:00
Nicholas Nethercote
9c091160dc Change parse_expr_tuple_field_access.
Pass in the span for the field rather than using `prev_token`.
Also rename it `mk_expr_tuple_field_access`, because it doesn't do any
actual parsing, it just creates an expression with what it's given.

Not much of a clarity win by itself, but unlocks additional subsequent
simplifications.
2024-03-25 13:05:59 +11:00
Nicholas Nethercote
90eeb3d681 Remove next_token handling from parse_expr_tuple_field_access.
It's clearer at the call site.
2024-03-25 13:05:59 +11:00
Nicholas Nethercote
42066b029f Inline and remove Parser::parse_expr_tuple_field_access_float.
It has a single call site, and afterwards all the calls to
`parse_expr_tuple_field_access` are in a single method, which is nice.
2024-03-25 13:05:59 +11:00
Michael Goulet
e6918b1e5d Add async-closures/once.rs back to cranelift tests 2024-03-24 21:42:32 -04:00
bors
13dac8fb73 Auto merge of #122721 - oli-obk:merge_queries, r=davidtwco
Replace `mir_built` query with a hook and use mir_const everywhere instead

A small perf improvement due to less dep graph handling.

Mostly just a cleanup to get rid of one of our many mir queries
2024-03-25 01:33:46 +00:00
Nicholas Nethercote
50b49aec36 Temporarily remove nnethercote from the review rotation.
I will be on vacation for the next three weeks. I will re-add myself
when I return.
2024-03-25 10:36:55 +11:00
Matthew Maurer
40f41e7e89 CFI: Support arbitrary receivers
Previously, we only rewrote `&self` and `&mut self` receivers. By
instantiating the method from the trait definition, we can make this
work work with arbitrary legal receivers instead.
2024-03-24 22:46:48 +00:00
Reed
58e2ad3d58 Amended wording 2024-03-24 12:20:39 -07:00
bors
0824b300eb Auto merge of #122658 - cuviper:gccjit-archive, r=Mark-Simulacrum
ci: Build gccjit from a git archive

A full `git clone` of GCC includes quite a lot of history, and it's
completely unnecessary for building it in CI. We can use a GitHub
archive URL to get a simple tarball that is much faster to download.

Also, the `gcc-build` directory can be removed after install to reduce
the image size even further.
2024-03-24 18:15:27 +00:00
Matthew Maurer
ea4518522f CFI: Handle dyn with no principal
In user-facing Rust, `dyn` always has at least one predicate following
it. Unfortunately, because we filter out marker traits from receivers at
callsites and `dyn Sync` is, for example, legal, this results in us
having `dyn` types with no predicates on occasion in our alias set
encoding. This patch handles cases where there are no predicates in a
`dyn` type which are relevant to its alias set.

Fixes #122998
2024-03-24 16:58:33 +00:00
bors
d36bdd19f2 Auto merge of #123004 - matthiaskrgr:rollup-s3v4p50, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #122737 (conditionally ignore fatal diagnostic in the SilentEmitter)
 - #122757 (Fixed the `private-dependency` bug)
 - #122886 (add test for #90192)
 - #122937 (Unbox and unwrap the contents of `StatementKind::Coverage`)
 - #122949 (Add a regression test for #117310)
 - #122962 (Track run-make-support lib in common inputs stamp)
 - #122977 (Rename `Arguments::as_const_str` to `as_statically_known_str`)
 - #122983 (Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSD)
 - #122984 (panic-in-panic-hook: formatting a message that's just a string is risk-free)
 - #122992 (std:🧵 refine available_parallelism for solaris/illumos.)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-03-24 16:09:51 +00:00
bors
dcddf24626 Auto merge of #3402 - RalfJung:miri-script, r=RalfJung
miri script: build with stable toolchain

`./miri toolchain` sets up a `rustup override miri`. But then if something goes wrong and the `miri` toolchain doesn't work, one can't even run `./miri toolchain` again as building miri-script needs a toolchain...

So let's always use stable to build miri-script, making it override-independent. I assume everyone will have that installed.
2024-03-24 16:08:43 +00:00
Matthias Krüger
cdf86bf443
Rollup merge of #122992 - devnexen:available_parallelism_sol_upd, r=Amanieu
std:🧵 refine available_parallelism for solaris/illumos.

Rather than the system-wide available cpus fallback solution, we fetch the cpus bound to the current process.
2024-03-24 17:08:19 +01:00
Matthias Krüger
f67fb08605
Rollup merge of #122984 - RalfJung:panic-in-hook, r=Amanieu
panic-in-panic-hook: formatting a message that's just a string is risk-free

This slightly improves the output in the 'panic while processing panic' case if the panic message does not involve any formatting. Follow-up to https://github.com/rust-lang/rust/pull/122930.

r? ``@Amanieu``
2024-03-24 17:08:19 +01:00
Matthias Krüger
a5852ef941
Rollup merge of #122983 - taiki-e:bsd, r=workingjubilee
Fix build failure on ARM/AArch64/PowerPC/RISC-V FreeBSD/NetBSD

Fixes https://github.com/rust-lang/rust/pull/121881#discussion_r1536764650

Checked targets: aarch64-unknown-freebsd, powerpc64-unknown-freebsd, armv7-unknown-freebsd, riscv64gc-unknown-freebsd, aarch64-unknown-netbsd.

r? ``@Amanieu``
cc ``@devnexen``
2024-03-24 17:08:18 +01:00
Matthias Krüger
6b1f4e44d2
Rollup merge of #122977 - cuviper:as_statically_known_str, r=RalfJung
Rename `Arguments::as_const_str` to `as_statically_known_str`

While `const` has a particular meaning about language guarantees, here
we need a fuzzier notion like whether constant propagation was
effective, and `statically_known` is the best term we have for now.

r? ``@RalfJung``
2024-03-24 17:08:18 +01:00
Matthias Krüger
5281fe29cc
Rollup merge of #122962 - jieyouxu:stamp-rmake-support-lib, r=onur-ozkan
Track run-make-support lib in common inputs stamp

So that when the support library gets modified, `run-make` tests are forced to re-run instead of being still ignored as if nothing changed.

Fixes #122961.
2024-03-24 17:08:17 +01:00
Matthias Krüger
96a5348c05
Rollup merge of #122949 - ShoyuVanilla:issue-117310, r=lcnr
Add a regression test for #117310

Closes #117310

It seems to have been fixed in `rustc 1.79.0-nightly (1388d7a06 2024-03-20)` or before, so just adding a regression test for it.
2024-03-24 17:08:17 +01:00
Matthias Krüger
19d3827efe
Rollup merge of #122937 - Zalathar:unbox, r=oli-obk
Unbox and unwrap the contents of `StatementKind::Coverage`

The payload of coverage statements was historically a structure with several fields, so it was boxed to avoid bloating `StatementKind`.

Now that the payload is a single relatively-small enum, we can replace `Box<Coverage>` with just `CoverageKind`.

This patch also adds a size assertion for `StatementKind`, to avoid accidentally bloating it in the future.

``@rustbot`` label +A-code-coverage
2024-03-24 17:08:16 +01:00
Matthias Krüger
702261dce6
Rollup merge of #122886 - matthiaskrgr:issue90192, r=fee1-dead
add test for #90192

Fixes #90192
2024-03-24 17:08:16 +01:00
Matthias Krüger
04eedb24c9
Rollup merge of #122757 - h1467792822:priv-dep, r=davidtwco
Fixed the `private-dependency` bug

Fixed the private-dependency bug: If the directly dependent crate is loaded last and is not configured with `--extern`, it may be incorrectly set to `private-dependency`

Fixes #122756
2024-03-24 17:08:15 +01:00
Matthias Krüger
3fe9f66133
Rollup merge of #122737 - ytmimi:conditionally_ignore_fatal_diagnostic, r=davidtwco
conditionally ignore fatal diagnostic in the SilentEmitter

This change is primarily meant to allow rustfmt to ignore all diagnostics when using the `SilentEmitter`. Back in #121301 the `SilentEmitter` was shared between rustc and rustfmt. This changed rustfmt's behavior from ignoring all diagnostic to emitting fatal diagnostics, which lead to https://github.com/rust-lang/rustfmt/issues/6109.

These changes allow rustfmt to maintain its previous behaviour when using the `SilentEmitter`, while allowing rustc code to still emit fatal diagnostics.
2024-03-24 17:08:15 +01:00
David Carlier
1871ea5710 fix build. 2024-03-24 16:02:02 +00:00
bors
f97f448d4e Auto merge of #3406 - RalfJung:many-seeds, r=RalfJung
many-seeds: propagate failure properly

This may help explain https://github.com/rust-lang/miri/issues/3405.
2024-03-24 15:13:47 +00:00
Ralf Jung
a12decc07a desperate hack: hard-code bash path on Windows 2024-03-24 16:07:20 +01:00
Alex Macleod
2cb53473d9 Rename {enter,exit}_lint_attrs to check_attributes{,_post} 2024-03-24 14:57:57 +00:00
Ralf Jung
805f6eed46 try to fix many-seeds tests on Windows 2024-03-24 15:43:06 +01:00
bors
624af51813 Auto merge of #3398 - tiif:add_libc_fs_test, r=RalfJung
Add libc direct test for shims and update CONTRIBUTING.md

Add more ``libc`` direct test for shims as mentioned in #3179.

Changes:
- Added ``libc`` direct tests for ``rename`` and ``ftruncate64``
- Added the command for running ``pass-dep`` test in ``CONTRIBUTING.md``
2024-03-24 14:16:48 +00:00
Alex Macleod
47192937d4 Fix unpretty UI test when /tmp does not exist 2024-03-24 14:00:45 +00:00
tiif
04a69e4cf4 Add libc test for rename and ftruncate 2024-03-24 22:00:16 +08:00
Ralf Jung
acf3f52b7b miri-script/toolchain: make new_commit logic easier to follow 2024-03-24 14:49:46 +01:00
Ralf Jung
fdb561309d many-seeds: propagate failure properly 2024-03-24 14:45:32 +01:00
bors
6e6c721742 Auto merge of #122895 - matthiaskrgr:ice-tests-5xxxx-to-9xxxx, r=fmease
add some ice tests 5xxxx to 9xxxx

  Fixes rust-lang/rust#98842
  Fixes rust-lang/rust#90691
  Fixes rust-lang/rust#88421
  Fixes rust-lang/rust#88212
  Fixes rust-lang/rust#83056
  Fixes rust-lang/rust#80125
  Fixes rust-lang/rust#64784
  Fixes rust-lang/rust#52334
2024-03-24 13:38:12 +00:00
Ralf Jung
04b523ff34 CI tweaks and show which stable Rust we are using 2024-03-24 14:31:44 +01:00
github-actions
1848b46c0b cargo update
Updating aho-corasick v1.1.2 -> v1.1.3
    Updating backtrace v0.3.69 -> v0.3.71
    Updating bitflags v2.4.2 -> v2.5.0
    Updating bytes v1.5.0 -> v1.6.0
    Updating cargo-platform v0.1.7 -> v0.1.8
    Updating fastrand v2.0.1 -> v2.0.2
    Updating indexmap v2.2.5 -> v2.2.6
    Updating libz-sys v1.1.15 -> v1.1.16
    Updating rayon v1.9.0 -> v1.10.0
    Updating reqwest v0.11.26 -> v0.11.27 (latest: v0.12.1)
    Updating rustix v0.38.31 -> v0.38.32
    Updating smallvec v1.13.1 -> v1.13.2
    Updating syn v2.0.53 -> v2.0.55
    Updating uuid v1.7.0 -> v1.8.0
note: pass `--verbose` to see 87 unchanged dependencies behind latest
2024-03-24 12:09:28 +00:00
Ralf Jung
42526e142a simplify_branches: add comment 2024-03-24 12:53:03 +01:00
Zalathar
b5ee20f714 Clean up unnecessary headers/flags in coverage mir-opt tests
These headers and flags were historically needed, but are now unnecessary due
to various changes in how coverage information is stored in MIR.
2024-03-24 22:17:47 +11:00
bors
6a92312a1e Auto merge of #122891 - compiler-errors:encode-implied-predicates-always, r=oli-obk
Encode implied predicates for traits

In #112629, we decided to make associated type bounds in the "supertrait" AST position *implied* even though they're not supertraits themselves.

This means that the `super_predicates` and `implied_predicates` queries now differ for regular traits. The assumption that they didn't differ was hard-coded in #107614, so in cross-crate positions this means that we forget the implied predicates from associated type bounds.

This isn't unsound, just kind of annoying. This should be backported since associated type bounds are slated to stabilize for 1.78 -- either that, or associated type bounds can be reverted on beta and re-shipped in 1.79 with this patch.

Fixes #122859
2024-03-24 11:17:21 +00:00
David Carlier
4b84df9ea3 std:🧵 refine available_parallelism for solaris/illumos.
Rather than the system-wide available cpus fallback solution, we fetch
the cpus bound to the current process.
2024-03-24 10:57:17 +00:00
Giacomo Stevanato
fb65ca14b2 Clarify transmute example 2024-03-24 11:27:34 +01:00
Matthias Krüger
e4d816e66c add tests for ICE: 'broken MIR: bad assignment: NoSolution' on trait with default method and no impls
Fixes #109869
2024-03-24 10:57:20 +01:00