Commit graph

7126 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 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 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 ce092d46e3 tests: reenable ABI compatibility test for csky 2024-05-29 10:35:16 -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 1e6544a20e
Move run-make windows_subsystem tests to ui tests 2024-05-29 13:04:28 +00:00
Zalathar 34a1828fea coverage: Add tests for the MC/DC condition limit 2024-05-29 20:12:20 +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
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
许杰友 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) 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
Oneirical cc97376ade Rewrite simple-rlib to rmake 2024-05-28 11:41:53 -04:00
Esteban Küber 37c54db477 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 unameable 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-28 14:45:21 +00:00
Oli Scherer ddc5f9b6c1 Create const block DefIds in typeck instead of ast lowering 2024-05-28 13:38:43 +00:00
Mads Marquart e6b9bb7b72 Make more of the test suite run on Mac Catalyst
This adds the `only-apple`/`ignore-apple` compiletest directive, and
uses that basically everywhere instead of `only-macos`/`ignore-macos`.

Some of the updates in `run-make` are a bit redundant, as they use
`ignore-cross-compile` and won't run on iOS - but using Apple in these
is still more correct, so I've made that change anyhow.
2024-05-28 12:31:33 +02:00
Mads Marquart 37ae2b68b1 Disable stack overflow handler tests on iOS-like platforms 2024-05-28 12:31:12 +02:00
Mads Marquart d82be822a8 Enable a few tests on macOS 2024-05-28 12:31:12 +02:00
Jubilee 01aa2e8511
Rollup merge of #125640 - fmease:plz-no-stringify, r=estebank
Don't suggest turning non-char-literal exprs of ty `char` into string literals

Fixes #125595.
Fixes #125081.

