diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-11-29 19:07:04 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-11-29 19:07:04 +0000 |
commit | 68910d2f341ddd7635265c3847712cc7e44ef75e (patch) | |
tree | ffc3bbff43cb941700faca0e2b6d645eab36fdc4 /crates/hir_def | |
parent | 65a789368a55416099a8b9d866abb5142273984e (diff) | |
parent | 4c33ae33e96a0087f9f8451fc100b8681237d05f (diff) |
Merge #6670
6670: Allow renaming between self and first param with owned parameters r=matklad a=Veykril
This fixes renaming owned SelfParams turning the parameter into a reference, as in, for a type `Foo`, `fn foo(self) {}` became `fn foo(renamed_name: &Foo) {}` prior to this.
Similarly for the other way around, we now support renaming non-ref parameters to `self`. Additionally we do more checks now than before. We check:
- that the function has an impl block
- that we are renaming the first parameter(prior we ignored which parameter was renamed and always picked the first nevertheless)
- that the parameter's type aligns with the impl block(minus one level of reference abstraction to account for `&self`/`&mut self`)
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_def')
0 files changed, 0 insertions, 0 deletions