Skip to content

Commit cd39b00

Browse files
committed
Update tests
1 parent 30bef9e commit cd39b00

6 files changed

Lines changed: 52 additions & 40 deletions

File tree

‎tests/unit/out/refcount/concepts.rs‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,17 @@ pub fn has_size_3() -> bool {
2727
return false;
2828
}
2929
pub fn pick_4(mut x: i32) -> i32 {
30-
if (true) && (true) {
30+
{
3131
return 1;
3232
}
3333
return 2;
3434
}
3535
pub fn pick_5(mut x: i64) -> i32 {
36-
if (true) && (false) {
37-
return 1;
38-
}
36+
{}
3937
return 2;
4038
}
4139
pub fn pick_6(mut x: f32) -> i32 {
42-
if (false) && (true) {
43-
return 1;
44-
}
40+
{}
4541
return 2;
4642
}
4743
pub fn main() {

‎tests/unit/out/refcount/constexpr_function.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ pub fn checked_5(mut x: i32) -> i32 {
3737
return (x + 1);
3838
}
3939
pub fn in_constant_context_6() -> bool {
40-
if false {
41-
return true;
42-
}
40+
{}
4341
return (({ runtime_only_0(1) }) == 0);
4442
}
4543
const _: () = assert!(true, "in_constant_context()");

‎tests/unit/out/refcount/if_constexpr.rs‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,43 @@ use std::io::{Read, Seek, Write};
77
use std::os::fd::AsFd;
88
use std::rc::{Rc, Weak};
99
pub fn classify_0(mut x: Ptr<i32>) -> i32 {
10-
if true {
10+
{
1111
return (x.read());
12-
} else {
1312
}
1413
return 1;
1514
}
1615
pub fn classify_1(mut x: i64) -> i32 {
17-
if false {
18-
} else if true {
19-
return 2;
16+
{
17+
{
18+
return 2;
19+
}
2020
}
2121
return 1;
2222
}
2323
pub fn classify_2(mut x: i32) -> i32 {
24-
if false {
25-
} else if false {
24+
{
25+
{}
2626
}
2727
return 1;
2828
}
2929
pub fn keep_both_3(mut x: i32) -> i32 {
30-
if true {
30+
{
3131
return (x + 1);
32-
} else {
33-
return (x - 1);
3432
}
3533
panic!("ub: non-void function does not return a value")
3634
}
35+
pub fn widen_4(mut v: u32) -> u64 {
36+
{}
37+
return (v as u64);
38+
}
39+
pub fn widen_5(mut v: u64) -> u64 {
40+
{
41+
let mut hi: u64 = v;
42+
hi <<= 32;
43+
return hi;
44+
}
45+
return v;
46+
}
3747
pub fn main() {
3848
__cpp2rust_init_globals();
3949
std::process::exit(main_0());
@@ -44,6 +54,8 @@ fn main_0() -> i32 {
4454
assert!((({ classify_1(1_i64,) }) == 2));
4555
assert!((({ classify_2(1,) }) == 1));
4656
assert!((({ keep_both_3(1,) }) == 2));
57+
assert!((({ widen_4(1_u32,) }) == 1_u64));
58+
assert!((({ widen_5(1_u64,) }) == 4294967296_u64));
4759
return 0;
4860
}
4961
pub fn __cpp2rust_init_globals() {}

‎tests/unit/out/unsafe/concepts.rs‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,17 @@ pub unsafe fn has_size_3() -> bool {
3232
return false;
3333
}
3434
pub unsafe fn pick_4(mut x: i32) -> i32 {
35-
if (true) && (true) {
35+
{
3636
return 1;
3737
}
3838
return 2;
3939
}
4040
pub unsafe fn pick_5(mut x: i64) -> i32 {
41-
if (true) && (false) {
42-
return 1;
43-
}
41+
{}
4442
return 2;
4543
}
4644
pub unsafe fn pick_6(mut x: f32) -> i32 {
47-
if (false) && (true) {
48-
return 1;
49-
}
45+
{}
5046
return 2;
5147
}
5248
pub fn main() {

‎tests/unit/out/unsafe/constexpr_function.rs‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ pub unsafe fn checked_5(mut x: i32) -> i32 {
4040
return ((x) + (1));
4141
}
4242
pub unsafe fn in_constant_context_6() -> bool {
43-
if false {
44-
return true;
45-
}
43+
{}
4644
return ((unsafe { runtime_only_0(1) }) == (0));
4745
}
4846
const _: () = assert!(true, "in_constant_context()");

‎tests/unit/out/unsafe/if_constexpr.rs‎

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,43 @@ use std::io::{Read, Seek, Write};
77
use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
99
pub unsafe fn classify_0(mut x: *mut i32) -> i32 {
10-
if true {
10+
{
1111
return (*x);
12-
} else {
1312
}
1413
return 1;
1514
}
1615
pub unsafe fn classify_1(mut x: i64) -> i32 {
17-
if false {
18-
} else if true {
19-
return 2;
16+
{
17+
{
18+
return 2;
19+
}
2020
}
2121
return 1;
2222
}
2323
pub unsafe fn classify_2(mut x: i32) -> i32 {
24-
if false {
25-
} else if false {
24+
{
25+
{}
2626
}
2727
return 1;
2828
}
2929
pub unsafe fn keep_both_3(mut x: i32) -> i32 {
30-
if true {
30+
{
3131
return ((x) + (1));
32-
} else {
33-
return ((x) - (1));
3432
}
3533
panic!("ub: non-void function does not return a value")
3634
}
35+
pub unsafe fn widen_4(mut v: u32) -> u64 {
36+
{}
37+
return (v as u64);
38+
}
39+
pub unsafe fn widen_5(mut v: u64) -> u64 {
40+
{
41+
let mut hi: u64 = v;
42+
hi <<= 32;
43+
return hi;
44+
}
45+
return v;
46+
}
3747
pub fn main() {
3848
unsafe {
3949
__cpp2rust_init_globals();
@@ -46,6 +56,8 @@ unsafe fn main_0() -> i32 {
4656
assert!(((unsafe { classify_1(1_i64,) }) == (2)));
4757
assert!(((unsafe { classify_2(1,) }) == (1)));
4858
assert!(((unsafe { keep_both_3(1,) }) == (2)));
59+
assert!(((unsafe { widen_4(1_u32,) }) == (1_u64)));
60+
assert!(((unsafe { widen_5(1_u64,) }) == (4294967296_u64)));
4961
return 0;
5062
}
5163
pub unsafe fn __cpp2rust_init_globals() {}

0 commit comments

Comments
 (0)