Commit graph

256533 commits

Author SHA1 Message Date
Nicholas Nethercote
70bc0c5b20 Explain why we don't run rustfmt on tests/crashes/. 2024-05-31 15:56:45 +10:00
Nicholas Nethercote
4fd2003026 Run rustfmt on tests/coverage-run-rustdoc/.
There are only two tiny Rust files in this directory, and they are
already formatted correctly.
2024-05-31 15:56:45 +10:00
Nicholas Nethercote
e86709c58a Run rustfmt on tests/coverage/.
There are no changes to `.rs` files because #125693 recently formatted
them all.
2024-05-31 15:56:45 +10:00
Nicholas Nethercote
780a91786e Run rustfmt on tests/codegen-units/. 2024-05-31 15:56:45 +10:00
Nicholas Nethercote
72800d3b89 Run rustfmt on tests/codegen/.
Except for `simd-intrinsic/`, which has a lot of files containing
multiple types like `u8x64` which really are better when hand-formatted.

There is a surprising amount of two-space indenting in this directory.

Non-trivial changes:
- `rustfmt::skip` needed in `debug-column.rs` to preserve meaning of the
  test.
- `rustfmt::skip` used in a few places where hand-formatting read more
  nicely: `enum/enum-match.rs`
- Line number adjustments needed for the expected output of
  `debug-column.rs` and `coroutine-debug.rs`.
2024-05-31 15:56:43 +10:00
Scott McMurray
4b96e44ebb Also InstSimplify &raw*
We do this for `&*` and `&mut*` already; might as well do it for raw pointers too.
2024-05-30 22:05:30 -07:00
Henry Chen
772e48cfbb minor: replace command-group with process-wrap
Because command-group no longer receives updates and depends on an
older version of nix.
2024-05-31 12:43:40 +08:00
Lucas Scharenbroch
9af96745d6 Update ui tests for leading-underscore suggestion 2024-05-30 21:39:41 -05:00
Lucas Scharenbroch
08fe940f0a Improve renaming suggestion for names with leading underscores 2024-05-30 21:39:12 -05:00
Lokathor
94d4040925 The modern styling is apparently to use Title Case for the chip/company, "Arm". 2024-05-30 19:34:05 -06:00
bors
366da30d55 Auto merge of #125794 - cjgillot:revert-115105, r=compiler-errors
Revert "Auto merge of #115105 - cjgillot:dest-prop-default, r=oli-obk"

This reverts commit cfb730450f, reversing changes made to 91c0823ee6.

To address https://github.com/rust-lang/rust/pull/115105#issuecomment-2141019310
r? `@oli-obk`

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
2024-05-31 00:39:27 +00:00
r0cky
ed5205fe66 Avoid unwrap diag.code directly 2024-05-31 08:29:42 +08:00
Camille GILLOT
e110567dcd Revert "Auto merge of #115105 - cjgillot:dest-prop-default, r=oli-obk"
This reverts commit cfb730450f, reversing
changes made to 91c0823ee6.
2024-05-31 00:22:40 +00:00
Waffle Maybe
86afea97fd
Don't recompute tail in lower_stmts 2024-05-31 00:46:07 +02:00
bors
434999efe6 Auto merge of #125710 - RalfJung:compiletest-components, r=workingjubilee
compiletest: clarify COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS error

COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS is a confusing name because elsewhere "needs" means "ignore when requirement not met", but here it means "fail when requirement not met".
2024-05-30 21:51:24 +00:00
León Orell Valerian Liehr
34c56c45cf
Rename HIR TypeBinding to AssocItemConstraint and related cleanup 2024-05-30 22:52:33 +02:00
Michael Goulet
5c68eb3fac Add a bunch of tests 2024-05-30 15:52:29 -04:00
Michael Goulet
2f4b7dc047 Fold item bound before checking that they hold 2024-05-30 15:52:29 -04:00
Oneirical
836c08ed21 rewrite mixing-formats test 2024-05-30 15:08:45 -04:00
Oneirical
5db8552b20 rewrite bare-outfile test 2024-05-30 15:08:45 -04:00
Oneirical
1e3e3df81e rewrite emit test 2024-05-30 15:08:45 -04:00
bors
6f3df08aad Auto merge of #125378 - lcnr:tracing-no-lines, r=oli-obk
remove tracing tree indent lines

