Commit Graph

237043 Commits

Author SHA1 Message Date
Zalathar
6af9fef085 coverage: Emit the filenames section before encoding per-function mappings
Most coverage metadata is encoded into two sections in the final executable.
The `__llvm_covmap` section mostly just contains a list of filenames, while the
`__llvm_covfun` section contains encoded coverage maps for each instrumented
function.

The catch is that each per-function record also needs to contain a hash of the
filenames list that it refers to. Historically this was handled by assembling
most of the per-function data into a temporary list, then assembling the
filenames buffer, then using the filenames hash to emit the per-function data,
and then finally emitting the filenames table itself.

However, now that we build the filenames table up-front (via a separate
traversal of the per-function data), we can hash and emit that part first, and
then emit each of the per-function records immediately after building. This
removes the awkwardness of having to temporarily store nearly-complete
per-function records.
2023-10-22 23:17:15 +11:00
bors
9372999916 Auto merge of #116256 - apekros:issue-114912, r=cjgillot
Add test for rust-lang#114912

Closes #114912
2023-10-22 11:57:18 +00:00
Jakub Beránek
823d72abde Pass host triple when running tests in opt-dist 2023-10-22 12:58:35 +02:00
Jakub Beránek
a836fd65f9 Use beta cargo in opt-dist
Using the new cargo caused issues when a backwards-incompatible change was made to cargo.
2023-10-22 12:58:35 +02:00
Zalathar
de4cfbca2e coverage: Encode function mappings without re-sorting them
The main change here is that `VirtualFileMapping` now uses an internal hashmap
to de-duplicate incoming global file IDs. That removes the need for
`encode_mappings_for_function` to re-sort its mappings by filename in order to
de-duplicate them.

(We still de-duplicate runs of identical filenames to save work, but this is
not load-bearing for correctness, so a sort is not necessary.)
2023-10-22 20:37:39 +11:00
Zalathar
88159cafa7 coverage: Encapsulate local-to-global file mappings 2023-10-22 20:37:39 +11:00
Zalathar
e985ae5a45 coverage: Build the global file table ahead of time 2023-10-22 20:37:37 +11:00
Zalathar
86b55cccff coverage: Fetch expressions and mappings separately
The combined `get_expressions_and_counter_regions` method was an artifact of
having to prepare the expressions and mappings at the same time, to avoid
ownership/lifetime problems with temporary data used by both.

Now that we have an explicit transition from `FunctionCoverageCollector` to the
final `FunctionCoverage`, we can prepare any shared data during that step and
store it in the final struct.
2023-10-22 20:11:48 +11:00
Zalathar
371883a05a coverage: Split FunctionCoverage into distinct collector/finished phases
This gives us a clearly-defined place to run code after the instance's MIR has
been traversed by codegen, but before we emit its `__llvm_covfun` record.
2023-10-22 20:11:45 +11:00
bors
724ba7fe90 Auto merge of #117041 - matthiaskrgr:rollup-b18h0ln, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #116985 (Use gdb.ValuePrinter tag class)
 - #116989 (Skip test if Unix sockets are unsupported)
 - #117034 (Don't crash on empty match in the `nonexhaustive_omitted_patterns` lint)
 - #117037 (rustdoc book doc example error)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-22 08:09:40 +00:00
bors
f35c36af19 Auto merge of #3135 - RalfJung:nonatomic-clock, r=RalfJung
avoid AtomicU64 when a Cell is enough
2023-10-22 07:20:06 +00:00
Matthias Krüger
77d8a73fa2
Rollup merge of #117037 - csditchfield:fix_doc_writing_result_example, r=notriddle
rustdoc book doc example error

closes #117036

