fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.8 KiB137 linesraw
1error: cannot move out of value because it is borrowed
2  --> $DIR/borrowck-pat-at-and-box.rs:31:9
3   |
4LL |     let ref a @ box b = Box::new(NC);
5   |         ^^^^^       - value is moved into `b` here
6   |         |
7   |         value is borrowed by `a` here
8
9error: cannot borrow value as mutable because it is also borrowed as immutable
10  --> $DIR/borrowck-pat-at-and-box.rs:34:9
11   |
12LL |     let ref a @ box ref mut b = Box::new(nc());
13   |         ^^^^^       --------- value is mutably borrowed by `b` here
14   |         |
15   |         value is borrowed by `a` here
16
17error: cannot borrow value as mutable because it is also borrowed as immutable
18  --> $DIR/borrowck-pat-at-and-box.rs:36:9
19   |
20LL |     let ref a @ box ref mut b = Box::new(NC);
21   |         ^^^^^       --------- value is mutably borrowed by `b` here
22   |         |
23   |         value is borrowed by `a` here
24
25error: cannot borrow value as mutable because it is also borrowed as immutable
26  --> $DIR/borrowck-pat-at-and-box.rs:38:9
27   |
28LL |     let ref a @ box ref mut b = Box::new(NC);
29   |         ^^^^^       --------- value is mutably borrowed by `b` here
30   |         |
31   |         value is borrowed by `a` here
32
33error: cannot borrow value as mutable because it is also borrowed as immutable
34  --> $DIR/borrowck-pat-at-and-box.rs:42:9
35   |
36LL |     let ref a @ box ref mut b = Box::new(NC);
37   |         ^^^^^       --------- value is mutably borrowed by `b` here
38   |         |
39   |         value is borrowed by `a` here
40
41error: cannot borrow value as immutable because it is also borrowed as mutable
42  --> $DIR/borrowck-pat-at-and-box.rs:48:9
43   |
44LL |     let ref mut a @ box ref b = Box::new(NC);
45   |         ^^^^^^^^^       ----- value is borrowed by `b` here
46   |         |
47   |         value is mutably borrowed by `a` here
48
49error: cannot borrow value as immutable because it is also borrowed as mutable
50  --> $DIR/borrowck-pat-at-and-box.rs:62:9
51   |
52LL |         ref mut a @ box ref b => {
53   |         ^^^^^^^^^       ----- value is borrowed by `b` here
54   |         |
55   |         value is mutably borrowed by `a` here
56
57error[E0382]: borrow of moved value
58  --> $DIR/borrowck-pat-at-and-box.rs:31:9
59   |
60LL |     let ref a @ box b = Box::new(NC);
61   |         ^^^^^       - value moved here
62   |         |
63   |         value borrowed here after move
64   |
65   = note: move occurs because value has type `NC`, which does not implement the `Copy` trait
66help: borrow this binding in the pattern to avoid moving the value
67   |
68LL |     let ref a @ box ref b = Box::new(NC);
69   |                     +++
70
71error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
72  --> $DIR/borrowck-pat-at-and-box.rs:38:9
73   |
74LL |     let ref a @ box ref mut b = Box::new(NC);
75   |         ^^^^^       --------- mutable borrow occurs here
76   |         |
77   |         immutable borrow occurs here
78...
79LL |     *b = NC;
80   |     ------- mutable borrow later used here
81
82error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
83  --> $DIR/borrowck-pat-at-and-box.rs:42:9
84   |
85LL |     let ref a @ box ref mut b = Box::new(NC);
86   |         ^^^^^       --------- mutable borrow occurs here
87   |         |
88   |         immutable borrow occurs here
89...
90LL |     *b = NC;
91   |     ------- mutable borrow later used here
92
93error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
94  --> $DIR/borrowck-pat-at-and-box.rs:48:9
95   |
96LL |     let ref mut a @ box ref b = Box::new(NC);
97   |         ^^^^^^^^^       ----- immutable borrow occurs here
98   |         |
99   |         mutable borrow occurs here
100...
101LL |     drop(b);
102   |          - immutable borrow later used here
103
104error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
105  --> $DIR/borrowck-pat-at-and-box.rs:62:9
106   |
107LL |         ref mut a @ box ref b => {
108   |         ^^^^^^^^^       ----- immutable borrow occurs here
109   |         |
110   |         mutable borrow occurs here
111...
112LL |             drop(b);
113   |                  - immutable borrow later used here
114
115error: cannot borrow value as immutable because it is also borrowed as mutable
116  --> $DIR/borrowck-pat-at-and-box.rs:54:11
117   |
118LL |     fn f5(ref mut a @ box ref b: Box<NC>) {
119   |           ^^^^^^^^^       ----- value is borrowed by `b` here
120   |           |
121   |           value is mutably borrowed by `a` here
122
123error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
124  --> $DIR/borrowck-pat-at-and-box.rs:54:11
125   |
126LL |     fn f5(ref mut a @ box ref b: Box<NC>) {
127   |           ^^^^^^^^^       ----- immutable borrow occurs here
128   |           |
129   |           mutable borrow occurs here
130...
131LL |         drop(b);
132   |              - immutable borrow later used here
133
134error: aborting due to 14 previous errors
135
136Some errors have detailed explanations: E0382, E0502.
137For more information about an error, try `rustc --explain E0382`.