Skip to content

Commit 90739b1

Browse files
committed
Fix C++ build breakage caused by changed in stringify! output in nightly Rust
The C++ build started failling with nightly rust: rust-lang/rust#125174 changed the output of strignify! to contins more spaces between tokens, which we relied on to perform some type substitution from Rust types to C++ types, resulting in compilation errors: ``` build/api/cpp/generated_include/slint_builtin_structs_internal.h:71:5: error: ‘Option’ does not name a type 71 | Option < core :: ops :: Range < i32 >> replacement_range; | ^~~~~~ build/api/cpp/generated_include/slint_builtin_structs_internal.h:75:14: error: ‘core’ was not declared in this scope 75 | Option < core :: ops :: Range < i32 >> preedit_selection; | ^~~~ ``` Workaround by cleaning whitespace before matching the types.
1 parent 20c6393 commit 90739b1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/cpp/cbindgen.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ fn builtin_structs(path: &Path) -> anyhow::Result<()> {
141141
)*
142142
$(
143143
$(writeln!(file, " ///{}", $pri_doc)?;)*
144-
let pri_type = match stringify!($pri_type) {
144+
let pri_type = stringify!($pri_type).replace(' ', "");
145+
let pri_type = match pri_type.as_str() {
145146
"usize" => "uintptr_t",
146147
"crate::animations::Instant" => "uint64_t",
147148
// This shouldn't be accessed by the C++ anyway, just need to have the same ABI in a struct

0 commit comments

Comments
 (0)