Commit Graph

256073 Commits

Author SHA1 Message Date
Zalathar
34a1828fea coverage: Add tests for the MC/DC condition limit 2024-05-29 20:12:20 +10: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
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
Matthias Krüger
faabc74625
Rollup merge of #125637 - nnethercote:rustfmt-fixes, r=GuillaumeGomez
rustfmt fixes

The `rmake.rs` entries in `rustfmt.toml` are causing major problems for `x fmt`. This PR removes them and does some minor related cleanups.

r? ``@GuillaumeGomez``
2024-05-28 18:04:33 +02:00
Matthias Krüger
de2bf3687b
Rollup merge of #125598 - compiler-errors:proof-tree-builder, r=lcnr
Make `ProofTreeBuilder` actually generic over `Interner`

Self-explanatory. Also renamed `ecx.tcx()` to `ecx.interner()`.

r? lcnr
2024-05-28 18:04:33 +02:00
Matthias Krüger
86f6fae93d
Rollup merge of #125590 - ChrisDenton:mingw-ci-3, r=Kobzol
Add a "Setup Python" action for github-hosted runners and remove unnecessary `CUSTOM_MINGW` environment variable

The Setup Python action isn't strictly necessary ([even on Windows](https://github.com/rust-lang/rust/pull/125584)) but it is [recommend by GitHub](https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#specifying-a-python-version).

The `CUSTOM_MINGW` environment variable is redundant now as it's always set for mingw and always unset otherwise.

try-job: x86_64-mingw
try-job: x86_64-mingw
try-job: dist-x86_64-msvc
try-job: dist-x86_64-mingw
2024-05-28 18:04:32 +02:00
Matthias Krüger
78b4cafa6e
Rollup merge of #125573 - GuillaumeGomez:migrate-allow-warnings-cmdline-stability, r=jieyouxu
Migrate `run-make/allow-warnings-cmdline-stability` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
2024-05-28 18:04:32 +02:00
Matthias Krüger
713c852a2f
Rollup merge of #117671 - kjetilkjeka:nvptx_c_abi_avoid_direct, r=davidtwco
NVPTX: Avoid PassMode::Direct for args in C abi

Fixes #117480

I must admit that I'm confused about `PassMode` altogether, is there a good sum-up threads for this anywhere? I'm especially confused about how "indirect" and "byval" goes together. To me it seems like "indirect" basically means "use a indirection through a pointer", while "byval" basically means "do not use indirection through a pointer".

The return used to keep `PassMode::Direct` for small aggregates. It turns out that `make_indirect` messes up the tests and one way to fix it is to keep `PassMode::Direct` for all aggregates. I have mostly seen this PassMode mentioned for args. Is it also a problem for returns? When experimenting with `byval` as an alternative i ran into [this assert](61a3eea804/compiler/rustc_codegen_llvm/src/abi.rs (L463C22-L463C22))

I have added tests for the same kind of types that is already tested for the "ptx-kernel" abi. The tests cannot be enabled until something like #117458 is completed and merged.

CC: ``@RalfJung`` since you seem to be the expert on this and have already helped me out tremendously

CC: ``@RDambrosio016`` in case this influence your work on `rustc_codegen_nvvm`

``@rustbot`` label +O-NVPTX
2024-05-28 18:04:31 +02:00
bors
8c4db851a7 Auto merge of #122662 - Mark-Simulacrum:optional-drop, r=bjorn3
Omit non-needs_drop drop_in_place in vtables

This replaces the drop_in_place reference with null in vtables. On librustc_driver.so, this drops about ~17k (11%) dynamic relocations from the output, since many vtables can now be placed in read-only memory, rather than having a relocated pointer included.

This makes a tradeoff by adding a null check at vtable call sites. I'm not sure that's readily avoidable without changing the vtable format (e.g., so that we can use a pc-relative relocation instead of an absolute address, and avoid the dynamic relocation that way). But it seems likely that the check is cheap at runtime.

Accepted MCP: https://github.com/rust-lang/compiler-team/issues/730
2024-05-28 16:04:14 +00:00
Michael Goulet
f494036530 Make ProofTreeBuilder actually generic over interner 2024-05-28 11:10:11 -04:00
Michael Goulet
50a5da16b8 EvalCtxt::tcx() -> EvalCtxt::interner() 2024-05-28 10:45:51 -04:00
bors
7717a306b2 Auto merge of #124650 - oli-obk:pattern_types_syntax, r=nnethercote
Create const block DefIds in typeck instead of ast lowering

