fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
1.7 KiB50 linesraw
1error[E0515]: cannot return value referencing temporary value
2  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:6:5
3   |
4LL |     let ref mut x = 1234543;
5   |                     ------- temporary value created here
6LL |     x
7   |     ^ returns a value referencing data owned by the current function
8
9error[E0515]: cannot return value referencing temporary value
10  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:11:5
11   |
12LL |     let (ref mut x, ) = (1234543, );
13   |                         ----------- temporary value created here
14LL |     x
15   |     ^ returns a value referencing data owned by the current function
16
17error[E0515]: cannot return value referencing temporary value
18  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:5
19   |
20LL |       match 1234543 {
21   |       ^     ------- temporary value created here
22   |  _____|
23   | |
24LL | |         ref mut x => x
25LL | |     }
26   | |_____^ returns a value referencing data owned by the current function
27
28error[E0515]: cannot return value referencing temporary value
29  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:21:5
30   |
31LL |       match (123443,) {
32   |       ^     --------- temporary value created here
33   |  _____|
34   | |
35LL | |         (ref mut x,) => x,
36LL | |     }
37   | |_____^ returns a value referencing data owned by the current function
38
39error[E0515]: cannot return reference to temporary value
40  --> $DIR/promote-ref-mut-in-let-issue-46557.rs:27:5
41   |
42LL |     &mut 1234543
43   |     ^^^^^-------
44   |     |    |
45   |     |    temporary value created here
46   |     returns a reference to data owned by the current function
47
48error: aborting due to 5 previous errors
49
50For more information about this error, try `rustc --explain E0515`.