Commit f979631
fix cargo doc CI step
Introduce a dummy feature to hack around `cargo doc --all-features`
always hitting the compile_error!(...) in vhost/src/lib.rs about
incompatible features.
This is happening because when documenting vhost-user-backend, cargo
does not pass --cfg doc to dependencies, meaning the cfg(not(doc))
attribute that is supposed to eliminate this compile_error!() invokation
when building docs does not actually trigger. Hence cargo doc fails.
Introduce a custom cfg, which we tell docs.rs to set during
documentation build, which disables the compile_error!(). Our CI also
sets this flag for the rustdoc step (via an ugly `sed` in the pipeline
definition). This cfg is also set by rust-vmm-ci for the cargo doc step.
Note that we need both cfg(not(doc)) and
cfg(not(RUTSDOC_disable_feature_compat_errors)), because lib.rs gets
processed twice, onces by rustc (where the --cfg is passed via
RUSTFLAGS), and once by rustdoc itself, where RUSTFLAGS are ignored, and
instead the cfg(doc) macro comes into play (but rustdoc is only ran on
the crate for which we are actually generating docs, not the
dependencies).
Signed-off-by: Patrick Roy <[email protected]>1 parent b222aac commit f979631
File tree
4 files changed
+25
-9
lines changed- vhost-user-backend
- src
- vhost
- src
4 files changed
+25
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
35 | | - | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
41 | 44 | | |
42 | 45 | | |
43 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
0 commit comments