diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85937a8e4445..45c0bea370ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,15 +95,9 @@ jobs: # We need a toolchain that can actually build Miri, just a nightly won't do. run: | cargo install rustup-toolchain-install-master # TODO: cache this? - ./rustup-toolchain "" -c clippy -c rustfmt - - name: rustfmt (miri, ui_test) - run: cargo fmt --all --check - - name: rustfmt (everything else) - # TODO: Add `tests` (work in progress). - # Maybe change to `find . -name '*.rs'`, superseding the previous step. - run: | - find bench-cargo-miri benches cargo-miri test-cargo-miri -name '*.rs' \ - | xargs rustfmt --edition=2021 --config-path ./rustfmt.toml --check + ./rustup-toolchain "" -c clippy + - name: rustfmt + run: ./miri fmt --check - name: clippy (miri) run: cargo clippy --all-targets -- -D warnings #- name: Clippy (ui_test) diff --git a/miri b/miri index 5c9cb81885c9..e89a9e380fff 100755 --- a/miri +++ b/miri @@ -21,10 +21,13 @@ to the final `cargo test` invocation. ./miri run : Build miri, set up a sysroot and then run the driver with the given . -All commands also exist in a "-debug" variant (e.g. "./miri run-debug +The commands above also exist in a "-debug" variant (e.g. "./miri run-debug ") which uses debug builds instead of release builds, for faster build times and slower execution times. +./miri fmt : +Format all sources and tests. are passed to `rustfmt`. + ENVIRONMENT VARIABLES MIRI_SYSROOT: @@ -156,6 +159,10 @@ run|run-debug) # Then run the actual command. exec cargo run $CARGO_BUILD_FLAGS -- --sysroot "$MIRI_SYSROOT" "$@" ;; +fmt) + find "$MIRIDIR" -not \( -name target -prune \) -name '*.rs' \ + | xargs rustfmt --edition=2021 --config-path "$MIRIDIR/rustfmt.toml" "$@" + ;; *) if [ -n "$COMMAND" ]; then echo "Unknown command: $COMMAND" diff --git a/rustup-toolchain b/rustup-toolchain index ca5508e225a1..34472c727f62 100755 --- a/rustup-toolchain +++ b/rustup-toolchain @@ -42,7 +42,7 @@ fi # Install and setup new toolchain. rustup toolchain uninstall miri -rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools "$@" -- "$NEW_COMMIT" +rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools -c rustfmt "$@" -- "$NEW_COMMIT" rustup override set miri # Cleanup. diff --git a/tests/fail/abort-terminator.rs b/tests/fail/abort-terminator.rs index fcdeaa0ffea2..c954443a2762 100644 --- a/tests/fail/abort-terminator.rs +++ b/tests/fail/abort-terminator.rs @@ -1,6 +1,7 @@ #![feature(c_unwind)] -extern "C" fn panic_abort() { //~ ERROR: the program aborted +extern "C" fn panic_abort() { + //~^ ERROR: the program aborted panic!() } diff --git a/tests/fail/abort-terminator.stderr b/tests/fail/abort-terminator.stderr index b096775e61d3..ec9ce76685b5 100644 --- a/tests/fail/abort-terminator.stderr +++ b/tests/fail/abort-terminator.stderr @@ -4,6 +4,7 @@ error: abnormal termination: the program aborted execution --> $DIR/abort-terminator.rs:LL:CC | LL | / extern "C" fn panic_abort() { +LL | | LL | | panic!() LL | | } | |_^ the program aborted execution diff --git a/tests/fail/concurrency/unwind_top_of_stack.rs b/tests/fail/concurrency/unwind_top_of_stack.rs index 9e6088be7a7e..39f7ae8bafb9 100644 --- a/tests/fail/concurrency/unwind_top_of_stack.rs +++ b/tests/fail/concurrency/unwind_top_of_stack.rs @@ -10,7 +10,7 @@ use std::{mem, ptr}; extern "C-unwind" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void { -//~^ ERROR unwinding past the topmost frame of the stack + //~^ ERROR unwinding past the topmost frame of the stack panic!() } diff --git a/tests/pass/concurrency/sync_nopreempt.rs b/tests/pass/concurrency/sync_nopreempt.rs index 38dbeb575d64..8895d62df95f 100644 --- a/tests/pass/concurrency/sync_nopreempt.rs +++ b/tests/pass/concurrency/sync_nopreempt.rs @@ -2,7 +2,7 @@ // We are making scheduler assumptions here. // compile-flags: -Zmiri-strict-provenance -Zmiri-preemption-rate=0 -use std::sync::{Condvar, Mutex, Arc}; +use std::sync::{Arc, Condvar, Mutex}; use std::thread; fn check_conditional_variables_notify_all() {