It suggests &mut Trait + 'a, which is invalid syntax. It should be &mut (Trait + 'a) instead.
Thank you for the report!
Could you provide a small code snippet that produces the lint with the incorrect suggestion? You can use play.rust-lang.org which has Clippy available under 'Tools' on the right.
It isn't really an incorrect suggestion (though it may be a bad one - I dont know) so much that if you do it verbatim it cannot possibly compile due to rustc parsing limitations. Though it can also require changing the callsite which may or may not be unwanted for this lint.
Actually, borrowed_box in the context of a trait object might usually be an incorrect lint... (not confident enough to say always).
@logannc it builds and applying clippy suggestion causes compiler error similar to OP's. Therefore that's good example, thanks!
I just stumbled upon the same issue, here's one more link to the playground :)
Weird but it seems that the lint doesn't trigger anymore, can anyone confirm? Same for #3971 no?
I believe it's because of the lint now ignores every mutable references (#5491), and both of the two playground link uses mutable references. However, this issue is actually unrelated to mutability. It happens when the trait objects have auto traits or lifetime bounds.
@rust-lang/clippy. I think you'd better reopen this issue.
Most helpful comment
Actually,
borrowed_boxin the context of a trait object might usually be an incorrect lint... (not confident enough to say always).