#[diagnostic::on_unimplemented]
fails to trigger when certain impls are present
#130563
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-diagnostic-infra
Diagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider the following code:
I would expect the
#[diagnostic::on_unimplemented]
note to be present in the error output for both calls inmain
. However, what I get instead is:While the custom note is emitted for
Foo
, it's not forBar
. The culprit seems to be the impl ofBar
for&T
, which leads rustc down the wrong path and has it suggest only that borrowing is an option. However, that's not always the right suggestion.cc google/zerocopy#1296, google/zerocopy#1682
The text was updated successfully, but these errors were encountered: