Skip to content

Commit

Permalink
test: address comments and pacify the merciless tidy.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Feb 8, 2020
1 parent da33935 commit d69b3b1
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/test/auxiliary/rust_test_helpers.c
Expand Up @@ -346,9 +346,9 @@ struct U8TaggedEnumOptionU64U64 {
uint8_t tag;
union {
struct {
uint64_t a;
uint64_t b;
} some;
uint64_t a;
uint64_t b;
} some;
};
};

Expand Down
@@ -1,6 +1,3 @@
#![crate_type = "lib"]
#![crate_name = "nonclike"]

#[repr(C, u8)]
pub enum TT {
AA(u64, u64),
Expand Down
Expand Up @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) {
uint64_t rr = tt_add(xx, yy);
assert(33 == rr);

/* This one returns an incorrect result. */
/* This one used to return an incorrect result (see issue #68190). */
T x = { .tag = A, .a = { ._0 = 1 } };
T y = { .tag = A, .a = { ._0 = 10 } };
uint64_t r = t_add(x, y);
Expand Down
@@ -1,6 +1,3 @@
#![crate_type = "bin"]
#![crate_name = "nonclike"]

#[repr(C, u8)]
pub enum TT {
AA(u64, u64),
Expand Down
@@ -1,6 +1,3 @@
#![crate_type = "bin"]
#![crate_name = "nonclike"]

#[repr(C, u8)]
pub enum TT {
AA(u64, u64),
Expand Down
3 changes: 0 additions & 3 deletions src/test/run-make-fulldeps/return-non-c-like-enum/nonclike.rs
@@ -1,6 +1,3 @@
#![crate_type = "lib"]
#![crate_name = "nonclike"]

#[repr(C, u8)]
pub enum TT {
AA(u64, u64),
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make-fulldeps/return-non-c-like-enum/test.c
Expand Up @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) {
assert(10 == tt.aa._0);
assert(20 == tt.aa._1);

/* This one segfaults. */
/* This one used to segfault (see issue #68190). */
T t = t_new(10);
assert(A == t.tag);
assert(10 == t.a._0);
Expand Down
14 changes: 11 additions & 3 deletions src/test/ui/abi/abi-sysv64-arg-passing.rs
Expand Up @@ -139,7 +139,11 @@ mod tests {
pub fn rust_dbg_abi_2(f: Floats) -> Floats;
pub fn rust_dbg_new_some_u64u64(a: u64, b: u64) -> U8TaggedEnumOptionU64U64;
pub fn rust_dbg_new_none_u64u64() -> U8TaggedEnumOptionU64U64;
pub fn rust_dbg_unpack_option_u64u64(o: U8TaggedEnumOptionU64U64, a: *mut u64, b: *mut u64) -> i32;
pub fn rust_dbg_unpack_option_u64u64(
o: U8TaggedEnumOptionU64U64,
a: *mut u64,
b: *mut u64,
) -> i32;
pub fn rust_dbg_new_some_u64(some: u64) -> U8TaggedEnumOptionU64;
pub fn rust_dbg_new_none_u64() -> U8TaggedEnumOptionU64;
pub fn rust_dbg_unpack_option_u64(o: U8TaggedEnumOptionU64, v: *mut u64) -> i32;
Expand Down Expand Up @@ -371,14 +375,18 @@ mod tests {

let mut a: u64 = 0;
let mut b: u64 = 0;
let r = unsafe { rust_dbg_unpack_option_u64u64(some_u64u64, &mut a as *mut _, &mut b as *mut _) };
let r = unsafe {
rust_dbg_unpack_option_u64u64(some_u64u64, &mut a as *mut _, &mut b as *mut _)
};
assert_eq!(1, r);
assert_eq!(10, a);
assert_eq!(20, b);

let mut a: u64 = 0;
let mut b: u64 = 0;
let r = unsafe { rust_dbg_unpack_option_u64u64(none_u64u64, &mut a as *mut _, &mut b as *mut _) };
let r = unsafe {
rust_dbg_unpack_option_u64u64(none_u64u64, &mut a as *mut _, &mut b as *mut _)
};
assert_eq!(0, r);
assert_eq!(0, a);
assert_eq!(0, b);
Expand Down

0 comments on commit d69b3b1

Please sign in to comment.