1
Fork 0
Commit graph

272425 commits

Author SHA1 Message Date
Matthias Krüger
553db5faee
Rollup merge of #133849 - Zalathar:replay, r=oli-obk
coverage: Use a separate counter type and simplification step during counter creation

When instrumenting a function's MIR for coverage, there is a point where we need to decide, for each node in the control-flow graph, whether its execution count will be tracked by a physical counter, or by an expression that combines physical counters from other parts of the graph.

Currently the code for doing that is heavily tied to the final form of the LLVM coverage mapping format, and performs some important simplification steps on-the-fly. These factors make the code extremely difficult to modify without breaking or massively worsening the resulting coverage-instrumentation metadata.

---

This PR aims to improve that situation somewhat by adding an extra intermediate representation between the code that chooses how each node will be counted, and the code that converts those decisions into actual tables of physical counters and trees of counter expressions.

As part of doing that, some of the simplifications that are currently performed during the main counter creation step have been pulled out into a separate step.

In most cases the resulting coverage metadata is equivalent, slightly better, or slightly worse. The biggest outlier is `counters.rs`, where the coverage metadata ends up about 10% larger. This seems to be the result of the new approach having less subexpression sharing (because it relies on flatten-sort-cancel), and therefore being less effective at taking advantage of MIR optimizations to replace counters for unused control-flow with zeroes. I think the modest downside is acceptable in light of the future possibilities opened up by this decoupling.
2024-12-04 18:23:42 +01:00
Matthias Krüger
a4dc9634a8
Rollup merge of #133847 - nnethercote:rm-Z-show-span, r=compiler-errors
Remove `-Zshow-span`.

It's very old (added in #12087). It's strange, and it's not clear what its use cases are. It only works with the crate root file because it runs before expansion. I suspect it won't be missed.

r? `@estebank`
2024-12-04 18:23:42 +01:00
Matthias Krüger
e6d7ab2c3c
Rollup merge of #133831 - BoxyUwU:ice_on_unfed_type_of, r=compiler-errors
Don't try and handle unfed `type_of` on anon consts

