fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
2.0 KiB59 linesraw
1error[E0716]: temporary value dropped while borrowed
2  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:5:21
3   |
4LL |     let ref mut x = 1234543;
5   |                     ^^^^^^^ creates a temporary which is freed while still in use
6LL |     x
7   |     - borrow later used here
8LL | }
9   | - temporary value is freed at the end of this statement
10   |
11   = note: consider using a `let` binding to create a longer lived value
12
13error[E0716]: temporary value dropped while borrowed
14  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:10:25
15   |
16LL |     let (ref mut x, ) = (1234543, );
17   |                         ^^^^^^^^^^^ creates a temporary which is freed while still in use
18LL |     x
19   |     - borrow later used here
20LL | }
21   | - temporary value is freed at the end of this statement
22   |
23   = note: consider using a `let` binding to create a longer lived value
24
25error[E0515]: cannot return value referencing temporary value
26  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:5
27   |
28LL |       match 1234543 {
29   |       ^     ------- temporary value created here
30   |  _____|
31   | |
32LL | |         ref mut x => x
33LL | |     }
34   | |_____^ returns a value referencing data owned by the current function
35
36error[E0515]: cannot return value referencing temporary value
37  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:21:5
38   |
39LL |       match (123443,) {
40   |       ^     --------- temporary value created here
41   |  _____|
42   | |
43LL | |         (ref mut x,) => x,
44LL | |     }
45   | |_____^ returns a value referencing data owned by the current function
46
47error[E0515]: cannot return reference to temporary value
48  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5
49   |
50LL |     &mut 1234543
51   |     ^^^^^-------
52   |     |    |
53   |     |    temporary value created here
54   |     returns a reference to data owned by the current function
55
56error: aborting due to 5 previous errors
57
58Some errors have detailed explanations: E0515, E0716.
59For more information about an error, try `rustc --explain E0515`.