diff options
| author | bors <bors@rust-lang.org> | 2021-03-13 04:38:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-03-13 04:38:39 +0000 |
| commit | f42888c15fd370b8bca4c5646ffc3aac3005dca8 (patch) | |
| tree | 43f3e97274456f17822ff17e080b0a4263224005 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 4d76b4ca52a65d63ab83d82d6630f1df8ec05a93 (diff) | |
| parent | 98fbc09f029846bc1f51865d47f0d2968e257256 (diff) | |
| download | rust-f42888c15fd370b8bca4c5646ffc3aac3005dca8.tar.gz rust-f42888c15fd370b8bca4c5646ffc3aac3005dca8.zip | |
Auto merge of #82436 - osa1:issue80258, r=nikomatsakis
Allow calling *const methods on *mut values This allows `*const` methods to be called on `*mut` values. TODOs: - [x] ~~Remove debug logs~~ Done. - [x] ~~I haven't tested, but I think this currently won't work when the `self` value has type like `&&&&& *mut X` because I don't do any autoderefs when probing. To fix this the new code in `rustc_typeck::check::method::probe` needs to reuse `pick_method` somehow as I think that's the function that autoderefs.~~ This works, because autoderefs are done before calling `pick_core`, in `method_autoderef_steps`, called by `probe_op`. - [x] ~~I should probably move the new `Pick` to `pick_autorefd_method`. If not, I should move it to its own function.~~ Done. - [ ] ~~Test this with a `Pick` with `to_ptr = true` and `unsize = true`.~~ I think this case cannot happen, because we don't have any array methods with `*mut [X]` receiver. I should confirm that this is true and document this. I've placed two assertions about this. - [x] ~~Maybe give `(Mutability, bool)` a name and fields~~ I now have a `to_const_ptr` field in `Pick`. - [x] ~~Changes in `adjust_self_ty` is quite hacky. The problem is we can't deref a pointer, and even if we don't have an adjustment to get the address of a value, so to go from `*mut` to `*const` we need a special case.~~ There's still a special case for `to_const_ptr`, but I'm not sure if we can avoid this. - [ ] Figure out how `reached_raw_pointer` stuff is used. I suspect only for error messages. Fixes #80258
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
