]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/get_default.nll.stderr
New upstream version 1.30.0+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 |
40LL | match map.get() {
41 | --- immutable borrow occurs here
42...
43LL | map.set(String::new()); // Ideally, this would not error.
44 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
45 |
46note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 26:1...
47 --> $DIR/get_default.rs:26:1
48 |
49LL | / fn ok(map: &mut Map) -> &String {
50LL | | loop {
51LL | | match map.get() {
52LL | | Some(v) => {
53... |
54LL | | }
55LL | | }
56 | |_^
57
58error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
59 --> $DIR/get_default.rs:45:17
83c7162d
XL
60 |
61LL | match map.get() {
62 | --- immutable borrow occurs here
63LL | Some(v) => {
64LL | map.set(String::new()); // Both AST and MIR error here
65 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
b7449926
XL
66 |
67note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 41:1...
68 --> $DIR/get_default.rs:41:1
69 |
70LL | / fn err(map: &mut Map) -> &String {
71LL | | loop {
72LL | | match map.get() {
73LL | | Some(v) => {
74... |
75LL | | }
76LL | | }
77 | |_^
83c7162d 78
94b46f34
XL
79error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
80 --> $DIR/get_default.rs:51:17
81 |
82LL | match map.get() {
83 | --- immutable borrow occurs here
84...
85LL | map.set(String::new()); // Ideally, just AST would error here
86 | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
87 |
88note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 41:1...
89 --> $DIR/get_default.rs:41:1
90 |
91LL | / fn err(map: &mut Map) -> &String {
92LL | | loop {
93LL | | match map.get() {
94LL | | Some(v) => {
95... |
96LL | | }
97LL | | }
98 | |_^
99
100error: aborting due to 6 previous errors
83c7162d
XL
101
102For more information about this error, try `rustc --explain E0502`.