Skip to content

Commit f69aaa8

Browse files
committed
[codegen] Break build dependency between tests and lib
Since codegen test artifacts are rendered in crate documentation, changes to those artifacts place the crate source in a dirty state. This effectively serializes codegen blessing, since cargo must rebuild `zerocopy` between each test. We correct this by stubbing out `codegen_section!` when `cfg(not(doc))`. Makes progress towards #3079. gherrit-pr-id: Gcf771ba083fd307e788ceb72bc09085177a48ca8
1 parent c184959 commit f69aaa8

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/util/macros.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,37 @@ macro_rules! codegen_preamble {
982982
}
983983
}
984984

985+
/// Stub for rendering codegen documentation; used to break build dependency
986+
/// between benches and zerocopy when re-blessing codegen tests.
987+
#[allow(unused)]
988+
#[cfg(not(doc))]
989+
macro_rules! codegen_section {
990+
(
991+
header = $level:expr,
992+
bench = $bench:expr,
993+
format = $format:expr,
994+
arity = $arity:literal,
995+
$([
996+
$($open:ident)?
997+
@index $index:literal
998+
@title $title:literal
999+
@variant $variant:literal
1000+
]),*
1001+
) => {
1002+
""
1003+
};
1004+
(
1005+
header = $level:expr,
1006+
bench = $bench:expr,
1007+
format = $format:expr,
1008+
) => {
1009+
""
1010+
};
1011+
}
1012+
9851013
/// Generates the HTML for code generation documentation.
9861014
#[allow(unused)]
1015+
#[cfg(doc)]
9871016
macro_rules! codegen_section {
9881017
(
9891018
header = $level:expr,

0 commit comments

Comments
 (0)