Multiple applicable items in scope suggests wrong code for references to trait objects #58988
Labels
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
A-trait-objects
Area: trait objects, vtable layout
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Suggestions from E0034 prepend
&
to expressions as a string regardless of whether the result type-checks.Example:
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=97c044b74af4a3798f01b223ca868bd8.
Errors
Notice how in the second case, the suggested code has
&&Spam as &Quux
instead of&(&Spam as &Quux)
which is equivalent to the first case.Applying suggestions from these errors will produce new errors:
Errors
The same thing happens for mutable references where
&mut
is prepended instead.Reproducible on all stable Rust versions back to 1.16.0, beta and nightly.
The text was updated successfully, but these errors were encountered: