Skip to content

Conversation

A4-Tacks
Copy link
Contributor

Example

struct Foo<T>($0T);

Current output:

struct Foo<T>(T);

impl<T: std::ops::Deref> std::ops::Deref for Foo<T> {
    type Target = T;

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

This PR fixed output:

struct Foo<T>(T);

impl<T> std::ops::Deref for Foo<T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        &self.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 A4-Tacks changed the title Fix ide-assist: Deref transtive Fix ide-assist: generate Deref transitive Jul 19, 2025
@@ -567,6 +567,7 @@ pub(crate) fn generate_impl_text(adt: &ast::Adt, code: &str) -> String {
///
/// This is useful for traits like `PartialEq`, since `impl<T> PartialEq for U<T>` often requires `T: PartialEq`.
// FIXME: migrate remaining uses to `generate_trait_impl`
#[allow(dead_code)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to keep the old function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will deleting this function affect other PRs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, but ok.

@lnicola lnicola added this pull request to the merge queue Jul 20, 2025
Merged via the queue into rust-lang:master with commit 58e507d Jul 20, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 20, 2025
@A4-Tacks A4-Tacks deleted the deref-intranstive branch July 23, 2025 23:42
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