Skip to content
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

implementing Into when From could be implemented #223

Closed
llogiq opened this issue Aug 23, 2015 · 3 comments
Closed

implementing Into when From could be implemented #223

llogiq opened this issue Aug 23, 2015 · 3 comments
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-AST Type: Requires working with the AST T-middle Type: Probably requires verifiying types

Comments

@llogiq
Copy link
Contributor

llogiq commented Aug 23, 2015

Since there is a blanket impl of Into<T> for all types U with an impl From<Target=T>, it's usually better to implement From where the orphan rule allows it.

@llogiq llogiq added E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-AST Type: Requires working with the AST T-middle Type: Probably requires verifiying types A-lint Area: New lints labels Aug 23, 2015
@Manishearth
Copy link
Member

Does anyone here know the orphan rules well enough to crystall-ball them? I don't 😄

Though coherence.rs might have some utility methods or something.

@llogiq
Copy link
Contributor Author

llogiq commented Aug 24, 2015

The orphan_check_trait_ref(..) could possibly be used, but we'd have to supply a self-generated TraitRef. Another option is to basically clone its code and change the arguments to something we can control.

Currently I'm in favor of the second method, because it doesn't tie us too much into rustc internals.

@camsteffen
Copy link
Contributor

Added in #6476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. T-AST Type: Requires working with the AST T-middle Type: Probably requires verifiying types
Projects
None yet
Development

No branches or pull requests

3 participants