Auto merge of #2257 - dtolnay-contrib:rustfmt9, r=RalfJung

Add `./miri fmt` and check in CI
This commit is contained in:
bors
2022-06-23 20:15:27 +00:00
7 changed files with 17 additions and 14 deletions
+3 -9
View File
@@ -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)
+8 -1
View File
@@ -21,10 +21,13 @@ to the final `cargo test` invocation.
./miri run <flags>:
Build miri, set up a sysroot and then run the driver with the given <flags>.
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
<flags>") which uses debug builds instead of release builds, for faster build
times and slower execution times.
./miri fmt <flags>:
Format all sources and tests. <flags> 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"
+1 -1
View File
@@ -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.
+2 -1
View File
@@ -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!()
}
+1
View File
@@ -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
@@ -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!()
}
+1 -1
View File
@@ -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() {