Skip to content

Commit 436e8ed

Browse files
authored
doc: enable nightly feature doc_auto_cfg for doc generation (#66)
* feat: add rustversion dep & core build script * feat: add doc_auto_cfg feature when compiling using nightly * doc: remove feature warning blocks * ci: update doc CI to use the nightly toolchain
1 parent c63d4ca commit 436e8ed

File tree

7 files changed

+26
-14
lines changed

7 files changed

+26
-14
lines changed

.github/workflows/doc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
submodules: recursive
2323
# Need to refine this by specifying components required for doc
24-
- uses: dtolnay/rust-toolchain@stable
24+
- uses: dtolnay/rust-toolchain@nightly
2525
- uses: peaceiris/actions-mdbook@v1
2626
with:
2727
mdbook-version: "0.4.36"
@@ -30,7 +30,7 @@ jobs:
3030
- name: Generate User Guide
3131
run: mdbook build -d ../target/doc/ honeycomb-guide/
3232
- name: Generate Rust Docs
33-
run: cargo doc --all --no-deps --features utils
33+
run: cargo +nightly doc --all --no-deps --features utils
3434

3535
- name: Deploy Docs
3636
uses: peaceiris/actions-gh-pages@v3

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ honeycomb-render = { version = "0.2.1", path = "./honeycomb-render" }
2929

3030
# common
3131
cfg-if = "1"
32+
rustversion = "1.0.15"
3233

3334
# core
3435
num = "0.4.2"

honeycomb-core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ single_precision = []
1919
[dependencies]
2020
cfg-if.workspace = true
2121
num.workspace = true
22+
23+
[build-dependencies]
24+
rustversion.workspace = true

honeycomb-core/build.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#[rustversion::nightly]
2+
fn set_rustc_channel_cfg() -> &'static str {
3+
"nightly"
4+
}
5+
6+
#[rustversion::beta]
7+
fn set_rustc_channel_cfg() -> &'static str {
8+
"beta"
9+
}
10+
11+
#[rustversion::stable]
12+
fn set_rustc_channel_cfg() -> &'static str {
13+
"stable"
14+
}
15+
16+
fn main() {
17+
println!("cargo:rustc-cfg={}", set_rustc_channel_cfg());
18+
}

honeycomb-core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
1919
// ------ CUSTOM LINTS
2020

21+
// --- enable doc_auto_cfg feature if compiling in nightly
22+
#![cfg_attr(nightly, feature(doc_auto_cfg))]
2123
// --- some though love for the code
2224
#![warn(missing_docs)]
2325
#![warn(clippy::pedantic)]

honeycomb-core/src/utils/generation.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
//! Utility for sample map generation
22
//!
3-
//! <div class="warning">
4-
//!
5-
//! **This code is only compiled if the `utils` feature is enabled.**
6-
//!
7-
//! </div>
8-
//!
93
//! This module contains code used for sample map / mesh generation. This is mostly
104
//! for testing and benchmarking, but could also be hijacked for very (topologically)
115
//! simple mesh generation, hence this being kept public.

honeycomb-core/src/utils/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
//! Utility functions & implementations
22
//!
3-
//! <div class="warning">
4-
//!
5-
//! **This code is only compiled if the `utils` feature is enabled.**
6-
//!
7-
//! </div>
8-
//!
93
//! This module implements basic utilities used for tests & benchmarking
104
//! of the structures & methods implemented in `honeycomb_core`.
115

0 commit comments

Comments
 (0)