This is the minimal change required to make the second what-to-include.md example valid.
Another more modern solution could be considered:
```
/// Example
/// ```rust
/// let fortytwo = "42".parse::<u32>()?;
/// println!("{} + 10 = {}", fortytwo, fortytwo+10);
/// #     Ok::<(), <u32 as std::str::FromStr>::Err>(())
/// ```
```
2023-10-22 09:15:43 +02:00
Matthias Krüger
4681eb6c94
Rollup merge of #117034 - Nadrieril:fix-117033, r=cjgillot
Don't crash on empty match in the `nonexhaustive_omitted_patterns` lint

Oops

Fixes https://github.com/rust-lang/rust/issues/117033
2023-10-22 09:15:42 +02:00
Matthias Krüger
4d80740c1d
Rollup merge of #116989 - ChrisDenton:skip-unsupported, r=Mark-Simulacrum
Skip test if Unix sockets are unsupported

Fixes https://github.com/rust-lang/rust/pull/116683#issuecomment-1772314187

The test will be skipped if `AF_UNIX` is not supported. In that case [`WSASocketW` returns `WSAEAFNOSUPPORT`](https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw#return-value).

It will never skip the test when run in CI but maybe this is me being too defensive since the error code is narrowly scoped to just the af family parameter being unsupported?

Also fixed a minor typo.

r? `@Mark-Simulacrum`
2023-10-22 09:15:42 +02:00
Matthias Krüger
56b9f0327f
Rollup merge of #116985 - tromey:rust-printers-14, r=Mark-Simulacrum
Use gdb.ValuePrinter tag class

GDB 14 has a "gdb.ValuePrinter" tag class that was introduced to let GDB evolve the pretty-printer API.  Users of this tag are required to hide any local attributes or methods.  This patch makes this change to the Rust pretty-printers.  At present this is just a cleanup, providing the basis for any future changes.
2023-10-22 09:15:41 +02:00
Ralf Jung
b53c34f7b8 avoid AtomicU64 when a Cell is enough 2023-10-22 08:43:57 +02:00
bors
f6be93fc61 Auto merge of #3133 - rust-lang:rustup-2023-10-22, r=RalfJung
Automatic Rustup
2023-10-22 06:42:10 +00:00
Ralf Jung
8cbac823d0 clippy 2023-10-22 08:40:37 +02:00
bors
3932c87718 Auto merge of #116950 - cuviper:ci-llvm-17, r=Mark-Simulacrum
ci: add a runner for vanilla LLVM 17

For CI cost, this can be seen as replacing the llvm-14 runner we dropped in #114148.

Also, I've set `IS_NOT_LATEST_LLVM` in the llvm-16 runner, since that's not the latest anymore.
2023-10-22 06:15:18 +00:00
The Miri Conjob Bot
1f09dd21b7 Merge from rustc 2023-10-22 05:36:24 +00:00
The Miri Conjob Bot
193fec640d Preparing for merge from rustc 2023-10-22 05:29:24 +00:00
bors
cc3dce5bd0 Auto merge of #116956 - Amanieu:hashbrown-0.14.2, r=Mark-Simulacrum
Update hashbrown to 0.14.2

Fixes #116880
2023-10-22 03:55:24 +00:00
bors
9e3f784eb2 Auto merge of #116932 - Kobzol:fix-stage1-tests, r=Mark-Simulacrum
Fix x86_64-gnu-llvm-15 CI tests

The CI script was broken - if there was a test failure in the first command chain (inside the `if`), CI would not report the failure.

It happened because there were two command chains separated by `&&` in the script, and since `set -e` doesn't exit for chained commands, if the first chain has failed, the script would happily continue forward, ignoring any test failures.

This could be fixed e.g. by adding some `|| exit 1` to the first chain, but I suppose that the `&&` chaining is unnecessary here anyway.

Reported [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/test.20failure.20didn't.20stop.20CI).

Fixes: https://github.com/rust-lang/rust/issues/116867
2023-10-22 02:00:29 +00:00
Cameron Ditchfield
65962708f8 fix what-to-include doc example
Fixes the second example in the Examples section of what-to-include.md  by marking main as a function.
2023-10-21 19:40:08 -05:00
bors
97a2894062 Auto merge of #117031 - bjorn3:sync_cg_clif-2023-10-21, r=bjorn3
Sync rustc_codegen_cranelift

The main highlights this time is new support for riscv64 linux enabled by a cranelift update. I have also updated some of the crates built as part of cg_clif's test suite which enabled removing several patches for them. And finally I have fixed a couple of tests in rustc's test suite with cg_clif.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler +subtree-sync
2023-10-22 00:05:49 +00:00
Nadrieril
a134f1624c Fix #117033 2023-10-21 23:04:17 +02:00
bors
1c05d50c84 Auto merge of #117030 - matthiaskrgr:rollup-vdjfx4q, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #116312 (Initiate the inner usage of `cfg_match` (Compiler))
 - #116928 (fix bootstrap paths in triagebot.toml)
 - #116955 (Updated README with expandable table of content.)
 - #116981 (update the registers of csky target)
 - #116992 (Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist)
 - #117026 (Fix broken link to Ayu theme in the rustdoc book)
 - #117028 (Remove unnecessary `all` in Box)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-21 20:35:02 +00:00
bjorn3
a99b1b4c0b Merge branch 'sync_from_rust' 2023-10-21 19:57:28 +00:00
bjorn3
e07f47b6c5 Merge commit 'c07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa' into sync_cg_clif-2023-10-21 2023-10-21 19:54:51 +00:00
bjorn3
e472b5573a Merge commit 'c07d1e2f88cb3b1a0604ae8f18b478c1aeb7a7fa' into sync_cg_clif-2023-10-21 2023-10-21 19:54:51 +00:00
Matthias Krüger
ddb59dc936
Rollup merge of #117028 - gimbles:patch-1, r=Dylan-DPC
Remove unnecessary `all` in Box
2023-10-21 21:23:02 +02:00
Matthias Krüger
4ebc81a521
Rollup merge of #117026 - rmehri01:fix_ayu_theme_link, r=notriddle
Fix broken link to Ayu theme in the rustdoc book

Fixes #116977
2023-10-21 21:23:02 +02:00
Matthias Krüger
31865b7bfb
Rollup merge of #116992 - estebank:issue-69492, r=oli-obk
Mention the syntax for `use` on `mod foo;` if `foo` doesn't exist

Newcomers might get confused that `mod` is the only way of defining scopes, and that it can be used as if it were `use`.

Fix #69492.
2023-10-21 21:23:01 +02:00
Matthias Krüger
a3b22e1cdb
Rollup merge of #116981 - Dirreke:csky-unknown-linux-gunabiv2, r=bjorn3
update the registers of csky target
2023-10-21 21:23:01 +02:00
Matthias Krüger
762f0dde26
Rollup merge of #116955 - claesgill:upd_readme_toc, r=Mark-Simulacrum
Updated README with expandable table of content.

Make it easier to navigate in the rather large README file.
2023-10-21 21:23:00 +02:00
Matthias Krüger
0d489f3314
Rollup merge of #116928 - onur-ozkan:update-triagebot, r=Mark-Simulacrum
fix bootstrap paths in triagebot.toml

ref #https://github.com/rust-lang/rust/pull/116881#issuecomment-1769730250
2023-10-21 21:23:00 +02:00
Matthias Krüger
d6ac149b4f
Rollup merge of #116312 - c410-f3r:try, r=Mark-Simulacrum
Initiate the inner usage of `cfg_match` (Compiler)

cc #115585

Dogfood to test the implementation and remove dependencies.
2023-10-21 21:22:59 +02:00
bjorn3
c07d1e2f88 Use same --remap-path-prefix as bootstrap for testing the rustc test suite
This allows removing the CFG_VIRTUAL_RUST_SOURCE_BASE_DIR hack and
re-enabling a fair amount of tests.
2023-10-21 19:01:08 +00:00
bors
85812004e2 Auto merge of #116368 - shepmaster:github-actions-m1, r=Mark-Simulacrum
Use GitHub Actions M1 builder for aarch64-apple-darwin

r? `@ghost`
2023-10-21 18:41:33 +00:00
bjorn3
62f6e84ac1
Merge pull request #1398 from bjorn3/riscv_support
Add riscv64 linux support
2023-10-21 20:16:33 +02:00
Gimbles
695beca219
Update boxed.rs 2023-10-21 23:41:32 +05:30
Ryan Mehri
af87180845 fix broken link to ayu theme in the rustdoc book 2023-10-21 10:53:35 -07:00
bjorn3
1848d25a83 Add shim for core::hint::spin_loop() on riscv64 2023-10-21 17:37:45 +00:00
bors
0d1664674a Auto merge of #116922 - Zalathar:unused, r=cjgillot
coverage: Emit mappings for unused functions without generating stubs

For a while I've been annoyed by the fact that generating coverage maps for unused functions involves generating a stub function at the LLVM level.

As I suspected, generating that stub function isn't actually necessary, as long as we specifically tell LLVM about the symbol names of all the functions that have coverage mappings but weren't codegenned (due to being unused).

---

There is some helper code that gets moved around in the follow-up patches, so look at the first patch to see the most important functional changes.

---

`@rustbot` label +A-code-coverage
2023-10-21 16:47:30 +00:00
bjorn3
78cd77f1f1 Give better error for unsupported asm!() 2023-10-21 16:47:14 +00:00
bjorn3
eb30083b69 Fix epilogue_noreturn for AArch64 2023-10-21 16:47:14 +00:00
bjorn3
55cc776731 Introduce asm_supported() helper 2023-10-21 16:47:14 +00:00
bjorn3
46388c1702 Re-enable all inline asm usage for the rustc tests 2023-10-21 16:46:45 +00:00
bjorn3
453ce49a6f Support inline asm on riscv64 2023-10-21 16:46:24 +00:00
bjorn3
04a3850317 Run tests for riscv64 2023-10-21 16:46:24 +00:00