fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.5 KiB60 linesraw
1error[E0764]: mutable references are not allowed in the final value of constants
2  --> $DIR/mut_ref_in_final.rs:10:21
3   |
4LL | const B: *mut i32 = &mut 4;
5   |                     ^^^^^^
6
7error[E0716]: temporary value dropped while borrowed
8  --> $DIR/mut_ref_in_final.rs:16:40
9   |
10LL | const B3: Option<&mut i32> = Some(&mut 42);
11   |                              ----------^^-
12   |                              |         | |
13   |                              |         | temporary value is freed at the end of this statement
14   |                              |         creates a temporary value which is freed while still in use
15   |                              using this value as a constant requires that borrow lasts for `'static`
16
17error[E0716]: temporary value dropped while borrowed
18  --> $DIR/mut_ref_in_final.rs:19:42
19   |
20LL | const B4: Option<&mut i32> = helper(&mut 42);
21   |                              ------------^^-
22   |                              |           | |
23   |                              |           | temporary value is freed at the end of this statement
24   |                              |           creates a temporary value which is freed while still in use
25   |                              using this value as a constant requires that borrow lasts for `'static`
26
27error[E0716]: temporary value dropped while borrowed
28  --> $DIR/mut_ref_in_final.rs:34:65
29   |
30LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
31   |                                  -------------------------------^^--
32   |                                  |                              |  |
33   |                                  |                              |  temporary value is freed at the end of this statement
34   |                                  |                              creates a temporary value which is freed while still in use
35   |                                  using this value as a constant requires that borrow lasts for `'static`
36
37error[E0716]: temporary value dropped while borrowed
38  --> $DIR/mut_ref_in_final.rs:37:67
39   |
40LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
41   |                                    -------------------------------^^--
42   |                                    |                              |  |
43   |                                    |                              |  temporary value is freed at the end of this statement
44   |                                    |                              creates a temporary value which is freed while still in use
45   |                                    using this value as a static requires that borrow lasts for `'static`
46
47error[E0716]: temporary value dropped while borrowed
48  --> $DIR/mut_ref_in_final.rs:40:71
49   |
50LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
51   |                                        -------------------------------^^--
52   |                                        |                              |  |
53   |                                        |                              |  temporary value is freed at the end of this statement
54   |                                        |                              creates a temporary value which is freed while still in use
55   |                                        using this value as a static requires that borrow lasts for `'static`
56
57error: aborting due to 6 previous errors
58
59Some errors have detailed explanations: E0716, E0764.
60For more information about an error, try `rustc --explain E0716`.