Skip to content

Conversation

A4-Tacks
Copy link
Contributor

@A4-Tacks A4-Tacks commented Jul 19, 2025

Assist in writing custom DerefMut implement

Examples

//- minicore: deref
struct Foo([i32; 16]);

impl core::ops::Deref$0 for Foo {
    type Target = i32;

    fn deref(&self) -> &Self::Target {
        &self.0[0]
    }
}

->

struct Foo([i32; 16]);

$0impl core::ops::DerefMut for Foo {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0[0]
    }
}

impl core::ops::Deref for Foo {
    type Target = i32;

    fn deref(&self) -> &Self::Target {
        &self.0[0]
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 19, 2025
@A4-Tacks
Copy link
Contributor Author

r? @ShoyuVanilla

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Jul 21, 2025
Merged via the queue into rust-lang:master with commit 28ac05d Jul 21, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 21, 2025
@A4-Tacks A4-Tacks deleted the gen-mut-trait-deref branch July 23, 2025 13:46
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.

3 participants