Skip to content

Convert to manual impl ... loses bounds #19878

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

Open
A4-Tacks opened this issue May 28, 2025 · 0 comments
Open

Convert to manual impl ... loses bounds #19878

A4-Tacks opened this issue May 28, 2025 · 0 comments
Labels
A-assists C-bug Category: bug

Comments

@A4-Tacks
Copy link
Contributor

rust-analyzer version: rust-analyzer 1.88.0-nightly (a15cce2 2025-04-17)

rustc version: rustc 1.88.0-nightly (a15cce269 2025-04-17)

editor or extension: VIM-9.1

code snippet to reproduce:

#[derive(Default)]
struct OptionOwned<T: ToOwned> {
    owned: Option<T::Owned>,
}

Use Convert to manual `impl Default for OptionOwned` on Default:

impl<T: ToOwned + Default> Default for OptionOwned<T> {
    fn default() -> Self {
        Self { owned: Default::default() }
    }
}

Use rust-analyzer.expandMacro on Default:

impl<T: core::default::Default> core::default::Default for OptionOwned<T>
where
    T: ToOwned,
    T::Owned: core::default::Default,
{
    fn default() -> Self {
        OptionOwned {
            owned: core::default::Default::default(),
        }
    }
}
@A4-Tacks A4-Tacks added the C-bug Category: bug label May 28, 2025
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

No branches or pull requests

2 participants