From 32f609ecd71ad8cc7479b9bae2d5c9d815f40c5f Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 3 Mar 2020 11:31:07 +0100 Subject: [PATCH 1/2] Document common cargo commands --- CONTRIBUTING.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4e1a6956b91..c0f310eaa66 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -112,6 +112,32 @@ usually a good idea to first open an issue describing the change to solicit feedback and guidance. This will increase the likelihood of the PR getting merged. +### Cargo Commands + +Due to the extensive use of features in Tokio, you will often need to add extra +arguments to many common cargo commands. This section lists some commonly needed +commands. + +Some commands just need the `--all-features` argument: +``` +cargo build --all-features +cargo check --all-features +cargo test --all-features +``` +When building documentation normally, the markers that list the features +required for various parts of Tokio are missing. To build the documentation +correctly, use this command: +``` +RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features +``` +The `cargo fmt` command does not work on the Tokio codebase. You can use the +command below instead: +``` +rustfmt --check --edition 2018 $(find . -name '*.rs' -print) +``` +The `--check` argument prints the things that need to be fixed. If you remove +it, `rustfmt` will update your files locally instead. + ### Tests If the change being proposed alters code (as opposed to only documentation for From 734c4982fef10cf401a335300f2e76f2ab70c28b Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 3 Mar 2020 18:39:55 +0100 Subject: [PATCH 2/2] Add loom command --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c0f310eaa66..0aa58273081 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -138,6 +138,13 @@ rustfmt --check --edition 2018 $(find . -name '*.rs' -print) The `--check` argument prints the things that need to be fixed. If you remove it, `rustfmt` will update your files locally instead. +You can run loom tests with +``` +cd tokio # tokio crate in workspace +LOOM_MAX_PREEMPTIONS=1 RUSTFLAGS="--cfg loom" \ + cargo test --lib --release --features full -- --test-threads=1 --nocapture +``` + ### Tests If the change being proposed alters code (as opposed to only documentation for