-
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
Cleanup: Place::is_indirect vs Place::has_deref #114401
Comments
I think this is documented in rust/compiler/rustc_middle/src/mir/mod.rs Lines 1595 to 1603 in 474709a
Though why we have that assertion in only one place and not all the others, I have no idea. |
I tried pasting this check into |
That doc comment doesn't really tell a user much, does it? It should start by describing what the function does, which is the same as One of the two should probably be renamed, there's no good reason for them to have so different names when they implement almost the same spec. The current comment is an implementation comment that could go inside the function, but not suitable as a doc comment. |
Also the methods on |
Uh, but doesn't that run sufficiently late that it should be allowed to use |
Yes. At a guess, there is MIR which is temporarily invalid during a pass. |
Wow. That makes |
Add documentation to has_deref Documentation of `has_deref` needed some polish to be more clear about where it should be used and what's it's purpose. cc rust-lang#114401 r? `@RalfJung`
Add documentation to has_deref Documentation of `has_deref` needed some polish to be more clear about where it should be used and what's it's purpose. cc rust-lang/rust#114401 r? `@RalfJung`
Maybe we can close this since #114505 is merged now. |
Since #97077 we have these two methods
is_indirect
andhas_deref
that are documented as doing the exact same thing, but don't even mention each other in the documentation. Calling the wrong one can either lead to slow code or to subtle bugs. That's pretty bad, we should find a way to clean this up -- and at the very least, this needs better documentation.The text was updated successfully, but these errors were encountered: