]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
[rust.git] / src / test / ui / consts / const-mut-refs / mut_ref_in_final.stderr
1 error[E0764]: mutable references are not allowed in the final value of constants
2   --> $DIR/mut_ref_in_final.rs:11:21
3    |
4 LL | const B: *mut i32 = &mut 4;
5    |                     ^^^^^^
6
7 error[E0716]: temporary value dropped while borrowed
8   --> $DIR/mut_ref_in_final.rs:17:40
9    |
10 LL | 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 which is freed while still in use
15    |                              using this value as a constant requires that borrow lasts for `'static`
16
17 error[E0716]: temporary value dropped while borrowed
18   --> $DIR/mut_ref_in_final.rs:20:42
19    |
20 LL | 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 which is freed while still in use
25    |                              using this value as a constant requires that borrow lasts for `'static`
26
27 error[E0716]: temporary value dropped while borrowed
28   --> $DIR/mut_ref_in_final.rs:35:65
29    |
30 LL | 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 which is freed while still in use
35    |                                  using this value as a constant requires that borrow lasts for `'static`
36
37 error[E0716]: temporary value dropped while borrowed
38   --> $DIR/mut_ref_in_final.rs:38:67
39    |
40 LL | 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 which is freed while still in use
45    |                                    using this value as a static requires that borrow lasts for `'static`
46
47 error[E0716]: temporary value dropped while borrowed
48   --> $DIR/mut_ref_in_final.rs:41:71
49    |
50 LL | 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 which is freed while still in use
55    |                                        using this value as a static requires that borrow lasts for `'static`
56
57 error: aborting due to 6 previous errors
58
59 Some errors have detailed explanations: E0716, E0764.
60 For more information about an error, try `rustc --explain E0716`.