-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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.
Description
I had mistakenly written this code in crates.io: conn.transaction::<_, CargoError, _>(...)
(note: CargoError
is a trait). I should have written Box<CargoError>
. That resulted in this compiler error, which makes absolutely no sense:
error: the `transaction` method cannot be invoked on a trait object
--> src/user/mod.rs:546:10
|
546 | conn.transaction::<_, CargoError, _>(|| {
| ^^^^^^^^^^^
|
= note: another candidate was found in the following trait, perhaps add a `use` for it:
candidate #1: `use diesel::Connection;`
I am not invoking the method on a trait object, nor would use
have any effect as the Connection
trait is already in scope. For reference, the signature of the method being called is:
fn transaction<T, E, F>(&self, f: F) -> Result<T, E>
where
F: FnOnce() -> Result<T, E>,
E: From<Error>,
goffrie, aschampion, alopatindev, juancampa and Aaron1011
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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.