Skip to content
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

Delegate method assist doesn't fix up Self references #14485

Closed
Veykril opened this issue Apr 4, 2023 · 0 comments · Fixed by #15705
Closed

Delegate method assist doesn't fix up Self references #14485

Veykril opened this issue Apr 4, 2023 · 0 comments · Fixed by #15705
Labels
A-assists C-bug Category: bug

Comments

@Veykril
Copy link
Member

Veykril commented Apr 4, 2023

struct Struct {
    field$0: u8,
}

produces

impl Struct {
    pub fn saturating_mul(self,rhs:Self) ->Self {
        self.field.saturating_mul(rhs)
    }
}

when it should produce

impl Struct {
    pub fn saturating_mul(self,rhs:u8) ->u8{
        self.field.saturating_mul(rhs)
    }
}
@Veykril Veykril added A-assists C-bug Category: bug labels Apr 4, 2023
bors added a commit that referenced this issue Dec 8, 2023
…=Veykril

fix: resolve Self type references in delegate method assist

This PR makes the delegate method assist resolve any `Self` type references in the parameters or return type. It also works across macros such as the `uint_impl!` macro used for `saturating_mul` in the issue example.

Closes #14485
@bors bors closed this as completed in 6bbb2ac Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant