Commit graph

256142 commits

Author SHA1 Message Date
Zalathar c671eaaaff coverage: Rename MC/DC conditions_num to num_conditions
This value represents a quantity of conditions, not an ID, so the new spelling
is more appropriate.
2024-05-30 13:16:07 +10:00
bors 23ea77b8ed Auto merge of #125702 - workingjubilee:tell-tidy-about-csky, r=nikic
Give tidy the good news about C-SKY

It seems this was overlooked in https://github.com/rust-lang/rust/pull/125472 because we don't test C-SKY much yet.

Fixes #125697

r? `@erikdesjardins`
2024-05-29 22:34:14 +00:00
bors debd22da66 Auto merge of #125732 - matthiaskrgr:rollup-bozbtk3, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #124655 (Add `-Zfixed-x18`)
 - #125693 (Format all source files in `tests/coverage/`)
 - #125700 (coverage: Avoid overflow when the MC/DC condition limit is exceeded)
 - #125705 (Reintroduce name resolution check for trying to access locals from an inline const)
 - #125708 (tier 3 target policy: clarify the point about producing assembly)
 - #125715 (remove unneeded extern crate in rmake test)
 - #125719 (Extract coverage-specific code out of `compiletest::runtest`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-29 20:11:09 +00:00
Matthias Krüger 6ef3dd0d38
Rollup merge of #125719 - Zalathar:run-coverage, r=jieyouxu
Extract coverage-specific code out of `compiletest::runtest`

I had been vaguely intending to do this for a while, but seeing #89475 on the compiletest dashboard inspired me to actually go and do it.

This moves a few hundred lines of coverage-specific code out of the main module, making navigation a bit easier. There is still a small amount of coverage-specific logic in broader functions in that module, since it can't easily be moved.

This is just cut-and-paste plus fixing visibility and imports, so no functional changes.

I also removed the unit test for anonymizing line numbers in MC/DC reports, as foreshadowed by the comment I wrote when adding it. That functionality is now adequately exercised by the actual snapshot tests for MC/DC coverage.

(Removing the test now avoids the need to move it, or to make the function it calls visible.)
2024-05-29 20:12:36 +02:00
Matthias Krüger e4ec56a796
Rollup merge of #125715 - lqd:rmake-cleanup, r=jieyouxu
remove unneeded extern crate in rmake test

Cleanup requested in https://github.com/rust-lang/rust/pull/125493#discussion_r1618644630

r? jieyouxu
``@bors`` rollup=always
2024-05-29 20:12:35 +02:00
Matthias Krüger a6a819c128
Rollup merge of #125708 - RalfJung:tier3, r=compiler-errors
tier 3 target policy: clarify the point about producing assembly

I think that is already the intended meaning of the policy, but I am not sure.

Cc ``@rust-lang/compiler``
2024-05-29 20:12:34 +02:00
Matthias Krüger c09b89ea32
Rollup merge of #125705 - oli-obk:const_block_ice, r=compiler-errors
Reintroduce name resolution check for trying to access locals from an inline const

fixes #125676

I removed this without replacement in https://github.com/rust-lang/rust/pull/124650 without considering the consequences
2024-05-29 20:12:34 +02:00
Matthias Krüger 9a61146765
Rollup merge of #125700 - Zalathar:limit-overflow, r=nnethercote
coverage: Avoid overflow when the MC/DC condition limit is exceeded

Fix for the test failure seen in https://github.com/rust-lang/rust/pull/124571#issuecomment-2099620869.

If we perform this subtraction first, it can sometimes overflow to -1 before the addition can bring its value back to 0.

That behaviour seems to be benign, but it nevertheless causes test failures in compiler configurations that check for overflow.

``@rustbot`` label +A-code-coverage
2024-05-29 20:12:33 +02:00
Matthias Krüger a7a2fa51f1
Rollup merge of #125693 - Zalathar:format, r=lqd
Format all source files in `tests/coverage/`

