Skip to content

Commit

Permalink
Fix README doctests on latest nightly (#175) (#176)
Browse files Browse the repository at this point in the history
doc(include) was removed in rust-lang/rust#85457.
Tests should now run on on both nightly and stable.

(cherry picked from commit d96bfa2)
  • Loading branch information
nathanregner authored and russcam committed Jun 18, 2021
1 parent 5590e6e commit 4366fde
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions elasticsearch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,19 @@
// TODO: turn on before releasing :) Will require adding documentation within all REST API specs
// #![deny(missing_docs)]

// also test examples in README when using rust nightly.
// required as external_doc feature requires nightly
#![cfg_attr(RUSTC_IS_NIGHTLY, feature(external_doc))]
#[cfg_attr(RUSTC_IS_NIGHTLY, doc(include = "../../README.md"), cfg(doctest))]
type _DoctestReadme = ();
// also test examples in README
// source: https://github.com/rust-lang/cargo/issues/383#issuecomment-720873790
#[cfg(doctest)]
mod readme {
macro_rules! external_doc_test {
($x:expr) => {
#[doc = $x]
extern "C" {}
};
}

external_doc_test!(include_str!("../../README.md"));
}

#[macro_use]
extern crate dyn_clone;
Expand Down

0 comments on commit 4366fde

Please sign in to comment.