File tree Expand file tree Collapse file tree 3 files changed +8
-18
lines changed
Expand file tree Collapse file tree 3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -207,26 +207,18 @@ field were declared `pub`.
207207
208208### Third attempt
209209
210- We can use ` #[cfg(rustdoc)] ` to distinguish when documentation is being
211- rendered, though this cfg is currently available on nightly only. The tracking
212- issue is [ rust-lang/rust #43781 ] .
210+ We can use [ ` #[cfg(doc)] ` ] [ cfgdoc ] to distinguish when documentation is being
211+ rendered, which is available since Rust 1.41.
213212
214- [ rust-lang/rust#43781 ] : https://github.com/rust-lang/rust/issues/43781
215-
216- I ended up using a Cargo config to have rustdoc pass some different cfg.
217-
218- ``` toml
219- [build ]
220- rustdocflags = [" --cfg" , " oqueue_docs" ]
221- ```
213+ [ cfgdoc ] : https://doc.rust-lang.org/1.67.0/rustdoc/advanced-features.html#cfgdoc-documenting-platform-specific-or-feature-specific-information
222214
223215``` rust
224216#[repr(C )]
225217pub struct Task {
226- #[cfg(oqueue_docs )]
218+ #[cfg(doc )]
227219 pub index : usize ,
228220
229- #[cfg(not(oqueue_docs ))]
221+ #[cfg(not(doc ))]
230222 index : usize ,
231223
232224 // other private fields
@@ -273,7 +265,7 @@ the behavior as an attribute macro][readonly] is the easy part:
273265
274266``` rust
275267/// ...
276- #[readonly:: make(doc = oqueue_docs) ]
268+ #[readonly:: make]
277269pub struct Task {
278270 /// ...
279271 ///
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,10 +6,10 @@ mod oqueue {
66 #[ derive( Default ) ]
77 #[ repr( C ) ]
88 pub struct Task {
9- #[ cfg( oqueue_docs ) ]
9+ #[ cfg( doc ) ]
1010 pub index : usize ,
1111
12- #[ cfg( not( oqueue_docs ) ) ]
12+ #[ cfg( not( doc ) ) ]
1313 index : usize ,
1414
1515 // Other private fields:
You can’t perform that action at this time.
0 commit comments