Skip to content

Confusing error messages when trying to implement Display for [Owntype] #34075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
johanneshoehn opened this issue Jun 4, 2016 · 1 comment
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@johanneshoehn
Copy link

For instance impl fmt::Display for [PathSegType] { leads to:

error: the impl does not reference any types defined in this crate; only traits defined in the current crate can be implemented for arbitrary types [E0117]

Here the error message could be more helpful. The impl actually does reference a type local to the crate, but only as part of non-local type.

The error message gets way more confusing if you use Types with parameters, for instance impl<T: Display + Copy> fmt::Display for [PathSeg<T>] { leads to:

error: type parameter T must be used as the type parameter for some local type (e.g. MyStruct<T>); only traits defined in the current crate can be implemented for a type parameter [E0210]

@apasel422 apasel422 added the A-diagnostics Area: Messages for errors, warnings, and lints label Jun 7, 2016
@steveklabnik steveklabnik removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum
Copy link
Member

Closing in favor of #24745. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

4 participants