This allows vscode to collapse nested spans without having to manually remove the indent lines. This is incredibly useful when logging the new solver. I don't mind making them optional depending on some environment flag if you prefer using indent lines

For a gist of the new output, see https://gist.github.com/lcnr/bb4360ddbc5cd4631f2fbc569057e5eb#file-example-output-L181

r? `@oli-obk`
2024-05-30 18:57:48 +00:00
bors
7feb191f18 Auto merge of #125764 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`
2024-05-30 16:46:31 +00:00
bors
cfb730450f Auto merge of #115105 - cjgillot:dest-prop-default, r=oli-obk
Enable DestinationPropagation by default.

~~Based on https://github.com/rust-lang/rust/pull/115291.~~

This PR proposes to enable the destination propagation pass by default.
This pass is meant to reduce the amount of copies present in MIR.

At the same time, this PR removes the `RenameReturnPlace` pass, as it is currently unsound.
`DestinationPropagation` is not limited to `_0`, but does not handle borrowed locals.
2024-05-30 14:27:46 +00:00
lcnr
8160974ce8 ignore whitespace in ldd tests 2024-05-30 15:28:03 +02:00
lcnr
aa8f995b89 add info to rust-ldd tests failures 2024-05-30 15:26:49 +02:00
lcnr
86cbabbb9d add logging to search graph 2024-05-30 15:26:48 +02:00
lcnr
f7d14b741e update UI tests 2024-05-30 15:26:48 +02:00
lcnr
97d2c3a6a7 remove tracing tree indent lines 2024-05-30 15:26:48 +02:00
bors
91c0823ee6 Auto merge of #124636 - tbu-:pr_env_unsafe, r=petrochenkov
Make `std::env::{set_var, remove_var}` unsafe in edition 2024

Allow calling these functions without `unsafe` blocks in editions up until 2021, but don't trigger the `unused_unsafe` lint for `unsafe` blocks containing these functions.

Fixes #27970.
Fixes #90308.
CC #124866.
2024-05-30 12:17:06 +00:00
bors
f3ff2f16c8 Auto merge of #125761 - matthiaskrgr:rollup-7u082og, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #125342 (Document platform-specifics for `Read` and `Write` of `File`)
 - #125711 (Make `body_owned_by` return the `Body` instead of just the `BodyId`)
 - #125739 (drop_in_place: weaken the claim of equivalence with drop(ptr.read()))
 - #125745 (Bump the stage0 compiler to beta.7 (2024-05-26))
 - #125746 (Fix copy-paste error in `Duration::from_weeks` panic message.)
 - #125753 (compiletest: Unify `cmd2procres` with `run_command_to_procres`)
 - #125754 (coverage: Rename MC/DC `conditions_num` to `num_conditions`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-30 10:09:30 +00:00
Philipp Krones
9b320af787
Merge commit 'c9139bd546d9cd69df817faeab62c5f9b1a51337' into clippy-subtree-update 2024-05-30 10:49:05 +02:00
Matthias Krüger
479d6cafb7
Rollup merge of #125754 - Zalathar:conditions-num, r=lqd
coverage: Rename MC/DC `conditions_num` to `num_conditions`

Updated version of #124571, without the other changes that were split out into #125108 and #125700.

This value represents a quantity of conditions, not an ID, so the new spelling is more appropriate.

Some of the code touched by this PR could perhaps use some other changes, but I would prefer to keep this PR as a simple renaming and avoid scope creep.

`@rustbot` label +A-code-coverage
2024-05-30 10:23:09 +02:00
Matthias Krüger
5e83248a81
Rollup merge of #125753 - Zalathar:procres, r=jieyouxu
compiletest: Unify `cmd2procres` with `run_command_to_procres`

Historical context: I originally added `run_command_to_procres` in #112300 and #114843, because I didn't like the overly-specific failure message in `cmd2procres`, but at the time I didn't feel confident enough to change the existing code, so I just added my own similar code.

Now I'm going back to remove this redundancy by eliminating `cmd2procress`, and adjusting all callers to use a slightly-tweaked `run_command_to_procres` instead.
2024-05-30 10:23:09 +02:00
Matthias Krüger
a4d00ff8e4
Rollup merge of #125746 - jmillikin:duration-from-weeks-typo, r=lqd
Fix copy-paste error in `Duration::from_weeks` panic message.
2024-05-30 10:23:08 +02:00
Matthias Krüger
cffcf9c828
Rollup merge of #125745 - tgross35:bump-stage0, r=Mark-Simulacrum
Bump the stage0 compiler to beta.7 (2024-05-26)

As mentioned at https://github.com/rust-lang/rust/pull/125016#issuecomment-2138383831
2024-05-30 10:23:08 +02:00
Matthias Krüger
60c2d80482
Rollup merge of #125739 - RalfJung:drop-in-place-docs, r=workingjubilee
drop_in_place: weaken the claim of equivalence with drop(ptr.read())

The two are *not* semantically equivalent in all cases, so let's not be so definite about this.

Fixes https://github.com/rust-lang/rust/issues/112015
2024-05-30 10:23:07 +02:00
Matthias Krüger
7ed5d469e8
Rollup merge of #125711 - oli-obk:const_block_ice2, r=Nadrieril
Make `body_owned_by` return the `Body` instead of just the `BodyId`

fixes #125677

Almost all `body_owned_by` callers immediately called `body`, too, so just return `Body` directly.

This makes the inline-const query feeding more robust, as all calls to `body_owned_by` will now yield a body for inline consts, too.

I have not yet figured out a good way to make `tcx.hir().body()` return an inline-const body, but that can be done as a follow-up
2024-05-30 10:23:07 +02:00
Matthias Krüger
70e7b49cf2
Rollup merge of #125342 - tbu-:pr_doc_write, r=ChrisDenton
Document platform-specifics for `Read` and `Write` of `File`
2024-05-30 10:23:06 +02:00
bors
c9139bd546 Auto merge of #12867 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-05-30 08:11:24 +00:00
bors
d43930dab3 Auto merge of #125711 - oli-obk:const_block_ice2, r=Nadrieril
Make `body_owned_by` return the `Body` instead of just the `BodyId`

fixes #125677

Almost all `body_owned_by` callers immediately called `body`, too, so just return `Body` directly.

This makes the inline-const query feeding more robust, as all calls to `body_owned_by` will now yield a body for inline consts, too.

I have not yet figured out a good way to make `tcx.hir().body()` return an inline-const body, but that can be done as a follow-up
2024-05-30 08:00:11 +00:00
Philipp Krones
280ed2b594
Bump nightly version -> 2024-05-30 2024-05-30 09:44:33 +02:00
Philipp Krones
89037ea18f
Merge remote-tracking branch 'upstream/master' into rustup 2024-05-30 09:44:14 +02:00
Ralf Jung
5c68a15e41 explain what the open questions are, and add a Miri test for that 2024-05-30 09:07:06 +02:00
Nicholas Nethercote
b1b18e6031 Run rustfmt on tests/auxiliary/.
That directory doesn't contain any Rust files, so it's a trivial change.
2024-05-30 16:15:46 +10:00
Nicholas Nethercote
d063c7b6c8 Run rustfmt on tests/assembly/. 2024-05-30 16:15:46 +10:00
Nicholas Nethercote
4af4ba2391 List all tests/ subdirs explicitly in rustfmt.toml.
So we can gradually remove the ones where rustfmt can be used.
2024-05-30 16:15:46 +10:00
Ralf Jung
4ce7e094ae compiletest: clarify COMPILETEST_NEEDS_ALL_LLVM_COMPONENTS error
also improve wording for an ignore reason
2024-05-30 08:07:56 +02:00
bors
32a3ed229c Auto merge of #125671 - BoxyUwU:remove_const_ty_eq, r=compiler-errors
Do not equate `Const`'s ty in `super_combine_const`

Fixes #114456

In #125451 we started relating the `Const`'s tys outside of a probe so it was no longer simply an assertion to catch bugs.

This was done so that when we _do_ provide a wrongly typed const argument to an item if we wind up relating it with some other instantiation we'll have a `TypeError` we can bubble up and taint the resulting mir allowing const eval to skip evaluation.

In this PR I instead change `ConstArgHasType` to correctly handle checking the types of const inference variables. Previously if we had something like `impl<const N: u32> Trait for [(); N]`, when using the impl we would instantiate it with infer vars and then check that `?x: u32` is of type `u32` and succeed. Then later we would infer `?x` to some `Const` of type `usize`.

We now stall on `?x` in `ConstArgHasType` until it has a concrete value that we can determine the type of. This allows us to fail using the erroneous implementation of `Trait` which allows us to taint the mir.

Long term we intend to remove the `ty` field on `Const` so we would have no way of accessing the `ty` of a const inference variable anyway and would have to do this. I did not fully update `ConstArgHasType` to avoid using the `ty` field as it's not entirely possible right now- we would need to lookup `ConstArgHasType` candidates in the env.

---

As for _why_ I think we should do this, relating the types of const's is not necessary for soundness of the type system. Originally this check started off as a plain `==` in `super_relate_consts` and gradually has been growing in complexity as we support more complicated types. It was never actually required to ensure that const arguments are correctly typed for their parameters however.

The way we currently check that a const argument has the correct type is a little convoluted and confusing (and will hopefully be less weird as time goes on). Every const argument has an anon const with its return type set to type of the const parameter it is an argument to. When type checking the anon const regular type checking rules require that the expression is the same type as the return type. This effectively ensure that no matter what every const argument _always_ has the correct type.

An extra bit of complexity is that during `hir_ty_lowering` we do not represent everything as a `ConstKind::Unevaluated` corresponding to the anon const. For generic parameters i.e. `[(); N]` we simply represent them as `ConstKind::Param` as we do not want `ConstKind::Unevaluated` with generic substs on stable under min const generics. The anon const still gets type checked resulting in errors about type mismatches.

Eventually we intend to not create anon consts for all const arguments (for example for `ConstKind::Param`) and instead check that the argument type is correct via `ConstArgHasType` obligations (these effectively also act as a check that the anon consts have the correctly set return type).

What this all means is that the the only time we should ever have mismatched types when relating two `Const`s is if we have messed up our logic for ensuring that const arguments are of the correct type. Having this not be an assert is:
- Confusing as it may incorrectly lead people to believe this is an important check that is actually required
- Opens the possibility for bugs or behaviour reliant on this (unnecessary) check existing

---

This PR makes two tests go from pass->ICE (`generic_const_exprs/ice-125520-layout-mismatch-mulwithoverflow.rs` and `tests/crashes/121858.rs`). This is caused by the fact that we evaluate anon consts even if their where clauses do not hold and is a pre-existing issue and only affects `generic_const_exprs`. I am comfortable exposing the brokenness of `generic_const_exprs` more with this PR

This PR makes a test go from ICE->pass (`const-generics/issues/issue-105821.rs`). I have no idea why this PR affects that but I believe that ICE is an unrelated issue to do with the fact that under `generic_const_exprs`/`adt_const_params` we do not handle lifetimes in const parameter types correctly. This PR is likely just masking this bug.

Note: this PR doesn't re-introduce the assertion that the two consts' tys are equal. I'm not really sure how I feel about this but tbh it has caused more ICEs than its found lately so 🤷‍♀️

r? `@oli-obk` `@compiler-errors`
2024-05-30 05:50:44 +00:00
Zalathar
35a8746832 coverage: Instrument the RHS value of lazy logical operators
When a lazy logical operator (`&&` or `||`) occurs outside of an `if`
condition, it normally doesn't have any associated control-flow branch, so we
don't have an existing way to track whether it was true or false.

This patch adds special code to handle this case, by inserting extra MIR blocks
in a diamond shape after evaluating the RHS. This gives us a place to insert
the appropriate marker statements, which can then be given their own counters.
2024-05-30 15:38:46 +10:00