Skip to content

Commit 8d9e419

Browse files
authored
Merge pull request #18566 from lnicola/sync-from-rust
minor: Sync from downstream
2 parents b3d61a6 + a087a45 commit 8d9e419

File tree

113 files changed

+3078
-1634
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3078
-1634
lines changed

.cargo/config.toml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,20 @@ jobs:
5858
- name: rustdoc
5959
run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items
6060

61+
coverage:
62+
name: coverage report
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: ./.github/workflows/setup
67+
- name: coverage
68+
run: ./miri test --coverage
69+
6170
# Summary job for the merge queue.
6271
# ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
6372
# And they should be added below in `cron-fail-notify` as well.
6473
conclusion:
65-
needs: [build, style]
74+
needs: [build, style, coverage]
6675
# We need to ensure this job does *not* get skipped if its dependencies fail,
6776
# because a skipped job is considered a success by GitHub. So we have to
6877
# overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run
@@ -86,7 +95,7 @@ jobs:
8695
contents: write
8796
# ... and create a PR.
8897
pull-requests: write
89-
needs: [build, style]
98+
needs: [build, style, coverage]
9099
if: ${{ github.event_name == 'schedule' && failure() }}
91100
steps:
92101
# Send a Zulip notification

CONTRIBUTING.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,25 @@ for a list of Miri maintainers.
1313

1414
[Rust Zulip]: https://rust-lang.zulipchat.com
1515

16+
### Pull review process
17+
18+
When you get a review, please take care of the requested changes in new commits. Do not amend
19+
existing commits. Generally avoid force-pushing. The only time you should force push is when there
20+
is a conflict with the master branch (in that case you should rebase across master, not merge), and
21+
all the way at the end of the review process when the reviewer tells you that the PR is done and you
22+
should squash the commits. For the latter case, use `git rebase --keep-base ...` to squash without
23+
changing the base commit your PR branches off of. Use your own judgment and the reviewer's guidance
24+
to decide whether the PR should be squashed into a single commit or multiple logically separate
25+
commits. (All this is to work around the fact that Github is quite bad at dealing with force pushes
26+
and does not support `git range-diff`. Maybe one day Github will be good at git and then life can
27+
become easier.)
28+
29+
Most PRs bounce back and forth between the reviewer and the author several times, so it is good to
30+
keep track of who is expected to take the next step. We are using the `S-waiting-for-review` and
31+
`S-waiting-for-author` labels for that. If a reviewer asked you to do some changes and you think
32+
they are all taken care of, post a comment saying `@rustbot ready` to mark a PR as ready for the
33+
next round of review.
34+
1635
### Larger-scale contributions
1736

1837
If you are thinking about making a larger-scale contribution -- in particular anything that needs
@@ -45,14 +64,6 @@ process for such contributions:
4564
This process is largely informal, and its primary goal is to more clearly communicate expectations.
4665
Please get in touch with us if you have any questions!
4766

48-
### Managing the review state
49-
50-
Most PRs bounce back and forth between the reviewer and the author several times, so it is good to
51-
keep track of who is expected to take the next step. We are using the `S-waiting-for-review` and
52-
`S-waiting-for-author` labels for that. If a reviewer asked you to do some changes and you think
53-
they are all taken care of, post a comment saying `@rustbot ready` to mark a PR as ready for the
54-
next round of review.
55-
5667
## Preparing the build environment
5768

