Skip to content

Commit a59e9f7

Browse files
committed
feat: skip if cfg! branch that panics on Cython
1 parent f34453d commit a59e9f7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/bindgen/ir/constant.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -841,12 +841,16 @@ impl Constant {
841841
language_backend.write_literal(out, value);
842842
}
843843
Language::Cython => {
844-
out.write("const ");
845-
language_backend.write_type(out, &self.ty);
846-
// For extern Cython declarations the initializer is ignored,
847-
// but still useful as documentation, so we write it as a comment.
848-
write!(out, " {} # = ", name);
849-
language_backend.write_literal(out, value);
844+
if matches!(self.value, Literal::PanicMacro(_)) {
845+
// Cython don't have a equivalent to `#error` directive
846+
} else {
847+
out.write("const ");
848+
language_backend.write_type(out, &self.ty);
849+
// For extern Cython declarations the initializer is ignored,
850+
// but still useful as documentation, so we write it as a comment.
851+
write!(out, " {} # = ", name);
852+
language_backend.write_literal(out, value);
853+
}
850854
}
851855
}
852856

0 commit comments

Comments
 (0)