whisper_gretype mismatch under msvc build
Opened this issue · 1 comments
hlhr202 commented
toolchain:
stable-x86_64-pc-windows-msvc (default)
rustc 1.76.0 (07dca489a 2024-02-04)
clang:
clang version 17.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/mingw64/bin
cl:
Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32824 for x64
when building whisper-rs with whisper-rs-sys, the type mismatched.
error[E0308]: mismatched types
--> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:13:11
|
13 | End = whisper_gretype_WHISPER_GRETYPE_END,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
error[E0308]: mismatched types
--> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:15:17
|
15 | Alternate = whisper_gretype_WHISPER_GRETYPE_ALT,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
error[E0308]: mismatched types
--> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:17:21
|
17 | RuleReference = whisper_gretype_WHISPER_GRETYPE_RULE_REF,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
error[E0308]: mismatched types
--> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:19:17
|
19 | Character = whisper_gretype_WHISPER_GRETYPE_CHAR,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
error[E0308]: mismatched types
--> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:21:20
|
21 | NotCharacter = whisper_gretype_WHISPER_GRETYPE_CHAR_NOT,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
error[E0308]: mismatched types
--> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:23:27
|
23 | CharacterRangeUpper = whisper_gretype_WHISPER_GRETYPE_CHAR_RNG_UPPER,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
error[E0308]: mismatched types
--> C:\Users\Lenovo\.cargo\git\checkouts\whisper-rs-c8b9fa7c09c8c913\4dca14d\src\whisper_grammar.rs:25:26
|
25 | CharacterAlternate = whisper_gretype_WHISPER_GRETYPE_CHAR_ALT,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `i32`, found `u32`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `whisper-rs` (lib) due to 7 previous errors
I m wondering the problem came from here
whisper-rs/src/whisper_grammar.rs
Line 9 in 4dca14d
we should align msvc special type just to be u32
#[cfg_attr(any(not(windows), target_env = "gnu"), repr(u32))] // include windows-gnu
#[cfg_attr(all(windows, not(target_env = "gnu")), repr(u32))] // msvc being *special* again
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum WhisperGrammarElementType {
/// End of rule definition
End = whisper_gretype_WHISPER_GRETYPE_END,
/// Start of alternate definition for a rule
Alternate = whisper_gretype_WHISPER_GRETYPE_ALT,
/// Non-terminal element: reference to another rule
RuleReference = whisper_gretype_WHISPER_GRETYPE_RULE_REF,
/// Terminal element: character (code point)
Character = whisper_gretype_WHISPER_GRETYPE_CHAR,
/// Inverse of a character(s)
NotCharacter = whisper_gretype_WHISPER_GRETYPE_CHAR_NOT,
/// Modifies a preceding [Self::Character] to be an inclusive range
CharacterRangeUpper = whisper_gretype_WHISPER_GRETYPE_CHAR_RNG_UPPER,
/// Modifies a preceding [Self::Character] to add an alternate character to match
CharacterAlternate = whisper_gretype_WHISPER_GRETYPE_CHAR_ALT,
}
kizaski commented
I'm getting those errors but with the types the other way around with the stable-x86_64-pc-windows-gnu toolchain. No errors if I switch the toolchain to msvc.