Skip to content

"Implement missing members" helper doesn't parenthesise compound traits behind references #10326

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
Tamschi opened this issue Sep 24, 2021 · 0 comments
Labels
A-assists C-bug Category: bug S-actionable Someone could pick this issue up and work on it right now

Comments

@Tamschi
Copy link

Tamschi commented Sep 24, 2021

Given

trait A<T: ?Sized> {
    fn a(&self) -> &T;
}
trait B {}

impl<'a, T: B> A<dyn 'a + B> for T {} // <-- not all trait items implemented, missing: `a` …

, using the "Implement missing members" command leads to the following code:

trait A<T: ?Sized> {
    fn a(&self) -> &T;
}
trait B {}

impl<'a, T: B> A<dyn 'a + B> for T {
    fn a(&self) -> &dyn 'a + B { // <-- Syntax Error: ambiguous `+` in a type
        todo!()
    }
}

This should be

trait A<T: ?Sized> {
    fn a(&self) -> &T;
}
trait B {}

impl<'a, T: B> A<dyn 'a + B> for T {
    fn a(&self) -> &(dyn 'a + B) { // <-- Ok
        todo!()
    }
}

instead, as after then applying the "use parentheses to disambiguate: …" helper.

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 S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

2 participants