-
Notifications
You must be signed in to change notification settings - Fork 155
Closed
Labels
Description
Contrary to popular belief, char
's signedness is undefined; it is commonly signed on x86_64 and unsigned on AArch64 and the Rust raw
types follow their C counterparts: https://doc.rust-lang.org/std/os/raw/type.c_char.html
Encountered running tests on AArch64:
error[E0600]: cannot apply unary operator `-` to type `u8`
--> flux/src/cffi.rs:1152:35
|
1152 | let v: Vec<c_char> = vec![-61, 0];
| ^^^ cannot apply unary operator `-`
|
= note: unsigned values cannot be negated
For more information about this error, try `rustc --explain E0600`.
error: could not compile `flux` (lib test) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: builder for '/nix/store/r4bi44lb9wbpyplh31lfg69wv8l6ma9a-libflux-v0.194.5.drv' failed with exit code 101;
The offending unary -
:
Lines 1148 to 1153 in 27fa85d
#[test] | |
fn parse_with_invalid_utf8() { | |
let cfname = CString::new("foo.flux").unwrap(); | |
let cfname_ptr: *const c_char = cfname.as_ptr(); | |
let v: Vec<c_char> = vec![-61, 0]; | |
let csrc: *const c_char = &v[0]; |