5869
Miri heavily relies on internal and unstable rustc interfaces to execute MIR,

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ Definite bugs found:
548548
* [Incorrect offset computation for highly-aligned types in `portable-atomic-util`](https://github.com/taiki-e/portable-atomic/pull/138)
549549
* [Occasional memory leak in `std::mpsc` channels](https://github.com/rust-lang/rust/issues/121582) (original code in [crossbeam](https://github.com/crossbeam-rs/crossbeam/pull/1084))
550550
* [Weak-memory-induced memory leak in Windows thread-local storage](https://github.com/rust-lang/rust/pull/124281)
551+
* [A bug in the new `RwLock::downgrade` implementation](https://rust-lang.zulipchat.com/#narrow/channel/269128-miri/topic/Miri.20error.20library.20test) (caught by Miri before it landed in the Rust repo)
551552

552553
Violations of [Stacked Borrows] found that are likely bugs (but Stacked Borrows is currently just an experiment):
553554

ci/ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ case $HOST_TARGET in
154154
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX time hashmap random threadname pthread fs libc-pipe
155155
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls libc-pipe
156156
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX time hashmap random thread sync available-parallelism tls libc-pipe
157-
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap threadname pthread
157+
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random sync threadname pthread
158158
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
159159
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
160160
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
arithmetic-side-effects-allowed = ["rustc_target::abi::Size"]
1+
arithmetic-side-effects-allowed = ["rustc_abi::Size", "rustc_apfloat::ieee::IeeeFloat"]

miri

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/usr/bin/env bash
22
set -e
33
# We want to call the binary directly, so we need to know where it ends up.
4-
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target
4+
ROOT_DIR="$(dirname "$0")"
5+
MIRI_SCRIPT_TARGET_DIR="$ROOT_DIR"/miri-script/target
56
# If stdout is not a terminal and we are not on CI, assume that we are being invoked by RA, and use JSON output.
67
if ! [ -t 1 ] && [ -z "$CI" ]; then
78
MESSAGE_FORMAT="--message-format=json"
89
fi
9-
# We need a nightly toolchain, for the `profile-rustflags` cargo feature.
10-
cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml \
10+
# We need a nightly toolchain, for `-Zroot-dir`.
11+
cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path "$ROOT_DIR"/miri-script/Cargo.toml \
12+
-Zroot-dir="$ROOT_DIR" \
1113
-q --target-dir "$MIRI_SCRIPT_TARGET_DIR" $MESSAGE_FORMAT || \
1214
( echo "Failed to build miri-script. Is the 'nightly' toolchain installed?"; exit 1 )
1315
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through

miri-script/Cargo.lock

Lines changed: 44 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

miri-script/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ rustc_version = "0.4"
2424
dunce = "1.0.4"
2525
directories = "5"
2626
serde_json = "1"
27+
tempfile = "3.13.0"

miri-script/src/commands.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ impl Command {
172172
Command::Install { flags } => Self::install(flags),
173173
Command::Build { flags } => Self::build(flags),
174174
Command::Check { flags } => Self::check(flags),
175-
Command::Test { bless, flags, target } => Self::test(bless, flags, target),
175+
Command::Test { bless, flags, target, coverage } =>
176+
Self::test(bless, flags, target, coverage),
176177
Command::Run { dep, verbose, many_seeds, target, edition, flags } =>
177178
Self::run(dep, verbose, many_seeds, target, edition, flags),
178179
Command::Doc { flags } => Self::doc(flags),
@@ -458,9 +459,20 @@ impl Command {
458459
Ok(())
459460
}
460461

461-
fn test(bless: bool, mut flags: Vec<String>, target: Option<String>) -> Result<()> {
462+
fn test(
463+
bless: bool,
464+
mut flags: Vec<String>,
465+
target: Option<String>,
466+
coverage: bool,
467+
) -> Result<()> {
462468
let mut e = MiriEnv::new()?;
463469

470+
let coverage = coverage.then_some(crate::coverage::CoverageReport::new()?);
471+
472+
if let Some(report) = &coverage {
473+
report.add_env_vars(&mut e)?;
474+
}
475+
464476
// Prepare a sysroot. (Also builds cargo-miri, which we need.)
465477
e.build_miri_sysroot(/* quiet */ false, target.as_deref())?;
466478

@@ -479,6 +491,11 @@ impl Command {
479491
// Then test, and let caller control flags.
480492
// Only in root project as `cargo-miri` has no tests.
481493
e.test(".", &flags)?;
494+
495+
if let Some(coverage) = &coverage {
496+
coverage.show_coverage_report(&e)?;
497+
}
498+
482499
Ok(())
483500
}
484501

0 commit comments

Comments
 (0)