Skip to content

Conversation

@A4-Tacks
Copy link
Member

@A4-Tacks A4-Tacks commented May 9, 2025

Close #19768

This is very convenient for extending traits such as Iterator


Assist: generate_blanket_trait_impl

Generate blanket trait implementation.

trait $0Foo<T: Send>: ToOwned
where
    Self::Owned: Default,
{
    fn foo(&self) -> T;

    fn print_foo(&self) {
        println!("{}", self.foo());
    }
}

->

trait Foo<T: Send>: ToOwned
where
    Self::Owned: Default,
{
    fn foo(&self) -> T;

    fn print_foo(&self) {
        println!("{}", self.foo());
    }
}

$0impl<T: Send, This: ToOwned> Foo<T> for This
where
    Self::Owned: Default,
{
    fn foo(&self) -> T {
        todo!()
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 9, 2025
@A4-Tacks A4-Tacks force-pushed the gen-blanket-trait-impl branch 3 times, most recently from 9ebc4f2 to 670caf7 Compare May 10, 2025 02:22
@A4-Tacks A4-Tacks changed the title feat: code actions, generate blanket trait impl feat: ide-assist, generate blanket trait impl May 10, 2025
@A4-Tacks A4-Tacks force-pushed the gen-blanket-trait-impl branch from 670caf7 to 3edcb5a Compare May 12, 2025 06:37
@A4-Tacks

This comment was marked as resolved.

@A4-Tacks A4-Tacks force-pushed the gen-blanket-trait-impl branch 3 times, most recently from 1d0a530 to 0ea1a84 Compare May 15, 2025 03:11
@A4-Tacks
Copy link
Member Author

@Veykril May I ask if these PRs can be merged?

@A4-Tacks
Copy link
Member Author

r? @Veykril

@A4-Tacks A4-Tacks changed the title feat: ide-assist, generate blanket trait impl Add ide-assist: generate blanket trait impl Jun 2, 2025
@Veykril Veykril removed their assignment Jun 27, 2025
@A4-Tacks A4-Tacks force-pushed the gen-blanket-trait-impl branch from 01dab07 to 14f3de3 Compare June 28, 2025 08:43
@A4-Tacks A4-Tacks requested a review from ShoyuVanilla June 29, 2025 10:06
@A4-Tacks
Copy link
Member Author

r? @ShoyuVanilla

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 23, 2025
@A4-Tacks A4-Tacks force-pushed the gen-blanket-trait-impl branch from b0cf5ee to fc71616 Compare July 23, 2025 23:34
@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits labels Jul 23, 2025
@ShoyuVanilla
Copy link
Member

ShoyuVanilla commented Jul 25, 2025

I think this overlaps with #19938? Though this adds blanket impls but I think they share lots of codes and we could reduce duplicates

@A4-Tacks
Copy link
Member Author

I think this overlaps with #19938? Though this adds blanket impls but I think they share lots of codes and we could reduce duplicates

I compared the differences between these two and it doesn't seem like there's much shared code

@ShoyuVanilla
Copy link
Member

Okay, I'll look into this more but it might take some time as I have other works for now 😅

@A4-Tacks A4-Tacks force-pushed the gen-blanket-trait-impl branch from 7094a81 to 109da7a Compare July 25, 2025 13:08
@A4-Tacks A4-Tacks force-pushed the gen-blanket-trait-impl branch from 109da7a to 14d3192 Compare August 30, 2025 11:13
@A4-Tacks
Copy link
Member Author

A4-Tacks commented Oct 1, 2025

@ShoyuVanilla Do you have time to review this PR?

@ShoyuVanilla
Copy link
Member

Sorry, not yet (I've been sick these days 😅 ) I'll review this tomorrow.

@A4-Tacks
Copy link
Member Author

A4-Tacks commented Oct 1, 2025

Okay, thank you for taking the time to review

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Oct 7, 2025
Merged via the queue into rust-lang:master with commit bd56dd3 Oct 7, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 7, 2025
@A4-Tacks A4-Tacks deleted the gen-blanket-trait-impl branch October 7, 2025 09:03
@lnicola lnicola changed the title Add ide-assist: generate blanket trait impl feat: add "Generate blanket trait impl" assist Oct 15, 2025
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.

CodeAction: Generate blanket trait implementation

4 participants