-
Notifications
You must be signed in to change notification settings - Fork 13k
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
dyn-star: "needs to be a pointer-sized type" but the type is pointer-sized #107696
Comments
I think I found the code implementing this: rust/compiler/rustc_trait_selection/src/solve/trait_goals.rs Lines 134 to 155 in 3de7d7f
So actually, this trait is about the type having both the size and alignment of a pointer type. That resolves my alignment-related concerns, but means that the doc comment and error message associated with |
Rename `PointerSized` to `PointerLike` The old name was unnecessarily vague. This PR renames a nightly language feature that I added, so I don't think it needs any additional approval, though anyone can feel free to speak up if you dislike the rename. It's still unsatisfying that we don't the user which of {size, alignment} is wrong, but this trait really is just a stepping stone for a more generalized mechanism to create `dyn*`, just meant for nightly testing, so I don't think it really deserves additional diagnostic machinery for now. Fixes rust-lang#107696, cc `@RalfJung` r? `@eholk`
Consider this code:
This raises an error:
However, it is a pointer-sized type. Looks like somehow that's still not good enough?
On a related note, I am surprised that this
PointerSize
marker trait (according to its documentation) cares only about size and not alignment. I think things would go very wrong if we had a type that had ptr size but larger alignment than a ptr, and then turned that into adyn*
...The text was updated successfully, but these errors were encountered: