]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/get_default.nll.stderr
Update upstream source from tag 'upstream/1.31.0_beta.4+dfsg1'
[rustc.git] / src / test / ui / nll / get_default.nll.stderr
CommitLineData
83c7162d
XL
1error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
2 --> $DIR/get_default.rs:33:17
3 |
4LL | match map.get() {
5 | --- immutable borrow occurs here
6...
94b46f34 7LL | map.set(String::new()); // Ideally, this would not error.
83c7162d
XL
8 | ^^^ mutable borrow occurs here
9...
10LL | }
11 | - immutable borrow ends here
12
13error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
94b46f34 14 --> $DIR/get_default.rs:45:17
83c7162d
XL
15 |
16LL | match map.get() {
17 | --- immutable borrow occurs here
18LL | Some(v) => {
19LL | map.set(String::new()); // Both AST and MIR error here
20 | ^^^ mutable borrow occurs here
21...
22LL | }
23 | - immutable borrow ends here
24
25error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Ast)
94b46f34 26 --> $DIR/get_default.rs:51:17
83c7162d
XL
27 |
28LL | match map.get() {
29 | --- immutable borrow occurs here
30...
94b46f34 31LL | map.set(String::new()); // Ideally, just AST would error here
83c7162d
XL
32 | ^^^ mutable borrow occurs here
33...
34LL | }
35 | - immutable borrow ends here
36
37error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
94b46f34
XL
38 --> $DIR/get_default.rs:33:17
39 |
0bf4aa26
XL
40LL | fn ok(map: &mut Map) -> &String {
41 | - let's call the lifetime of this reference `'1`
42LL | loop {
94b46f34
XL
43LL | match map.get() {
44 | --- immutable borrow occurs here
0bf4aa26
XL
45LL | Some(v) => {
46LL | return v;
47 | - returning this value requires that `*map` is borrowed for `'1`
94b46f34
XL
48...
49LL | map.set(String::new()); // Ideally, this would not error.
50 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
94b46f34
XL
51
52error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
53 --> $DIR/get_default.rs:45:17
83c7162d 54 |
0bf4aa26
XL
55LL | fn err(map: &mut Map) -> &String {
56 | - let's call the lifetime of this reference `'1`
57LL | loop {
83c7162d
XL
58LL | match map.get() {
59 | --- immutable borrow occurs here
60LL | Some(v) => {
61LL | map.set(String::new()); // Both AST and MIR error here
62 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
0bf4aa26
XL
63...
64LL | return v;
65 | - returning this value requires that `*map` is borrowed for `'1`
83c7162d 66
94b46f34
XL
67error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
68 --> $DIR/get_default.rs:51:17
69 |
0bf4aa26
XL
70LL | fn err(map: &mut Map) -> &String {
71 | - let's call the lifetime of this reference `'1`
72LL | loop {
94b46f34
XL
73LL | match map.get() {
74 | --- immutable borrow occurs here
75...
0bf4aa26
XL
76LL | return v;
77 | - returning this value requires that `*map` is borrowed for `'1`
78...
94b46f34
XL
79LL | map.set(String::new()); // Ideally, just AST would error here
80 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
94b46f34
XL
81
82error: aborting due to 6 previous errors
83c7162d
XL
83
84For more information about this error, try `rustc --explain E0502`.