From d45b1f8eef24f7bc6c55ac539afc7809e8f46d8d Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 28 Apr 2019 22:20:15 +0200 Subject: [PATCH 1/2] Automatically check if README.md examples are working when running "cargo test" --- Cargo.toml | 1 + README.md | 4 ++-- src/lib.rs | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5e6cbad73..e02c2dca5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,3 +34,4 @@ rand = "0.6" rand_xorshift = "0.1" serde = "1" serde_derive = "1" +doc-comment = "0.3" diff --git a/README.md b/README.md index 9d820d914..c669e7ad2 100644 --- a/README.md +++ b/README.md @@ -104,14 +104,14 @@ command to get a visualization of an nbody simulation. To see the effect of using Rayon, press `s` to run sequentially and `p` to run in parallel. -``` +```text > cd rayon-demo > cargo run --release -- nbody visualize ``` For more information on demos, try: -``` +```text > cd rayon-demo > cargo run --release -- --help ``` diff --git a/src/lib.rs b/src/lib.rs index 51487f850..39a88f0a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,6 +85,12 @@ extern crate rayon_core; extern crate rand; #[cfg(test)] extern crate rand_xorshift; +#[cfg(test)] +#[macro_use] +extern crate doc_comment; + +#[cfg(test)] +doctest!("../README.md"); #[macro_use] mod delegate; From 93ad83138dd40897301be77e67de9b6ef4d7db15 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 1 May 2019 14:08:24 -0700 Subject: [PATCH 2/2] Update the error code for compile_fail/scope_join_bad.rs --- rayon-core/src/compile_fail/scope_join_bad.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rayon-core/src/compile_fail/scope_join_bad.rs b/rayon-core/src/compile_fail/scope_join_bad.rs index 91eef0579..75e4c5ca6 100644 --- a/rayon-core/src/compile_fail/scope_join_bad.rs +++ b/rayon-core/src/compile_fail/scope_join_bad.rs @@ -1,4 +1,4 @@ -/*! ```compile_fail,E0597 +/*! ```compile_fail,E0373 fn bad_scope(f: F) where F: FnOnce(&i32) + Send,