this is a prerequisite for cleaning up pattern types and the range pattern HIR nodes in general. Right now they contain expressions, but they are supposed to only contain constants. In order to generate the anonymous constants lazily during typeck, we need to support generating new items with bodies during typeck in general. Transforming const blocks was the simplest change I could find to allow us to do that (everything else is much more invasive if we haven't already done it for const blocks).
2024-05-28 13:48:28 +00:00
Oli Scherer
ac7e836834 Bless codegen test 2024-05-28 13:38:44 +00:00
Oli Scherer
eae5031ecb Cache whether a body has inline consts 2024-05-28 13:38:43 +00:00
Oli Scherer
ddc5f9b6c1 Create const block DefIds in typeck instead of ast lowering 2024-05-28 13:38:43 +00:00
Oli Scherer
e5cba17b84 Use the HIR instead of mir_keys for determining whether something will have a MIR body. 2024-05-28 11:36:30 +00:00
Oli Scherer
53e3c3271f Make body-visiting logic reusable 2024-05-28 11:36:30 +00:00
Oli Scherer
be94ca0bcd Remove a CTFE check that was only ever used to ICE
The guarded call will ICE on its own.

While this improved diagnostics in the presence of bugs somewhat, it is also a blocker to query feeding of constants. If this case is hit again, we should instead improve diagnostics of the root ICE
2024-05-28 11:36:30 +00:00
Nicholas Nethercote
f1b0ca08a4 Don't format tests/run-make/*/rmake.rs.
It's reasonable to want to, but in the current implementation this
causes multiple problems.

- All the `rmake.rs` files are formatted every time even when they
  haven't changed. This is because they get whitelisted unconditionally
  in the `OverrideBuilder`, before the changed files get added.

- The way `OverrideBuilder` works, if any files gets whitelisted then no
  unmentioned files will get traversed. This is surprising, and means
  that the `rmake.rs` entries broke the use of explicit paths to `x
  fmt`, and also broke `GITHUB_ACTIONS=true git check --fmt`.

The commit removes the `rmake.rs` entries, fixes the formatting of a
couple of files that were misformatted (not previously caught due to the
`GITHUB_ACTIONS` breakage), and bans `!`-prefixed entries in
`rustfmt.toml` because they cause all these problems.
2024-05-28 19:28:46 +10:00
Nicholas Nethercote
4702a1c345 Fix comments.
Some are too long, some aren't complete sentences, some are complete
sentences but don't bother with an upper case letter at the start. All
annoying and hurt readability.
2024-05-28 19:28:21 +10:00
Guillaume Gomez
404d47ec20 Migrate run-make/allow-warnings-cmdline-stability to rmake.rs 2024-05-28 11:24:24 +02:00
Guillaume Gomez
56733372b8 Add assert_not_contains to run-make-support library 2024-05-28 11:24:23 +02:00
bors
f989d2f625 Auto merge of #125649 - workingjubilee:rollup-zwoum3k, r=workingjubilee
Rollup of 5 pull requests

Successful merges:

 - #125089 (Improve diagnostic output the `non_local_definitions` lint)
 - #125343 (`-Znext-solver`: eagerly normalize when adding goals)
 - #125551 (Stabilise `IpvNAddr::{BITS, to_bits, from_bits}` (`ip_bits`))
 - #125640 (Don't suggest turning non-char-literal exprs of ty `char` into string literals)
 - #125647 (update tracking issue for lazy_cell_consume)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-05-28 09:11:11 +00:00
Jubilee
4aaf9f645e
Rollup merge of #125647 - tspiteri:track-lazy_cell_consume, r=workingjubilee
update tracking issue for lazy_cell_consume

<!--
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-28 02:07:49 -07: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
941bf8bee1
Rollup merge of #125551 - clarfonthey:ip-bits, r=jhpratt
Stabilise `IpvNAddr::{BITS, to_bits, from_bits}` (`ip_bits`)

This completed FCP in #113744. (Closes #113744.)

Stabilises the following APIs:

```rust
impl Ipv4Addr {
    pub const BITS: u32 = 32;
    pub const fn from_bits(bits: u32) -> Ipv4Addr;
    pub const fn to_bits(self) -> u32;
}

impl Ipv6Addr {
    pub const BITS: u32 = 128;
    pub const fn from_bits(bits: u128) -> Ipv4Addr;
    pub const fn to_bits(self) -> u128;
}
```
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
Trevor Spiteri
402a649e75 update tracking issue for lazy_cell_consume 2024-05-28 11:02:03 +02: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
bors
c0d600385b Auto merge of #125636 - workingjubilee:bump-backtrace-0.3.72, r=workingjubilee
Bump backtrace to 0.3.72

This removes a bunch of dead code, contains critical aarch64-windows fixes, some less-critical windows-in-general improvements, adds visionOS support (and probably improves support for a bunch of Apple platforms...), and harmonizes backtrace's dependencies with rustc/std's.

See https://github.com/rust-lang/backtrace-rs/compare/0.3.71...0.3.72

r? `@ghost`
2024-05-28 04:58:04 +00:00
lcnr
98bfd54b0a eagerly normalize when adding goals 2024-05-28 04:54:05 +00:00
lcnr
13ce229042 refactor analyse visitor to instantiate states in order 2024-05-28 04:54:01 +00:00
lcnr
4d5a9bcb86 change selection test to run-pass 2024-05-28 04:44:45 +00:00
lcnr
87599ddd86 add debug_assert to alias-relate 2024-05-28 04:44:45 +00:00
Jubilee Young
3ec9d8db27 Sync libstd deps with backtrace 2024-05-27 19:53:41 -07:00
Jubilee Young
00b759530e Bump backtrace to 0.3.72 2024-05-27 19:53:31 -07:00
bors
d86e122941 Auto merge of #125609 - diondokter:opt-size-char-count, r=thomcc
Always use the general case char count with `optimize_for_size`

The faster algo is really expensive, over a kilobyte if the full algo is present in a binary.
With this PR the general case algo is picked always instead of only for small strings.

In a test of mine this change makes the total binary go from 3116 bytes to 2032 bytes in opt-level 3 and from 1652 bytes to 1428 bytes in opt-level z. I've seen it much worse in real application, so the savings (especially on 'z') will be higher in many cases.

This is the second pr of this kind after #125606
2024-05-28 02:47:32 +00:00
Nicholas Nethercote
bcfa67d50d Remove out-of-date comment.
This comment -- "by default we ignore everything in the repository" --
was added in #65939 when rustfmt was first being introduced for this
repository and (briefly) every directory was ignored. Since then lots of
directories have opted in to formatting, so it is no longer true.
2024-05-28 11:05:37 +10: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