]> git.lizzy.rs Git - rust.git/commitdiff
Merge #6670
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Sun, 29 Nov 2020 19:07:04 +0000 (19:07 +0000)
committerGitHub <noreply@github.com>
Sun, 29 Nov 2020 19:07:04 +0000 (19:07 +0000)
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 <lukastw97@gmail.com>

Trivial merge