We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
unconst
unsafe
1 parent 67d5916 commit 5dd1390Copy full SHA for 5dd1390
const_safety.md
@@ -114,13 +114,13 @@ some extensions of the miri engine that are already implemented in miri) even
114
though it uses raw pointer operations:
115
```rust
116
const fn test_eq<T>(x: &T, y: &T) -> bool {
117
- unsafe { x as *const _ == y as *const _ }
+ unconst { x as *const _ == y as *const _ }
118
}
119
```
120
On the other hand, the following function is *not* const-safe and hence it is considered a bug to mark it as such:
121
122
const fn convert<T>(x: &T) -> usize {
123
- unsafe { x as *const _ as usize }
+ unconst { x as *const _ as usize }
124
125
126
0 commit comments