Skip to content

Commit d96bfa2

Browse files
authored
Fix README doctests on latest nightly (#175) (#176)
doc(include) was removed in rust-lang/rust#85457. Tests should now run on on both nightly and stable.
1 parent 3efe7dc commit d96bfa2

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

elasticsearch/src/lib.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,19 @@
347347
// TODO: turn on before releasing :) Will require adding documentation within all REST API specs
348348
// #![deny(missing_docs)]
349349

350-
// also test examples in README when using rust nightly.
351-
// required as external_doc feature requires nightly
352-
#![cfg_attr(RUSTC_IS_NIGHTLY, feature(external_doc))]
353-
#[cfg_attr(RUSTC_IS_NIGHTLY, doc(include = "../../README.md"), cfg(doctest))]
354-
type _DoctestReadme = ();
350+
// also test examples in README
351+
// source: https://github.com/rust-lang/cargo/issues/383#issuecomment-720873790
352+
#[cfg(doctest)]
353+
mod readme {
354+
macro_rules! external_doc_test {
355+
($x:expr) => {
356+
#[doc = $x]
357+
extern "C" {}
358+
};
359+
}
360+
361+
external_doc_test!(include_str!("../../README.md"));
362+
}
355363

356364
#[macro_use]
357365
extern crate dyn_clone;

0 commit comments

Comments
 (0)