Skip to content

Commit d4f2b9d

Browse files
committed
Update tests
1 parent 42f60a0 commit d4f2b9d

14 files changed

Lines changed: 51 additions & 51 deletions

tests/ub/out/refcount/enum_out_of_range_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn main() {
2828
}
2929
fn main_0() -> i32 {
3030
let n: Value<i32> = Rc::new(RefCell::new(3));
31-
let c: Value<Color> = Rc::new(RefCell::new(Color::from((*n.borrow()) as i32)));
31+
let c: Value<Color> = Rc::new(RefCell::new(Color::from((*n.borrow()))));
3232
return if (((*c.borrow()) as i32) == (Color::BLUE as i32)) {
3333
0
3434
} else {

tests/ub/out/unsafe/enum_out_of_range_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn main() {
3030
}
3131
unsafe fn main_0() -> i32 {
3232
let mut n: i32 = 3;
33-
let mut c: Color = Color::from(n as i32);
33+
let mut c: Color = Color::from(n);
3434
return if ((c as i32) == (Color::BLUE as i32)) {
3535
0
3636
} else {

tests/unit/out/refcount/anonymous_enum_c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ fn main_0() -> i32 {
9999
assert!(((anon_enum_3::FIRST_A as i32) != (anon_enum_3::FIRST_B as i32)));
100100
assert!(((anon_enum_11::SECOND_A as i32) != (anon_enum_11::SECOND_B as i32)));
101101
assert!(((anon_enum_31::THIRD_A as i32) != (anon_enum_31::THIRD_B as i32)));
102-
let td: Value<TdEnum> = Rc::new(RefCell::new(TdEnum::from((TdEnum::TD_A as i32) as i32)));
102+
let td: Value<TdEnum> = Rc::new(RefCell::new(TdEnum::from((TdEnum::TD_A as i32))));
103103
assert!((((*td.borrow()) as u32) == ((TdEnum::TD_A as i32) as u32)));
104-
(*td.borrow_mut()) = TdEnum::from((TdEnum::TD_B as i32) as i32);
104+
(*td.borrow_mut()) = TdEnum::from((TdEnum::TD_B as i32));
105105
assert!((((*td.borrow()) as u32) == ((TdEnum::TD_B as i32) as u32)));
106106
let w: Value<WithAnonField> = <Value<WithAnonField>>::default();
107-
(*(*w.borrow()).field.borrow_mut()) = anon_enum_24::from((anon_enum_24::FIELD_A as i32) as i32);
107+
(*(*w.borrow()).field.borrow_mut()) = anon_enum_24::from((anon_enum_24::FIELD_A as i32));
108108
assert!((((*(*w.borrow()).field.borrow()) as u32) == ((anon_enum_24::FIELD_A as i32) as u32)));
109-
(*(*w.borrow()).field.borrow_mut()) = anon_enum_24::from((anon_enum_24::FIELD_B as i32) as i32);
109+
(*(*w.borrow()).field.borrow_mut()) = anon_enum_24::from((anon_enum_24::FIELD_B as i32));
110110
assert!((((*(*w.borrow()).field.borrow()) as u32) == ((anon_enum_24::FIELD_B as i32) as u32)));
111111
return 0;
112112
}

tests/unit/out/refcount/c_struct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ fn main_0() -> i32 {
9595
a: Rc::new(RefCell::new(5)),
9696
b: Rc::new(RefCell::new(6)),
9797
})),
98-
color: Rc::new(RefCell::new(Color::from((Color::GREEN as i32) as i32))),
98+
color: Rc::new(RefCell::new(Color::from((Color::GREEN as i32)))),
9999
count: Rc::new(RefCell::new(42)),
100100
}));
101101
assert!(((*(*(*c.borrow()).inner.borrow()).a.borrow()) == 5));
102102
assert!(((*(*(*c.borrow()).inner.borrow()).b.borrow()) == 6));
103103
assert!((((*(*c.borrow()).color.borrow()) as u32) == ((Color::GREEN as i32) as u32)));
104104
assert!(((*(*c.borrow()).count.borrow()) == 42));
105105
let c2: Value<Container> = <Value<Container>>::default();
106-
(*(*c2.borrow()).color.borrow_mut()) = Color::from((Color::BLUE as i32) as i32);
106+
(*(*c2.borrow()).color.borrow_mut()) = Color::from((Color::BLUE as i32));
107107
assert!((((*(*c2.borrow()).color.borrow()) as u32) == 2_u32));
108108
return 0;
109109
}

