Skip to content

speechd 0.11.1 bindgen incorrect types

Hi there!

I'm having trouble building a Rust project that uses the tts crate, which in turn relies on this project. I believe this is caused by a breaking change from the upstream speechd project interacting poorly with your speech-dispatcher crate. I'm hoping I've opened this issue in the right place but please direct me elsewhere if there's a more appropriate venue to discuss this.

The speech-dispatcher crate's VoiceType enum is marked repr(u32). As of speechd 0.11.1 it looks like the SPDVoiceType enum defined in speechd_types.h now contains a SPD_UNSPECIFIED enum variant with the value -1. It looks like this landed in https://github.com/brailcom/speechd/pull/622 and 0309a0e4ce49c90c8557e7d23d4ccf2cc508a72b.

I believe this addition of a negative value to the enum has changed how bindgen generates the corresponding Rust code, producing an i32 to accommodate the negative value and breaking the u32 requirement imposed by speech-dispatcher. This manifests as build errors related to "mismatched types" when building speech-dispatcher on systems that have speechd 0.11.1 installed. For e.g.:

   Compiling speech-dispatcher v0.12.0
error[E0308]: mismatched types
  --> /build/blightmud-3.6.0-vendor.tar.gz/speech-dispatcher/src/lib.rs:35:13
   |
35 |     Male1 = SPDVoiceType::SPD_MALE1,
   |             ^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `i32`

Is this something that should be fixed in speech-dispatcher, or should it be brought to the speechd project?

Thanks!

Edited by Daniel