Skip to content

Stop implementing methods on SImpl - #696

Open
lucic71 wants to merge 5 commits into
Cpp2Rust:masterfrom
lucic71:ptr-receiver-ref
Open

lucic71 wants to merge 5 commits into
Cpp2Rust:masterfrom
lucic71:ptr-receiver-ref

Conversation

@lucic71

@lucic71 lucic71 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Before:

pub trait SImpl {
    fn m(&self) {
        unimplemented!()
    }
}

impl SImpl for Ptr<Self> {
  fn m(&self) { ... }

After:

impl S {
  fn m(this: Ptr<Self>) { ... }
}

Taking a &Ptr<Self> as the receiver was wrong because it aliased with the arguments of the function, so I moved to Ptr<Self>. This also has the nice side-effect that we can write only impl S instead of trait SImpl + impl Simpl for Ptr<Self>.

@lucic71
lucic71 marked this pull request as draft December 3, 2026 11:24
@lucic71
lucic71 marked this pull request as ready for review December 3, 2026 11:37
@lucic71

lucic71 commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

Did the same for unsafe

This branch has not been deployed

No deployments
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.

1 participant