Currently we can't automatically enforce formatting on tests (see #125637), but we can at least keep things relatively tidy by occasionally running the formatter manually.

This was done by temporarily commenting out the `"/tests/"` exclusion in `rustfmt.toml`, and then running:
- `x fmt tests/coverage`
- `x test coverage --bless`

(This PR also includes a few cosmetic tweaks to some of the affected files, to convince rustfmt to format them in the way we want.)

``@rustbot`` label +A-code-coverage
2024-05-29 20:12:33 +02:00
Matthias Krüger d0311c1303
Rollup merge of #124655 - Darksonn:fixed-x18, r=lqd,estebank
Add `-Zfixed-x18`

This PR is a follow-up to #124323 that proposes a different implementation. Please read the description of that PR for motivation.

See the equivalent flag in [the clang docs](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-ffixed-x18).

MCP: https://github.com/rust-lang/compiler-team/issues/748
Fixes https://github.com/rust-lang/rust/issues/121970
r? rust-lang/compiler
2024-05-29 20:12:32 +02:00
bors e9b7aa08f7 Auto merge of #125613 - ChrisDenton:windows-recipie, r=jieyouxu
Use `rmake` for `windows-` run-make tests

Convert some Makefile tests to recipes.

I renamed "issue-85441" to "windows-ws2_32" as I think it's slightly more descriptive. EDIT: `llvm-readobj` seems to work for reading DLL imports so I've used that instead of `objdump`.

cc #121876
2024-05-29 18:03:55 +00:00
Jubilee Young 60c30f57c1 ci: Consolidate $IS_NOT_LATEST_LLVM into $EXTERNAL_LLVM
We want to only demand that we check for all components we expect
if we actually built the components we expect, which means
we built the LLVM. Otherwise, it isn't worth checking.
2024-05-29 10:35:20 -07:00
Jubilee Young ce092d46e3 tests: reenable ABI compatibility test for csky 2024-05-29 10:35:16 -07:00
Jubilee Young a4b737643e give tidy the good news about C-SKY 2024-05-29 10:34:32 -07:00
Alice Ryhl 4aafecb169 Simplify check for unsupported architectures 2024-05-29 16:58:46 +02:00
bors a83f933a9d Auto merge of #125531 - surechen:make_suggestion_for_note_like_drop_lint, r=Urgau
Make lint: `lint_dropping_references` `lint_forgetting_copy_types` `lint_forgetting_references` give suggestion if possible.

This is a follow-up PR of  #125433. When it's merged, I want change lint `dropping_copy_types` to use the same `Subdiagnostic` struct `UseLetUnderscoreIgnoreSuggestion` which is added in this PR.

Hi, Thank you(`@Urgau` ) again for your help in the previous PR.  If your time permits, please also take a look at this one.

r? compiler

<!--
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-29 14:05:30 +00:00
Chris Denton f34bbdecc4
Remove Makefiles from allowed_run_make_makefiles 2024-05-29 13:15:41 +00:00
Chris Denton 5ec0c002ed
Convert windows-binary-no-external-deps to rmake 2024-05-29 13:15:10 +00:00
Chris Denton e03f9cb52d
Convert run-make/windows-safeseh to rmake 2024-05-29 13:14:19 +00:00
Chris Denton e463f6fd0b
Convert run-make/windows-spawn to rmake 2024-05-29 13:12:45 +00:00
Chris Denton f08e00f3d5
Rename run-make/issue-85441 and convert to rmake 2024-05-29 13:11:48 +00:00
Chris Denton 1e6544a20e
Move run-make windows_subsystem tests to ui tests 2024-05-29 13:04:28 +00:00
bors f2e1a3a80a Auto merge of #125360 - RalfJung:packed-field-reorder, r=fmease
don't inhibit random field reordering on repr(packed(1))

