-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Providing a trait object as a type parameter to a function causes nonsense error #47990
Copy link
Copy link
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.
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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I had mistakenly written this code in crates.io:
conn.transaction::<_, CargoError, _>(...)(note:CargoErroris a trait). I should have writtenBox<CargoError>. That resulted in this compiler error, which makes absolutely no sense:I am not invoking the method on a trait object, nor would
usehave any effect as theConnectiontrait is already in scope. For reference, the signature of the method being called is: