]> git.proxmox.com Git - rustc.git/blame - src/test/ui/self/uniq-self-in-mut-slot.rs
New upstream version 1.57.0+dfsg1
[rustc.git] / src / test / ui / self / uniq-self-in-mut-slot.rs
CommitLineData
b7449926 1// run-pass
1a4d82fc
JJ
2
3struct X {
c34b1796 4 a: isize
1a4d82fc
JJ
5}
6
7trait Changer {
c30ab7b3 8 fn change(self: Box<Self>) -> Box<Self>;
1a4d82fc
JJ
9}
10
11impl Changer for X {
12 fn change(mut self: Box<X>) -> Box<X> {
13 self.a = 55;
14 self
15 }
16}
223e47cc
LB
17
18pub fn main() {
c295e0f8 19 let x: Box<_> = Box::new(X { a: 32 });
1a4d82fc
JJ
20 let new_x = x.change();
21 assert_eq!(new_x.a, 55);
223e47cc 22}