-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
TryFrom for now-incompatible type falls back to From error message #71693
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.Diagnostics: Errors or lints caused be the use of two different crate versions.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-crate-version-mismatchDiagnostics: Errors or lints caused be the use of two different crate versions.Diagnostics: Errors or lints caused be the use of two different crate versions.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I am working on a library which at some point converts a
mysql_common::value::Valueto a typeDataTypeviaDataType::try_from(<value>). I am using animpl TryFrom<mysql_common::value::Value> for DataTypedefined in a separate crate, which worked well initially. However, this other crate has since then bumped up the dependencies, such that my project was now using a version ofValueincompatible to the one used by the other crate.The compiler complained (see error message) that "the trait
std::convert::From<mysql_common::value::Value>is not implemented forDataType", and that the conversion was infallible. I think it would have been clearer and easier to debug had the compiler error message rather said thatTryFromwas implemented for a type by the same name but incompatible (different version), rather than fall back on a blanket implementation error message which was deceptive in this case.Error message
Meta
rustc 1.44.0-nightly (94d3463 2020-04-09)
binary: rustc
commit-hash: 94d3463
commit-date: 2020-04-09
host: x86_64-unknown-linux-gnu
release: 1.44.0-nightly
LLVM version: 9.0