-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
document what "thin pointers" are #41300
Comments
/cc @rust-lang/lang ; I wonder what the official terminology here should be. I prefer the "single pointer"/"double pointer" language to the "thin pointer"/"fat pointer" stuff, but it seems to me that this diagnostic could use re-worked and possibly made even more clear. Thoughts? also, re-tagging as compiler since I believe this is more of a diagnostic issue than a docs issue. |
That's not really accurate though, is it? Slices are (pointer, len), not two pointers. There's also the possibility of custom DSTs which would permit fat pointers larger than two words. |
I agree with rkruppe that 'double pointer' could be misleading, but think our language would be slightly more welcoming if we used 'wide pointer' in error messages instead of 'fat'. |
When I've heard it, it was referring to "double the size", not "two pointers" though that confusion is certainly a good reason to not have it. 👍 for "pointer"/"wide pointer" |
Would "non-wide pointer" make sense then? |
Yea, I think in most cases "thin pointer" can probably just be "pointer," this error message (trying to cast wide pointer down) seems like the only one where its helpful to explicit mentioning the non-wideness of the pointer, based on a ripgrep. "non-wide" or even just "regular" seems fine when you need to highlight the distinction of most pointers from wide pointers. |
In light of the custom DST proposal, I've come to think of all pointers as "wide pointers", it's sort of just a question of what their auxiliary data is ("thin" pointers would have metadata of type |
I just ran into this issue and had no idea what was going on, so it would be great if this could be fixed. (For anyone else confused about this thin pointer help message, you can fix it by adding an intermediate cast to some primitive pointer type like *const usize) |
I just ran across this issue after encountering the mentioned error message. I was thoroughly confused, and while the solution of casting to |
In light of RFC 2580, perhaps this could be something like
In non-generic cases, "non-zero sized metadata" could be replaced with something more specific. Post-stabilization, the hints could be updated to match the trait.
|
I got the following error message:
which was quite clear, except that there seems to be no documentation as to what a "thin" pointer is. I ended up through guesswork casting to a *const usize in between which made this work for me.
The text was updated successfully, but these errors were encountered: