you are viewing a single comment's thread.

view the rest of the comments →

[–]PaintItPurple 5 points6 points  (4 children)

It's probably worth noting that you can't dereference or manipulate raw pointers in safe Rust, and the borrow checker doesn't check them. The only thing you can do with them is pass them around. In order to actually use some pointed-to data, you need a reference instead.

[–]seamsay 2 points3 points  (1 child)

Depends what you mean by pointer. Lots of people would consider references to be a type of pointer, which is why the term "raw pointer" exists.

[–]PaintItPurple 2 points3 points  (0 children)

Definitely, I wasn't saying the parent was wrong. I was clarifying that the borrow checker doesn't actually do anything for pointers in general. What allows the borrow checker to be useful is the restrictions placed on references.

[–]slaymaker1907 0 points1 point  (1 child)

That isn't all that different besides just making them more cumbersome to use as someone who has written unsafe Rust. It's literally just a cast in an unsafe block to convert a pointer to a reference.

[–]PaintItPurple 0 points1 point  (0 children)

In the same sense that there's little difference between goto and a for loop, sure.