r? estebank (#122217) or compiler
2024-05-28 02:07:48 -07:00
Jubilee fb95fda87f
Rollup merge of #125343 - lcnr:eagerly-normalize-added-goals, r=compiler-errors
`-Znext-solver`: eagerly normalize when adding goals

fixes #125269. I am not totally with this fix and going to keep this open until we have a more general discussion about how to handle hangs caused by lazy norm in the new solver.
2024-05-28 02:07:47 -07:00
Jubilee 8e89f83cbb
Rollup merge of #125089 - Urgau:non_local_def-suggestions, r=estebank
Improve diagnostic output the `non_local_definitions` lint

This PR improves (or at least tries to improve) the diagnostic output the `non_local_definitions` lint, by simplifying the wording, by adding a "sort of" explanation of bounds interaction that leak the impl...

This PR is best reviewed commit by commit and is voluntarily made a bit vague as to have a starting point to improve on.

Related to https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/non_local_defs.20wording.20improvements

Fixes https://github.com/rust-lang/rust/issues/125068
Fixes https://github.com/rust-lang/rust/issues/124396
cc ```@workingjubilee```
r? ```@estebank```
2024-05-28 02:07:47 -07:00
León Orell Valerian Liehr 27cdc0df4e
Don't suggest turning non-char-literal exprs of ty char into string literals 2024-05-28 09:40:02 +02:00
lcnr 98bfd54b0a eagerly normalize when adding goals 2024-05-28 04:54:05 +00:00
lcnr 4d5a9bcb86 change selection test to run-pass 2024-05-28 04:44:45 +00:00
bors 71213fd607 Auto merge of #125539 - matthiaskrgr:cräsh, r=jieyouxu
crashes: increment the number of tracked ones

r? `@jieyouxu`
2024-05-28 00:28:52 +00:00
Urgau c7d300442f non_local_defs: point the parent item when appropriate 2024-05-27 23:59:18 +02:00
Urgau 98273ec612 non_local_defs: point to Self and Trait to give more context 2024-05-27 23:59:18 +02:00
Urgau b71952904d non_local_defs: suggest removing leading ref/ptr to make the impl local 2024-05-27 23:59:18 +02:00
Urgau ab23fd8dea non_local_defs: improve main without a trait note 2024-05-27 23:59:18 +02:00
Urgau d3dfe14b53 non_local_defs: be more precise about what needs to be moved 2024-05-27 23:59:18 +02:00
Urgau 402580bcd5 non_local_defs: improve exception note for impl and macro_rules!
- Remove wrong exception text for non-local macro_rules!
 - Simplify anonymous const exception note
2024-05-27 23:59:18 +02:00
Urgau 22095fbd8d non_local_defs: use labels to indicate what may need to be moved 2024-05-27 23:58:55 +02:00
Urgau 26b873d030 non_local_defs: use span of the impl def and not the impl block 2024-05-27 23:58:55 +02:00
Urgau de1c122950 non_local_defs: improve some notes around trait, bounds, consts
- Restrict const-anon exception diag to relevant places
 - Invoke bounds (and type-inference) in non_local_defs
 - Specialize diagnostic for impl without Trait
2024-05-27 23:58:55 +02:00
Urgau 06c6a2d9d6 non_local_defs: switch to more friendly primary message 2024-05-27 23:58:55 +02:00
Matthias Krüger bae945201f remove fixed crashes, add fixed crashes to tests, add new cashed found in the meantime 2024-05-27 20:41:09 +02:00
bors b0f8618938 Auto merge of #125413 - lcnr:ambig-drop-region-constraints, r=compiler-errors
drop region constraints for ambiguous goals

See the comment in `compute_external_query_constraints`. While the underlying issue is preexisting, this fixes a bug introduced by #125343.

It slightly weakens the leak chec, even if we didn't have any test which was affected. I want to write such a test before merging this PR.

r? `@compiler-errors`
2024-05-27 15:28:51 +00:00
bors fec98b3bbc Auto merge of #125468 - BoxyUwU:remove_defid_from_regionparam, r=compiler-errors
Remove `DefId` from `EarlyParamRegion`

Currently we represent usages of `Region` parameters via the `ReEarlyParam` or `ReLateParam` variants. The `ReEarlyParam` is effectively equivalent to `TyKind::Param` and `ConstKind::Param` (i.e. it stores a `Symbol` and a `u32` index) however it also stores a `DefId` for the definition of the lifetime parameter.

This was used in roughly two places:
- Borrowck diagnostics instead of threading the appropriate `body_id` down to relevant locations. Interestingly there were already some places that had to pass down a `DefId` manually.
- Some opaque type checking logic was using the `DefId` field to track captured lifetimes

I've split this PR up into a commit for generate rote changes to diagnostics code to pass around a `DefId` manually everywhere, and another commit for the opaque type related changes which likely require more careful review as they might change the semantics of lints/errors.

Instead of manually passing the `DefId` around everywhere I previously tried to bundle it in with `TypeErrCtxt` but ran into issues with some call sites of `infcx.err_ctxt` being unable to provide a `DefId`, particularly places involved with trait solving and normalization. It might be worth investigating adding some new wrapper type to pass this around everywhere but I think this might be acceptable for now.

This pr also has the effect of reducing the size of `EarlyParamRegion` from 16 bytes -> 8 bytes. I wouldn't expect this to have any direct performance improvement however, other variants of `RegionKind` over `8` bytes are all because they contain a `BoundRegionKind` which is, as far as I know, mostly there for diagnostics. If we're ever able to remove this it would shrink the `RegionKind` type from `24` bytes to `12` (and with clever bit packing we might be able to get it to `8` bytes). I am curious what the performance impact would be of removing interning of `Region`'s if we ever manage to shrink `RegionKind` that much.

Sidenote: by removing the `DefId` the `Debug` output for `Region` has gotten significantly nicer. As an example see this opaque type debug print before vs after this PR:
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), [DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0, T, DefId(0:9 ~ impl_trait_captures[aeb9]::foo::'a)_'a/#0])`
`Opaque(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::{opaque#0}), ['a/#0, T, 'a/#0])`

r? `@compiler-errors` (I would like someone who understands the opaque type setup to atleast review the type system commit, but the rest is likely reviewable by anyone)
2024-05-27 06:36:57 +00:00
Jubilee b65b2b6ced
Rollup merge of #125469 - compiler-errors:dont-skip-inner-const-body, r=cjgillot
Don't skip out of inner const when looking for body for suggestion

Self-explanatory title, I'll point out the important logic in an inline comment.

Fixes #125370
2024-05-26 15:28:27 -07:00