Skip to content

Commit 79b6ba1

Browse files
authored
Casting from a pointer should have type 'isize', not 'i32'.
Found via rust-lang/rust#43641.
1 parent f872771 commit 79b6ba1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

second-edition/src/ch19-01-unsafe-rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ There’s not usually a good reason to be writing code like this, but it is
100100
possible:
101101

102102
```rust
103-
let address = 0x012345;
103+
let address = 0x012345isize;
104104
let r = address as *const i32;
105105
```
106106

@@ -305,7 +305,7 @@ location and creates a slice ten thousand items long:
305305
```rust
306306
use std::slice;
307307

308-
let address = 0x012345;
308+
let address = 0x012345isize;
309309
let r = address as *mut i32;
310310

311311
let slice = unsafe {

0 commit comments

Comments
 (0)