`inhibit_struct_field_reordering_opt` being false means we exclude this type from random field shuffling. However, `packed(1)` types can still be shuffled! The logic was added in https://github.com/rust-lang/rust/pull/48528 since it's pointless to reorder fields in packed(1) types (there's no padding that could be saved) -- but that shouldn't inhibit `-Zrandomize-layout` (which did not exist at the time).

We could add an optimization elsewhere to not bother sorting the fields for `repr(packed)` types, but I don't think that's worth the effort.

This *does* change the behavior in that we may now reorder fields of `packed(1)` structs (e.g. if there are niches, we'll try to move them to the start/end, according to `NicheBias`).  We were always allowed to do that but so far we didn't. Quoting the [reference](https://doc.rust-lang.org/reference/type-layout.html):

> On their own, align and packed do not provide guarantees about the order of fields in the layout of a struct or the layout of an enum variant, although they may be combined with representations (such as C) which do provide such guarantees.
2024-05-29 11:57:13 +00:00
Zalathar 268b9a74e3 Extract coverage-specific code out of compiletest::runtest
This moves a few hundred lines of coverage-specific code out of the main
module, making navigation a bit easier.
2024-05-29 21:28:12 +10:00
Rémy Rakic bb865cb83f remove unneeded extern crate in rmake test 2024-05-29 10:37:21 +00:00
Zalathar 34a1828fea coverage: Add tests for the MC/DC condition limit 2024-05-29 20:12:20 +10:00
surechen 9d1ed80a8a Change lint_dropping_copy_types to use UseLetUnderscoreIgnoreSuggestion as suggestion. 2024-05-29 18:09:20 +08:00
Zalathar 7845c6e09c coverage: Avoid overflow when the MC/DC condition limit is exceeded
If we perform this subtraction and then add 1, the subtraction can sometimes
overflow to -1 before the addition can bring its value back to 0. That
behaviour seems to be benign, but it nevertheless causes test failures in
compiler configurations that check for overflow.

We can avoid the overflow by instead subtracting (N - 1), which is
algebraically equivalent, and more closely matches what the code is actually
trying to do.
2024-05-29 20:04:27 +10:00
bors 4cf5723dbe Auto merge of #125695 - RalfJung:fn_arg_sanity_check, r=jieyouxu
fn_arg_sanity_check: fix panic message

The `\n` inside a raw string doesn't actually make a newline...
2024-05-29 09:49:23 +00:00
surechen ac736d6d88 Let lint_forgetting_references give the suggestion if possible 2024-05-29 17:40:34 +08:00
Ralf Jung eafe80f5d9 tier 3 target policy: clarify the point about producing assembly 2024-05-29 11:21:17 +02:00
surechen d7f0d1f564 Let lint_forgetting_copy_types give the suggestion if possible. 2024-05-29 16:53:37 +08:00
surechen ca68c93135 Let lint_dropping_references give the suggestion if possible. 2024-05-29 16:53:28 +08:00
Oli Scherer bcfefe1c7e Reintroduce name resolution check for trying to access locals from an inline const 2024-05-29 08:28:44 +00:00
Ralf Jung 92af72d192 fn_arg_sanity_check: fix panic message
also update csky comment in abi/compatibility test
2024-05-29 08:16:47 +02:00
bors 5870f1ccbb Auto merge of #125433 - surechen:fix_125189, r=Urgau
A small diagnostic improvement for dropping_copy_types

For a value `m`  which implements `Copy` trait, `drop(m);` does nothing.
We now suggest user to ignore it by a abstract and general note: `let _ = ...`.
I think we can give a clearer note here: `let _ = m;`

fixes #125189

<!--
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-29 06:14:05 +00:00
Zalathar 9dc6e08279 Manually run x fmt on all source files in tests/coverage/
Currently we can't automatically enforce formatting on tests (see #125637), but
we can at least keep things relatively tidy by occasionally running the
formatter manually.

This was done by temporarily commenting out the `"/tests/"` exclusion in
`rustfmt.toml`, and then running `x fmt tests/coverage` and
`x test coverage --bless`.
2024-05-29 14:34:17 +10:00
Zalathar 448d63e946 Tweak various coverage test files for slightly nicer formatting
For coverage tests, splitting code across multiple lines often makes the
resulting coverage report easier to interpret, so we force rustfmt to retain
line breaks by adding dummy line comments with `//`.
2024-05-29 14:34:11 +10:00
bors 751691271d Auto merge of #125691 - jieyouxu:rollup-0i3wrc4, r=jieyouxu
Rollup of 8 pull requests

Successful merges:

 - #124251 (Add an intrinsic for `ptr::metadata`)
 - #124320 (Add `--print=check-cfg` to get the expected configs)
 - #125226 (Make more of the test suite run on Mac Catalyst)
 - #125381 (Silence some resolve errors when there have been glob import errors)
 - #125633 (miri: avoid making a full copy of all new allocations)
 - #125638 (Rewrite `lto-smoke`, `simple-rlib` and `mixing-deps` `run-make` tests in `rmake.rs` format)
 - #125639 (Support `./x doc run-make-support --open`)
 - #125664 (Tweak relations to no longer rely on `TypeTrace`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-29 03:55:21 +00:00
许杰友 Jieyou Xu (Joe) 4c1228276b
Rollup merge of #125664 - compiler-errors:trace-tweaks, r=lcnr
Tweak relations to no longer rely on `TypeTrace`

Remove `At::trace`, and inline all of the `Trace::equate`,etc methods into `At`.

The only nontrivial change is that we use `AliasTerm` to relate two unevaluated consts in the old-solver impl of `ConstEquate`, since `AliasTerm` does implement `ToTrace` and will relate the args structurally (shallowly).

r? lcnr
2024-05-29 03:25:11 +01:00
许杰友 Jieyou Xu (Joe) 98f3217a83
Rollup merge of #125639 - ChrisDenton:run-make-support-doc, r=onur-ozkan
Support `./x doc run-make-support --open`

Having easy access to the run-make-support documentation is invaluable when creating run-make tests using the new Rust recipes.
2024-05-29 03:25:10 +01:00
许杰友 Jieyou Xu (Joe) 7e93a632a8
Rollup merge of #125638 - Oneirical:lets-find-some-tests, r=jieyouxu
Rewrite `lto-smoke`, `simple-rlib` and `mixing-deps` `run-make` tests in `rmake.rs` format

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2024-05-29 03:25:10 +01:00
许杰友 Jieyou Xu (Joe) 305137de18
Rollup merge of #125633 - RalfJung:miri-no-copy, r=saethlin
miri: avoid making a full copy of all new allocations

Hopefully fixes https://github.com/rust-lang/miri/issues/3637

r? ``@saethlin``
2024-05-29 03:25:09 +01:00
许杰友 Jieyou Xu (Joe) bc1a069ec5
Rollup merge of #125381 - estebank:issue-96799, r=petrochenkov
Silence some resolve errors when there have been glob import errors

When encountering `use foo::*;` where `foo` fails to be found, and we later encounter resolution errors, we silence those later errors.

A single case of the above, for an *existing* import on a big codebase would otherwise have a huge number of knock-down spurious errors.

Ideally, instead of a global flag to silence all subsequent resolve errors, we'd want to introduce an unnameable binding in the appropriate rib as a sentinel when there's a failed glob import, so when we encounter a resolve error we can search for that sentinel and if found, and only then, silence that error. The current approach is just a quick proof of concept to iterate over.

Partially address #96799.
2024-05-29 03:25:08 +01:00
许杰友 Jieyou Xu (Joe) 3cc59aeaae
Rollup merge of #125226 - madsmtm:fix-mac-catalyst-tests, r=workingjubilee
Make more of the test suite run on Mac Catalyst

Combined with https://github.com/rust-lang/rust/pull/125225, the only failing parts of the test suite are in `tests/rustdoc-js`, `tests/rustdoc-js-std` and `tests/debuginfo`. Tested with:
```console
./x test --target=aarch64-apple-ios-macabi library/std
./x test --target=aarch64-apple-ios-macabi --skip=tests/rustdoc-js --skip=tests/rustdoc-js-std --skip=tests/debuginfo tests
```

Will probably put up a PR later to enable _running_ on (not just compiling for) Mac Catalyst in CI, though not sure where exactly I should do so? `src/ci/github-actions/jobs.yml`?

Note that I've deliberately _not_ enabled stack overflow handlers on iOS/tvOS/watchOS/visionOS (see https://github.com/rust-lang/rust/issues/25872), but rather just skipped those tests, as it uses quite a few APIs that I'd be weary about getting rejected by the App Store (note that Swift doesn't do it on those platforms either).

r? ``@workingjubilee``

CC ``@thomcc``

``@rustbot`` label O-ios O-apple
2024-05-29 03:25:08 +01:00
许杰友 Jieyou Xu (Joe) 7e441a11a1
Rollup merge of #124320 - Urgau:print-check-cfg, r=petrochenkov
Add `--print=check-cfg` to get the expected configs

This PR adds a new `--print` variant `check-cfg` to get the expected configs.

Details and rational can be found on the MCP: https://github.com/rust-lang/compiler-team/issues/743

``@rustbot`` label +F-check-cfg +S-waiting-on-MCP
r? ``@petrochenkov``
2024-05-29 03:25:07 +01:00
许杰友 Jieyou Xu (Joe) 2d3b1e014b
Rollup merge of #124251 - scottmcm:unop-ptr-metadata, r=oli-obk
Add an intrinsic for `ptr::metadata`

The follow-up to #123840, so we can remove `PtrComponents` and `PtrRepr` from libcore entirely (well, after a bootstrap update).

As discussed in <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/.60ptr_metadata.60.20in.20MIR/near/435637808>, this introduces `UnOp::PtrMetadata` taking a raw pointer and returning the associated metadata value.

By no longer going through a `union`, this should also help future PRs better optimize pointer operations.

r? ``@oli-obk``
2024-05-29 03:25:07 +01:00
bors da159eb331 Auto merge of #125682 - weihanglo:update-cargo, r=weihanglo
Update cargo

5 commits in a8d72c675ee52dd57f0d8f2bae6655913c15b2fb..431db31d0dbeda320caf8ef8535ea48eb3093407
2024-05-24 03:34:17 +0000 to 2024-05-28 18:17:31 +0000
- Include `lints.rust.unexpected_cfgs.check-cfg` in the fingerprint (rust-lang/cargo#13958)
- feat(test): Auto-redact elapsed time (rust-lang/cargo#13973)
- chore: Update to snapbox 0.6 (rust-lang/cargo#13963)
- fix: check if rev is full commit sha for github fast path (rust-lang/cargo#13969)
- test: switch from `drop` to `let _` due to nightly rustc change (rust-lang/cargo#13964)

r? ghost
2024-05-28 20:31:04 +00:00
Weihang Lo 037577a95a
Update cargo 2024-05-28 15:31:13 -04:00
bors 274499dd0f Auto merge of #125665 - matthiaskrgr:rollup-srkx0v1, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #117671 (NVPTX: Avoid PassMode::Direct for args in C abi)
 - #125573 (Migrate `run-make/allow-warnings-cmdline-stability` to `rmake.rs`)
 - #125590 (Add a "Setup Python" action for github-hosted runners and remove unnecessary `CUSTOM_MINGW` environment variable)
 - #125598 (Make `ProofTreeBuilder` actually generic over `Interner`)
 - #125637 (rustfmt fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-28 18:21:24 +00:00