Skip to content

Conversation

@Veykril
Copy link
Member

@Veykril Veykril commented Nov 29, 2020

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)

@matklad
Copy link
Contributor

matklad commented Nov 29, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Nov 29, 2020

@bors bors bot merged commit 68910d2 into rust-lang:master Nov 29, 2020
@Veykril Veykril deleted the self-rename branch November 29, 2020 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants