]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr
8d885545cde563913b0ada2222a6e0a3dc617a09
[rust.git] / src / test / ui / consts / min_const_fn / min_const_fn_unsafe.stderr
1 error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)
2   --> $DIR/min_const_fn_unsafe.rs:31:59
3    |
4 LL | const unsafe fn deref_forbidden(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn
5    |                                                           ^^
6    |
7    = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable
8
9 error[E0658]: unions in const fn are unstable (see issue #51909)
10   --> $DIR/min_const_fn_unsafe.rs:38:5
11    |
12 LL |     Foo { x: () }.y //~ ERROR not allowed in const fn
13    |     ^^^^^^^^^^^^^^^
14    |
15    = help: add #![feature(const_fn_union)] to the crate attributes to enable
16
17 error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607)
18   --> $DIR/min_const_fn_unsafe.rs:21:14
19    |
20 LL |     unsafe { ret_i32_no_unsafe() } //~ ERROR calls to `const unsafe fn` in const fns are unstable
21    |              ^^^^^^^^^^^^^^^^^^^
22    |
23    = help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable
24
25 error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607)
26   --> $DIR/min_const_fn_unsafe.rs:24:14
27    |
28 LL |     unsafe { ret_null_ptr_no_unsafe::<String>() }
29    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30    |
31    = help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable
32
33 error[E0658]: calls to `const unsafe fn` in const fns are unstable (see issue #55607)
34   --> $DIR/min_const_fn_unsafe.rs:28:14
35    |
36 LL |     unsafe { ret_null_mut_ptr_no_unsafe::<Vec<std::cell::Cell<u32>>>() }
37    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38    |
39    = help: add #![feature(min_const_unsafe_fn)] to the crate attributes to enable
40
41 error: dereference of raw pointer is unsafe and unsafe operations are not allowed in const fn
42   --> $DIR/min_const_fn_unsafe.rs:31:59
43    |
44 LL | const unsafe fn deref_forbidden(x: *mut usize) -> usize { *x } //~ ERROR not allowed in const fn
45    |                                                           ^^ dereference of raw pointer
46    |
47    = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
48
49 error: access to union field is unsafe and unsafe operations are not allowed in const fn
50   --> $DIR/min_const_fn_unsafe.rs:38:5
51    |
52 LL |     Foo { x: () }.y //~ ERROR not allowed in const fn
53    |     ^^^^^^^^^^^^^^^ access to union field
54    |
55    = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
56
57 error: aborting due to 7 previous errors
58
59 For more information about this error, try `rustc --explain E0658`.