]> git.lizzy.rs Git - rust.git/blob - tests/ui/self/by-value-self-in-mut-slot.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / self / by-value-self-in-mut-slot.rs
1 // run-pass
2
3 struct X {
4     a: isize
5 }
6
7 trait Changer {
8     fn change(self) -> Self;
9 }
10
11 impl Changer for X {
12     fn change(mut self) -> X {
13         self.a = 55;
14         self
15     }
16 }
17
18 pub fn main() {
19     let x = X { a: 32 };
20     let new_x = x.change();
21     assert_eq!(new_x.a, 55);
22 }