@@ -6,8 +6,16 @@ LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowe
6
6
|
7
7
= help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable
8
8
9
+ error[E0658]: dereferencing raw pointers in constant functions is unstable (see issue #51911)
10
+ --> $DIR/min_const_fn_unsafe_feature_gate.rs:50:60
11
+ |
12
+ LL | const unsafe fn foo30_4(x: *mut usize) -> &'static usize { &*x } //~ ERROR not allowed in const fn
13
+ | ^^^
14
+ |
15
+ = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable
16
+
9
17
error[E0658]: unions in const fn are unstable (see issue #51909)
10
- --> $DIR/min_const_fn_unsafe_feature_gate.rs:54 :5
18
+ --> $DIR/min_const_fn_unsafe_feature_gate.rs:57 :5
11
19
|
12
20
LL | Foo { x: () }.y //~ ERROR not allowed in const fn
13
21
| ^^^^^^^^^^^^^^^
@@ -46,14 +54,22 @@ LL | const unsafe fn foo30_3(x: *mut usize) -> usize { *x } //~ ERROR not allowe
46
54
|
47
55
= 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
56
57
+ error: dereference of raw pointer is unsafe and unsafe operations are not allowed in const fn
58
+ --> $DIR/min_const_fn_unsafe_feature_gate.rs:50:60
59
+ |
60
+ LL | const unsafe fn foo30_4(x: *mut usize) -> &'static usize { &*x } //~ ERROR not allowed in const fn
61
+ | ^^^ dereference of raw pointer
62
+ |
63
+ = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
64
+
49
65
error: access to union field is unsafe and unsafe operations are not allowed in const fn
50
- --> $DIR/min_const_fn_unsafe_feature_gate.rs:54 :5
66
+ --> $DIR/min_const_fn_unsafe_feature_gate.rs:57 :5
51
67
|
52
68
LL | Foo { x: () }.y //~ ERROR not allowed in const fn
53
69
| ^^^^^^^^^^^^^^^ access to union field
54
70
|
55
71
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
56
72
57
- error: aborting due to 7 previous errors
73
+ error: aborting due to 9 previous errors
58
74
59
75
For more information about this error, try `rustc --explain E0658`.
0 commit comments