Skip to content

Commit 18886e5

Browse files
committed
Improve docs on nightly builds, such as our own hosted docs
1 parent fce0d20 commit 18886e5

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ matrix:
193193
- export PATH=/usr/lib/llvm-10/bin/:$HOME/.local/bin:$PATH
194194
- export LLVM_PATH=/usr/share/llvm-10/cmake/
195195
script:
196-
- cargo doc --no-default-features --features "target-all,llvm10-0" --color=always
196+
- cargo doc --no-default-features --features "target-all,llvm10-0,nightly" --color=always
197197
- echo '<meta http-equiv="refresh" content="1; url=inkwell/index.html">' > target/doc/index.html
198198
rust: nightly
199199
name: "GitHub IO Documentation Deployment"

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ target-all = [
7979
"target-riscv"
8080
]
8181
experimental = ["static-alloc"]
82+
nightly = ["inkwell_internals/nightly"]
8283

8384
[dependencies]
8485
either = "1.5"

internal_macros/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ proc-macro2 = "1.0"
1515

1616
[lib]
1717
proc-macro = true
18+
19+
[features]
20+
nightly = []

internal_macros/src/lib.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl Parse for ParenthesizedFeatureSet {
179179
}
180180

181181
/// Handler for parsing of TokenStreams from macro input
182-
#[derive(Debug)]
182+
#[derive(Clone, Debug)]
183183
struct FeatureSet(std::vec::IntoIter<&'static str>, Option<Error>);
184184
impl Default for FeatureSet {
185185
fn default() -> Self {
@@ -307,8 +307,20 @@ pub fn llvm_versions(attribute_args: TokenStream, attributee: TokenStream) -> To
307307
return features.into_compile_error();
308308
}
309309

310+
// Add nightly only doc cfgs to improve documentation on nightly builds
311+
// such as our own hosted docs.
312+
let doc = if cfg!(feature = "nightly") {
313+
let features2 = features.clone();
314+
quote! {
315+
#[doc(cfg(any(#(feature = #features2),*)))]
316+
}
317+
} else {
318+
quote! {}
319+
};
320+
310321
let q = quote! {
311322
#[cfg(any(#(feature = #features),*))]
323+
#doc
312324
#folded
313325
};
314326

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//! * Most functions which take a string slice as input may possibly panic in the unlikely event that a c style string cannot be created based on it. (IE if your slice already has a null byte in it)
1010
1111
#![deny(missing_debug_implementations)]
12+
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
1213

1314
#[macro_use]
1415
extern crate inkwell_internals;

0 commit comments

Comments
 (0)