]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/combine_clone_of_primitives.rs
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
[rust.git] / tests / mir-opt / combine_clone_of_primitives.rs
1 // unit-test: InstCombine
2 // ignore-wasm32 compiled with panic=abort by default
3
4 // EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff
5
6 #[derive(Clone)]
7 struct MyThing<T> {
8     v: T,
9     i: u64,
10     a: [f32; 3],
11 }
12
13 fn main() {
14     let x = MyThing::<i16> { v: 2, i: 3, a: [0.0; 3] };
15     let y = x.clone();
16
17     assert_eq!(y.v, 2);
18     assert_eq!(y.i, 3);
19     assert_eq!(y.a, [0.0; 3]);
20 }