The `type_of` query for anon consts in the type system is actually implemented by feeding the return value during hir ty lowering, not the hir-based logic in `const_arg_anon_type_of`. The HIR based logic is incomplete (doesn't handle all hir nodes) and also generally wrong to call (re-lowers HIR or invokes typeck which can result in query cycles).

r? `@compiler-errors`
2024-12-04 18:23:39 +01:00
Matthias Krüger
4b2d68dc3d
Rollup merge of #133774 - dingxiangfei2009:translatable-coerce-pointee-errors, r=jieyouxu
Make CoercePointee errors translatable

Tracked by #123430

Just in case that a translatable error message would become a blocker to stabilization, this PR switches over to fluent error messages, which also slightly improve the wordings and use more accurate span information.

cc `@Darksonn` `@traviscross`
2024-12-04 18:23:37 +01:00
Matthias Krüger
adeb603052
Rollup merge of #133737 - Walnut356:msvc_visualizers, r=onur-ozkan
Include LLDB and GDB visualizers in MSVC distribution

MSVC distributions currently don't include the lldb or GDB python files. MSVC and LLDB/GDB are not mutually exclusive (and end up being a common case with vscode + codelldb/lldb-dap), so they should probably be included.

the existing visualizers currently only partially work on MSVC due to the differences in how the debug info is generated, but they also only partially work on GNU anyway - both of which are actively being fixed.
2024-12-04 18:23:36 +01:00
Oli Scherer
f613636ae8 Rename core_pattern_type and core_pattern_types lib feature gates to pattern_type_macro
That's what the gates are actually gating, and the single char difference in naming was not helpful either
2024-12-04 16:16:24 +00:00
Michael Goulet
988f28d442 Make sure to record deps from cached task in new solver on first run 2024-12-04 16:15:44 +00:00
Michael Goulet
3f089971ff Add failing test 2024-12-04 16:03:28 +00:00
bjorn3
357deaa849 Move disabling of f16 and f128 in compiler-builtins to liballoc
This way it gets disabled even when trying to compile just liballoc and
not the sysroot crate.
2024-12-04 14:38:37 +00:00
Guillaume Gomez
52a6badb96 Update sysinfo version to 0.33.0 2024-12-04 14:42:39 +01:00
Ding Xiang Fei
836ab5cd89
make CoercePointee errors translatable 2024-12-04 20:34:48 +08:00
bjorn3
28533886c3 Fix rustc test suite 2024-12-04 12:24:24 +00:00
bjorn3
eff1c5d627 Rustup to rustc 1.85.0-nightly (c44b3d50f 2024-12-03) 2024-12-04 11:25:10 +00:00
bjorn3
812edd21e0 Sync from rust c44b3d50fe 2024-12-04 11:08:01 +00:00
Oli Scherer
4cbb599edf Stop git from merging generated files 2024-12-04 11:06:37 +00:00
bors
96e51d9482 Auto merge of #133799 - DianQK:llvm/19.1.5, r=nikic
Update LLVM to 19.1.5

Fixes #133276. Fixes #133203.

r? nikic or wg-llvm
2024-12-04 10:33:33 +00:00
Oli Scherer
a91c36139a Avoid opaque type not constrained errors in the presence of other errors 2024-12-04 10:16:04 +00:00
Oli Scherer
ec3424a905 Remove some noisy tracing 2024-12-04 09:54:20 +00:00
Nicholas Nethercote
e52f5bf16d Remove -Zshow-span.
It's very old (added in #12087). It's strange, and it's not clear what
its use cases are. It only works with the crate root file because it
runs before expansion. I suspect it won't be missed.
2024-12-04 19:20:01 +11:00
Ralf Jung
f4217f4296 clarify simd_relaxed_fma non-determinism 2024-12-04 08:39:19 +01:00
bors
733616f723 Auto merge of #133841 - matthiaskrgr:rollup-2snj3hc, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #133651 (Update `NonZero` and `NonNull` to not field-project (per MCP#807))
 - #133764 (rustdoc: Rename `set_back_info` to `restore_module_data`.)
 - #133784 (Fix MutVisitor's default implementations to visit Stmt's and BinOp's spans)
 - #133798 (stop replacing bivariant args with `'static` when computing closure requirements)
 - #133804 (Improve code for FileName retrieval in rustdoc)
 - #133817 (Use `eprintln` instead of `println` in bootstrap/compiletest/tidy)

Failed merges:

 - #133810 (remove unnecessary `eval_verify_bound`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-04 07:24:25 +00:00
Zalathar
ba08056d47 coverage: Remove the expression simplifier from CoverageCounters
These simplifications are now handled by the transcribe step.
2024-12-04 17:55:57 +11:00
Zalathar
d7090f335c coverage: Use a separate counter type during counter creation 2024-12-04 17:55:53 +11:00
Zalathar
44e4e4515c coverage: Add an extra "transcribe" step after counter creation 2024-12-04 17:50:52 +11:00
Zalathar
aca6dba6d1 coverage: Use a single make_phys_counter method
This is more convenient for subsequent patches.
2024-12-04 17:00:25 +11:00
Zalathar
7ecc677f5b coverage: Rename CounterIncrementSite to just Site
A "site" is a node or edge in the coverage graph.
2024-12-04 17:00:25 +11:00
Zalathar
2a3b4a0afd coverage: Extract subtracted_sum in counter creation 2024-12-04 17:00:25 +11:00
Matthias Krüger
0585134e70
Rollup merge of #133817 - clubby789:bootstrap-eprintln, r=jieyouxu
Use `eprintln` instead of `println` in bootstrap/compiletest/tidy

A big unconditional CTRL-F replace to start with to check if there's anything that CI expects to be on stdout

r? `@jieyouxu`
2024-12-04 05:42:10 +01:00
Matthias Krüger
5530869e0f
Rollup merge of #133804 - GuillaumeGomez:improve-code, r=notriddle
Improve code for FileName retrieval in rustdoc

Some calls were performed twice (first in `is_real_and_local` and then in the function calling it). Also the `FileName` was matched on a few times too.

r? `@notriddle`
2024-12-04 05:42:09 +01:00
Matthias Krüger
9fd0972677
Rollup merge of #133798 - lcnr:nested-bodies-opaques, r=compiler-errors
stop replacing bivariant args with `'static` when computing closure requirements

It is unnecessary, these get constrained when checking that the opaque type is well-formed.

It also results in the opaque type no longer being well formed. If you've got `fn foo<'a>() -> impl Sized + 'a` the opaque is `type Opaque<'a, 'aDummy> where 'a: 'aDummy, 'aDummy: 'a` where `'aDummy`  is bivariant. If we call `foo::<'b>()`  inside of a closure and its return type ends up in a type test, we start out with the WF `Opaque<'b, 'b>`, and then replace the bivariant `'b` with `'static`. `Opaque<'b, 'static>` is no longer well-formed. Given how these type tests are used, I don't think this caused any practical issues.

r? types
2024-12-04 05:42:08 +01:00
Matthias Krüger
45088fdf68
Rollup merge of #133784 - dtolnay:visitspans, r=compiler-errors
Fix MutVisitor's default implementations to visit Stmt's and BinOp's spans

The `Stmt` case is a bug introduced almost certainly unintentionally by https://github.com/rust-lang/rust/pull/126993. The code _used_ to visit and mutate `span` correctly, but got changed as follows by that PR. Notice how `span` is **copied** into the output by `|kind| Stmt { id, kind, span }` which happens after the mutation in the correct code (red) and before the mutation in the incorrect code (green).

```diff
  pub fn noop_flat_map_stmt<T: MutVisitor>(
      Stmt { kind, mut span, mut id }: Stmt,
      vis: &mut T,
  ) -> SmallVec<[Stmt; 1]> {
      vis.visit_id(&mut id);
-     vis.visit_span(&mut span);
      let stmts: SmallVec<_> = noop_flat_map_stmt_kind(kind, vis)
          .into_iter()
          .map(|kind| Stmt { id, kind, span })
          .collect();
      if stmts.len() > 1 {
          panic!(...);
      }
+     vis.visit_span(&mut span);
      stmts
  }
```
2024-12-04 05:42:08 +01:00
Matthias Krüger
afffc1a865
Rollup merge of #133764 - aDotInTheVoid:rename, r=GuillaumeGomez
rustdoc: Rename `set_back_info` to `restore_module_data`.

Follow-up to #133345, r? `@GuillaumeGomez`

Most of the references to `info` got removed as it was clear that `module_data` makes more sense here. Makes it clearer that `save_module_data` and `restore_module_data` are a pair.
2024-12-04 05:42:07 +01:00
Matthias Krüger
68f8a53f12
Rollup merge of #133651 - scottmcm:nonnull-nonzero-no-field-projection, r=oli-obk
Update `NonZero` and `NonNull` to not field-project (per MCP#807)

https://github.com/rust-lang/compiler-team/issues/807#issuecomment-2506098540 was accepted, so this is the first PR towards moving the library to not using field projections into `[rustc_layout_scalar_valid_range_*]` types.

`NonZero` was already using `transmute` nearly everywhere, so there are very few changes to it.

`NonNull` needed more changes, but they're mostly simple, changing `.pointer` to `.as_ptr()`.

r? libs

cc #133324, which will tidy up some of the MIR from this a bit more, but isn't a blocker.
2024-12-04 05:42:07 +01:00
bors
2633e01929 Auto merge of #133825 - weihanglo:update-cargo, r=weihanglo
Update cargo

17 commits in 4c39aaff66862cc0da52fe529aa1990bb8bb9a22..05f54fdc34310f458033af8a63ce1d699fae8bf6
2024-11-25 16:36:17 +0000 to 2024-12-03 03:14:12 +0000
- test(pgo): only run on nightly (rust-lang/cargo#14887)
- chore: Bump to 0.86.0; update changelog (rust-lang/cargo#14885)
- docs(ref): Finish a sentence on rust-versions (rust-lang/cargo#14884)
- chore(deps): update rust crate cargo_metadata to 0.19.0 (rust-lang/cargo#14878)
- chore(deps): update rust crate gix to 0.68.0 (rust-lang/cargo#14879)
- fix: Remove default registry reference in `info` cmd docs (rust-lang/cargo#14880)
- test(pgo): determine test runnability at compile time (rust-lang/cargo#14874)
- test: `requires` attribute accepts string literals for cmds (rust-lang/cargo#14875)
- chore(deps): update msrv (3 versions) to v1.81 (rust-lang/cargo#14871)
- chore(deps): update msrv (rust-lang/cargo#14867)
- fix(fix): Migrate cargo script manifests across editions (rust-lang/cargo#14864)
- feat(toml): Allow adding/removing from cargo scripts (rust-lang/cargo#14857)
- Add future-incompat warning against keywords in cfgs and add raw-idents (rust-lang/cargo#14671)
- test(build-std): download deps first (rust-lang/cargo#14861)
- test(pgo): ensure PGO works (rust-lang/cargo#14859)
- git-fetch-with-cli: Set `GIT_DIR` for bare repository compatibility (rust-lang/cargo#14860)
- fix(build-std): always link to std when testing proc-macros (rust-lang/cargo#14850)
2024-12-04 04:36:50 +00:00
bors
3b382642ab Auto merge of #133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #132937 (a release operation synchronizes with an acquire operation)
 - #133681 (improve TagEncoding::Niche docs, sanity check, and UB checks)
 - #133726 (Add `core::arch::breakpoint` and test)
 - #133768 (Remove `generic_associated_types_extended` feature gate)
 - #133811 ([AIX] change AIX default codemodel=large)
 - #133812 (Update wasm-component-ld to 0.5.11)
 - #133813 (compiletest: explain that UI tests are expected not to compile by default)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-04 00:47:09 +00:00
Boxy
52d1c30d3e Add comment to test 2024-12-04 00:19:26 +00:00
clubby789
8374f7ceb5 tidy: println! -> eprintln! 2024-12-03 23:46:05 +00:00
clubby789
23725619c4 compiletest: println! -> eprintln! 2024-12-03 23:43:10 +00:00
clubby789
3fadb87d76 bootstrap: println! -> eprintln! 2024-12-03 23:41:47 +00:00
Boxy
ec036cda3f Don't try and handle unfed type_of on anon consts 2024-12-03 23:39:51 +00:00
Miguel Ojeda
7cc6f4da88 CI: rfl: move job forward to Linux v6.13-rc1
Linux v6.13-rc1 contains commit 28e848386b92 ("rust: block: fix formatting
of `kernel::block::mq::request` module"), which in turn contains commit
c95bbb59a9b2 ("rust: enable arbitrary_self_types and remove `Receiver`"),
which is why we had a hash rather than a tag.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-12-03 23:39:47 +01:00
Weihang Lo
244afb94d4
Update cargo 2024-12-03 16:46:51 -05:00
Guillaume Gomez
2997ec51a6 Rename is_real_and_local function into filename_real_and_local 2024-12-03 22:42:08 +01:00
Jakub Beránek
d5eb93b7e7
Remove dependency on black 2024-12-03 22:13:50 +01:00
Jakub Beránek
b24d608967
Replace black with ruff for formatting Python code 2024-12-03 22:02:58 +01:00
Jakub Beránek
f676ed2d2c
Fix copy-pasted tool name 2024-12-03 22:02:15 +01:00
Jakub Beránek
733871099c
Fix typo 2024-12-03 21:59:41 +01:00
Matthias Krüger
cd56913663
Rollup merge of #133813 - clubby789:ui-pass-note, r=jieyouxu
compiletest: explain that UI tests are expected not to compile by default

```
error: ui test compiled successfully!
```
is not a very useful message for someone new to the test suite, so change the wording and add a note to explain
2024-12-03 21:55:30 +01:00
Matthias Krüger
fd182ca529
Rollup merge of #133812 - alexcrichton:update-wasm-component-ld, r=jieyouxu
Update wasm-component-ld to 0.5.11

This pulls in an update that supports ``@`-files` used to pass arguments to linkers to fix invocations on Windows that are large.

Closes #133649
2024-12-03 21:55:29 +01:00
Matthias Krüger
9a972146c2
Rollup merge of #133811 - mustartt:change-default-codemodel, r=jieyouxu
[AIX] change AIX default codemodel=large

On AIX, for most libraries, we run out of Table of Contents (TOC) offsets very quickly due to the default 16-bit offset limit. We want the large code model should be used as the default to provide more TOC entries so the end user does not have to specify `-Ccode-model=large` for all their packages. This is even more of an issue with ThinLTO as the ThinLTO globals can very quickly use all available TOC entry.

In addition, on AIX, code with different code-model across different compilation units will not cause undefined behavior, so this is safe to do.
2024-12-03 21:55:29 +01:00