tests/unit/out/refcount/enum_int_interop.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub fn classify_option_1(option: i32) -> i32 {
8989
}
9090
pub fn make_color_2(n: i32) -> Color {
9191
let n: Value<i32> = Rc::new(RefCell::new(n));
92-
return Color::from((*n.borrow()) as i32);
92+
return Color::from((*n.borrow()));
9393
}
9494
pub fn main() {
9595
std::process::exit(main_0());
@@ -123,7 +123,7 @@ fn main_0() -> i32 {
123123
assert!(((*x.borrow()) == 0));
124124
let y: Value<i32> = Rc::new(RefCell::new((((*c.borrow()) as i32) + 1)));
125125
assert!(((*y.borrow()) == 1));
126-
(*c.borrow_mut()) = Color::from(2 as i32);
126+
(*c.borrow_mut()) = Color::from(2);
127127
assert!((((*c.borrow()) as i32) == (Color::BLUE as i32)));
128128
assert!((((*c.borrow()) as i32) == 2));
129129
(*c.borrow_mut()) = ({
@@ -132,15 +132,15 @@ fn main_0() -> i32 {
132132
});
133133
assert!((((*c.borrow()) as i32) == (Color::GREEN as i32)));
134134
let cmp: Value<Color> = Rc::new(RefCell::new(Color::from(
135-
((((*c.borrow()) as i32) + 1) as i32) as i32,
135+
((((*c.borrow()) as i32) + 1) as i32),
136136
)));
137137
assert!((((*cmp.borrow()) as i32) == (Color::BLUE as i32)));
138138
let o: Value<Option> = Rc::new(RefCell::new(Option::OPT_A));
139139
assert!((((*o.borrow()) as i32) == (Option::OPT_A as i32)));
140140
assert!((((*o.borrow()) as i32) == 10));
141141
let oi: Value<i32> = Rc::new(RefCell::new(((*o.borrow()) as i32).clone()));
142142
assert!(((*oi.borrow()) == 10));
143-
(*o.borrow_mut()) = Option::from(20 as i32);
143+
(*o.borrow_mut()) = Option::from(20);
144144
assert!((((*o.borrow()) as i32) == (Option::OPT_B as i32)));
145145
let rc: Value<i32> = Rc::new(RefCell::new(
146146
({
@@ -164,7 +164,7 @@ fn main_0() -> i32 {
164164
assert!((((*t.borrow()) as i32) == (Tag::TAG_ONE as i32)));
165165
let ti: Value<i32> = Rc::new(RefCell::new(((*t.borrow()) as i32).clone()));
166166
assert!(((*ti.borrow()) == 1));
167-
(*t.borrow_mut()) = Tag::from(2 as i32);
167+
(*t.borrow_mut()) = Tag::from(2);
168168
assert!((((*t.borrow()) as i32) == (Tag::TAG_TWO as i32)));
169169
'switch: {
170170
let __match_cond = ((*t.borrow()) as i32);

tests/unit/out/refcount/enum_int_interop_c.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ pub fn classify_option_1(option: i32) -> i32 {
8989
}
9090
pub fn make_color_2(n: i32) -> Color {
9191
let n: Value<i32> = Rc::new(RefCell::new(n));
92-
return Color::from((*n.borrow()) as i32);
92+
return Color::from((*n.borrow()));
9393
}
9494
pub fn main() {
9595
std::process::exit(main_0());
9696
}
9797
fn main_0() -> i32 {
98-
let c: Value<Color> = Rc::new(RefCell::new(Color::from((Color::RED as i32) as i32)));
98+
let c: Value<Color> = Rc::new(RefCell::new(Color::from((Color::RED as i32))));
9999
assert!((((*c.borrow()) as u32) == ((Color::RED as i32) as u32)));
100100
assert!((((*c.borrow()) as u32) == 0_u32));
101101
assert!((((*c.borrow()) as u32) != 1_u32));
@@ -125,7 +125,7 @@ fn main_0() -> i32 {
125125
((((*c.borrow()) as u32).wrapping_add(1_u32)) as i32),
126126
));
127127
assert!(((*y.borrow()) == 1));
128-
(*c.borrow_mut()) = Color::from(2 as i32);
128+
(*c.borrow_mut()) = Color::from(2);
129129
assert!((((*c.borrow()) as u32) == ((Color::BLUE as i32) as u32)));
130130
assert!((((*c.borrow()) as u32) == 2_u32));
131131
(*c.borrow_mut()) = ({
@@ -137,12 +137,12 @@ fn main_0() -> i32 {
137137
((((*c.borrow()) as u32).wrapping_add(1_u32)) as u32) as i32,
138138
)));
139139
assert!((((*cmp.borrow()) as u32) == ((Color::BLUE as i32) as u32)));
140-
let o: Value<Option> = Rc::new(RefCell::new(Option::from((Option::OPT_A as i32) as i32)));
140+
let o: Value<Option> = Rc::new(RefCell::new(Option::from((Option::OPT_A as i32))));
141141
assert!((((*o.borrow()) as u32) == ((Option::OPT_A as i32) as u32)));
142142
assert!((((*o.borrow()) as u32) == 10_u32));
143143
let oi: Value<i32> = Rc::new(RefCell::new(((*o.borrow()) as i32).clone()));
144144
assert!(((*oi.borrow()) == 10));
145-
(*o.borrow_mut()) = Option::from(20 as i32);
145+
(*o.borrow_mut()) = Option::from(20);
146146
assert!((((*o.borrow()) as u32) == ((Option::OPT_B as i32) as u32)));
147147
let rc: Value<i32> = Rc::new(RefCell::new(
148148
({
@@ -161,12 +161,12 @@ fn main_0() -> i32 {
161161
classify_option_1(_option)
162162
});
163163
assert!(((*rc.borrow()) == 3));
164-
let t: Value<Tag> = Rc::new(RefCell::new(Tag::from((Tag::TAG_ONE as i32) as i32)));
164+
let t: Value<Tag> = Rc::new(RefCell::new(Tag::from((Tag::TAG_ONE as i32))));
165165
assert!((((*t.borrow()) as u32) == 1_u32));
166166
assert!((((*t.borrow()) as u32) == ((Tag::TAG_ONE as i32) as u32)));
167167
let ti: Value<i32> = Rc::new(RefCell::new(((*t.borrow()) as i32).clone()));
168168
assert!(((*ti.borrow()) == 1));
169-
(*t.borrow_mut()) = Tag::from(2 as i32);
169+
(*t.borrow_mut()) = Tag::from(2);
170170
assert!((((*t.borrow()) as u32) == ((Tag::TAG_TWO as i32) as u32)));
171171
'switch: {
172172
let __match_cond = ((*t.borrow()) as u32);

tests/unit/out/unsafe/anonymous_enum_c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ unsafe fn main_0() -> i32 {
101101
assert!(((anon_enum_3::FIRST_A as i32) != (anon_enum_3::FIRST_B as i32)));
102102
assert!(((anon_enum_11::SECOND_A as i32) != (anon_enum_11::SECOND_B as i32)));
103103
assert!(((anon_enum_31::THIRD_A as i32) != (anon_enum_31::THIRD_B as i32)));
104-
let mut td: TdEnum = TdEnum::from((TdEnum::TD_A as i32) as i32);
104+
let mut td: TdEnum = TdEnum::from((TdEnum::TD_A as i32));
105105
assert!(((td as u32) == ((TdEnum::TD_A as i32) as u32)));
106-
td = (TdEnum::from((TdEnum::TD_B as i32) as i32)).clone();
106+
td = (TdEnum::from((TdEnum::TD_B as i32))).clone();
107107
assert!(((td as u32) == ((TdEnum::TD_B as i32) as u32)));
108108
let mut w: WithAnonField = <WithAnonField>::default();
109-
w.field = anon_enum_24::from((anon_enum_24::FIELD_A as i32) as i32);
109+
w.field = anon_enum_24::from((anon_enum_24::FIELD_A as i32));
110110
assert!(((w.field as u32) == ((anon_enum_24::FIELD_A as i32) as u32)));
111-
w.field = (anon_enum_24::from((anon_enum_24::FIELD_B as i32) as i32)).clone();
111+
w.field = (anon_enum_24::from((anon_enum_24::FIELD_B as i32))).clone();
112112
assert!(((w.field as u32) == ((anon_enum_24::FIELD_B as i32) as u32)));
113113
return 0;
114114
}

tests/unit/out/unsafe/c_struct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ unsafe fn main_0() -> i32 {
8080
assert!((((*b.next).value) == (1)));
8181
let mut c: Container = Container {
8282
inner: Inner { a: 5, b: 6 },
83-
color: Color::from((Color::GREEN as i32) as i32),
83+
color: Color::from((Color::GREEN as i32)),
8484
count: 42,
8585
};
8686
assert!(((c.inner.a) == (5)));
8787
assert!(((c.inner.b) == (6)));
8888
assert!(((c.color as u32) == ((Color::GREEN as i32) as u32)));
8989
assert!(((c.count) == (42)));
9090
let mut c2: Container = <Container>::default();
91-
c2.color = Color::from((Color::BLUE as i32) as i32);
91+
c2.color = Color::from((Color::BLUE as i32));
9292
assert!(((c2.color as u32) == (2_u32)));
9393
return 0;
9494
}

tests/unit/out/unsafe/enum_int_interop.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub unsafe fn classify_option_1(mut option: i32) -> i32 {
8686
panic!("ub: non-void function does not return a value")
8787
}
8888
pub unsafe fn make_color_2(mut n: i32) -> Color {
89-
return Color::from(n as i32);
89+
return Color::from(n);
9090
}
9191
pub fn main() {
9292
unsafe {
@@ -122,22 +122,22 @@ unsafe fn main_0() -> i32 {
122122
assert!(((x) == (0)));
123123
let mut y: i32 = ((c as i32) + (1));
124124
assert!(((y) == (1)));
125-
c = Color::from(2 as i32);
125+
c = Color::from(2);
126126
assert!(((c as i32) == (Color::BLUE as i32)));
127127
assert!(((c as i32) == (2)));
128128
c = (unsafe {
129129
let _n: i32 = 1;
130130
make_color_2(_n)
131131
});
132132
assert!(((c as i32) == (Color::GREEN as i32)));
133-
let mut cmp: Color = Color::from((((c as i32) + (1)) as i32) as i32);
133+
let mut cmp: Color = Color::from((((c as i32) + (1)) as i32));
134134
assert!(((cmp as i32) == (Color::BLUE as i32)));
135135
let mut o: Option = Option::OPT_A;
136136
assert!(((o as i32) == (Option::OPT_A as i32)));
137137
assert!(((o as i32) == (10)));
138138
let mut oi: i32 = (o as i32);
139139
assert!(((oi) == (10)));
140-
o = Option::from(20 as i32);
140+
o = Option::from(20);
141141
assert!(((o as i32) == (Option::OPT_B as i32)));
142142
let mut rc: i32 = (unsafe {
143143
let _option: i32 = (o as i32);
@@ -159,7 +159,7 @@ unsafe fn main_0() -> i32 {
159159
assert!(((t as i32) == (Tag::TAG_ONE as i32)));
160160
let mut ti: i32 = (t as i32);
161161
assert!(((ti) == (1)));
162-
t = Tag::from(2 as i32);
162+
t = Tag::from(2);
163163
assert!(((t as i32) == (Tag::TAG_TWO as i32)));
164164
'switch: {
165165
let __match_cond = (t as i32);

tests/unit/out/unsafe/enum_int_interop_c.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ pub unsafe fn classify_option_1(mut option: i32) -> i32 {
8686
panic!("ub: non-void function does not return a value")
8787
}
8888
pub unsafe fn make_color_2(mut n: i32) -> Color {
89-
return Color::from(n as i32);
89+
return Color::from(n);
9090
}
9191
pub fn main() {
9292
unsafe {
9393
std::process::exit(main_0() as i32);
9494
}
9595
}
9696
unsafe fn main_0() -> i32 {
97-
let mut c: Color = Color::from((Color::RED as i32) as i32);
97+
let mut c: Color = Color::from((Color::RED as i32));
9898
assert!(((c as u32) == ((Color::RED as i32) as u32)));
9999
assert!(((c as u32) == (0_u32)));
100100
assert!(((c as u32) != (1_u32)));
@@ -122,7 +122,7 @@ unsafe fn main_0() -> i32 {
122122
assert!(((x) == (0)));
123123
let mut y: i32 = (((c as u32).wrapping_add(1_u32)) as i32);
124124
assert!(((y) == (1)));
125-
c = Color::from(2 as i32);
125+
c = Color::from(2);
126126
assert!(((c as u32) == ((Color::BLUE as i32) as u32)));
127127
assert!(((c as u32) == (2_u32)));
128128
c = (unsafe {
@@ -132,12 +132,12 @@ unsafe fn main_0() -> i32 {
132132
assert!(((c as u32) == ((Color::GREEN as i32) as u32)));
133133
let mut cmp: Color = Color::from((((c as u32).wrapping_add(1_u32)) as u32) as i32);
134134
assert!(((cmp as u32) == ((Color::BLUE as i32) as u32)));
135-
let mut o: Option = Option::from((Option::OPT_A as i32) as i32);
135+
let mut o: Option = Option::from((Option::OPT_A as i32));
136136
assert!(((o as u32) == ((Option::OPT_A as i32) as u32)));
137137
assert!(((o as u32) == (10_u32)));
138138
let mut oi: i32 = (o as i32);
139139
assert!(((oi) == (10)));
140-
o = Option::from(20 as i32);
140+
o = Option::from(20);
141141
assert!(((o as u32) == ((Option::OPT_B as i32) as u32)));
142142
let mut rc: i32 = (unsafe {
143143
let _option: i32 = (o as i32);
@@ -154,12 +154,12 @@ unsafe fn main_0() -> i32 {
154154
classify_option_1(_option)
155155
});
156156
assert!(((rc) == (3)));
157-
let mut t: Tag = Tag::from((Tag::TAG_ONE as i32) as i32);
157+
let mut t: Tag = Tag::from((Tag::TAG_ONE as i32));
158158
assert!(((t as u32) == (1_u32)));
159159
assert!(((t as u32) == ((Tag::TAG_ONE as i32) as u32)));
160160
let mut ti: i32 = (t as i32);
161161
assert!(((ti) == (1)));
162-
t = Tag::from(2 as i32);
162+
t = Tag::from(2);
163163
assert!(((t as u32) == ((Tag::TAG_TWO as i32) as u32)));
164164
'switch: {
165165
let __match_cond = (t as u32);

0 commit comments

Comments
 (0)