Skip to content

Commit 8a03959

Browse files
committed
Fix building for windows
Windows building fails with: ``` error[E0308]: mismatched types --> src\cass_error.rs:137:81 | 137 | CassError((CassErrorSource::CASS_ERROR_SOURCE_SERVER.0 << 24) | (*num as u32)) | ^^^^^^^^^^^^^ expected `i32`, found `u32` error[E0277]: no implementation for `i32 | u32` --> src\cass_error.rs:137:79 | 137 | CassError((CassErrorSource::CASS_ERROR_SOURCE_SERVER.0 << 24) | (*num as u32)) | ^ no implementation for `i32 | u32` ```
1 parent e975b83 commit 8a03959

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scylla-rust-wrapper/src/cass_error.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ impl ToCassError for DbError {
134134
DbError::AlreadyExists { .. } => CassError::CASS_ERROR_SERVER_ALREADY_EXISTS,
135135
DbError::Unprepared { .. } => CassError::CASS_ERROR_SERVER_UNPREPARED,
136136
DbError::Other(num) => {
137-
CassError((CassErrorSource::CASS_ERROR_SOURCE_SERVER.0 << 24) | *num as u32)
137+
// On windows enums are i32, so we need to cast it
138+
#[allow(clippy::unnecessary_cast)]
139+
let source = CassErrorSource::CASS_ERROR_SOURCE_SERVER.0 as u32;
140+
let code = (source << 24) | (*num as u32);
141+
CassError(code as _)
138142
}
139143
// TODO: add appropriate error if rate limit reached
140144
DbError::RateLimitReached { .. } => CassError::CASS_ERROR_SERVER_UNAVAILABLE,

0 commit comments

Comments
 (0)