-
Notifications
You must be signed in to change notification settings - Fork 13.3k
autoderef: DerefMut doesn't work with Box #26205
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
Comments
I'd be interested in fixing this if someone can point me in the right direction. |
There's some type-checking code that fixes up auto-deref calls on the receiver after the actual method being called is found. |
// Returns the type and mutability of *ty.
//
// The parameter `explicit` indicates if this is an *explicit* dereference.
// Some types---notably unsafe ptrs---can only be dereferenced explicitly.
pub fn builtin_deref(&self, explicit: bool) -> Option<TypeAndMut<'tcx>> {
match self.sty {
TyBox(ty) => {
Some(TypeAndMut {
ty: ty,
mutbl: ast::MutImmutable,
})
},
TyRef(_, mt) => Some(mt),
TyRawPtr(mt) if explicit => Some(mt),
_ => None
}
} I assume that |
@apasel422 ah, yes, indeed, that would make most code treat it as |
@eddyb Thanks for the help, but if you have a better idea how to address this, go ahead. I'm not entirely sure how to approach this. |
Selected log output from compiling the original snippet:
|
@apasel422 What I'm saying is, more or less, to pass that |
@eddyb But based on the logs, it seems like it eventually does use |
All right, I think I understand what needs to be done now. PR incoming. |
STR
Version
cc @nikomatsakis @eddyb
The text was updated successfully, but these errors were encountered: