]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/min_const_fn/min_const_fn_unsafe.stderr
17cba8569c148f8d7cd9bfeedd288c951924fa42
[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:29:51
3    |
4 LL | const unsafe fn foo30_3(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:36: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: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
18   --> $DIR/min_const_fn_unsafe.rs:21:14
19    |
20 LL |     unsafe { foo4() } //~ ERROR unsafe operations are not allowed in const fn
21    |              ^^^^^^ call to unsafe function
22    |
23    = note: consult the function's documentation for information on how to avoid undefined behavior
24
25 error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
26   --> $DIR/min_const_fn_unsafe.rs:24:14
27    |
28 LL |     unsafe { foo5::<String>() } //~ ERROR unsafe operations are not allowed in const fn
29    |              ^^^^^^^^^^^^^^^^ call to unsafe function
30    |
31    = note: consult the function's documentation for information on how to avoid undefined behavior
32
33 error: call to unsafe function is unsafe and unsafe operations are not allowed in const fn
34   --> $DIR/min_const_fn_unsafe.rs:27:14
35    |
36 LL |     unsafe { foo6::<Vec<std::cell::Cell<u32>>>() } //~ ERROR not allowed in const fn
37    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
38    |
39    = note: consult the function's documentation for information on how to avoid undefined behavior
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:29:51
43    |
44 LL | const unsafe fn foo30_3(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:36: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`.