summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/let_underscore_temporary.stderr
blob: 6bccf329181f0aa0b3980e65b8671afd2167a1f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
error[E0716]: temporary value dropped while borrowed
  --> $DIR/let_underscore_temporary.rs:10:14
   |
LL |       let _ = if let Some(s) = &mut num {
   |  _____________-
LL | |         *s += 1;
LL | |         s
LL | |     } else {
LL | |         &mut 0
   | |              ^ creates a temporary value which is freed while still in use
LL | |
LL | |     };
   | |     -
   | |     |
   | |_____temporary value is freed at the end of this statement
   |       borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
  --> $DIR/let_underscore_temporary.rs:24:14
   |
LL |       let _ = if let Some(ref mut s) = num {
   |  _____________-
LL | |         *s += 1;
LL | |         s
LL | |     } else {
LL | |         &mut 0
   | |              ^ creates a temporary value which is freed while still in use
LL | |
LL | |     };
   | |     -
   | |     |
   | |_____temporary value is freed at the end of this statement
   |       borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
  --> $DIR/let_underscore_temporary.rs:36:14
   |
LL |       let _: _ = if let Some(s) = &mut num {
   |  ________________-
LL | |         *s += 1;
LL | |         s
LL | |     } else {
LL | |         &mut 0
   | |              ^ creates a temporary value which is freed while still in use
LL | |
LL | |     };
   | |     -
   | |     |
   | |_____temporary value is freed at the end of this statement
   |       borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
  --> $DIR/let_underscore_temporary.rs:50:14
   |
LL |       let _: _ = if let Some(ref mut s) = num {
   |  ________________-
LL | |         *s += 1;
LL | |         s
LL | |     } else {
LL | |         &mut 0
   | |              ^ creates a temporary value which is freed while still in use
LL | |
LL | |     };
   | |     -
   | |     |
   | |_____temporary value is freed at the end of this statement
   |       borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
  --> $DIR/let_underscore_temporary.rs:66:14
   |
LL |       match if let Some(s) = &mut num {
   |  ___________-
LL | |         *s += 1;
LL | |         s
LL | |     } else {
LL | |         &mut 0
   | |              ^ creates a temporary value which is freed while still in use
LL | |
LL | |     } {
   | |     -
   | |     |
   | |_____temporary value is freed at the end of this statement
   |       borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value

error[E0716]: temporary value dropped while borrowed
  --> $DIR/let_underscore_temporary.rs:86:14
   |
LL |       match if let Some(ref mut s) = num {
   |  ___________-
LL | |         *s += 1;
LL | |         s
LL | |     } else {
LL | |         &mut 0
   | |              ^ creates a temporary value which is freed while still in use
LL | |
LL | |     } {
   | |     -
   | |     |
   | |_____temporary value is freed at the end of this statement
   |       borrow later used here
   |
   = note: consider using a `let` binding to create a longer lived value

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0716`.