# Idea: Relax orphan rule and remove the need for \`TryFrom\`

**URL:** <https://internals.rust-lang.org/t/idea-relax-orphan-rule-and-remove-the-need-for-tryfrom/9797>\
**Category:** language design\
**Created:** [April 9, 2019, 11:03pm UTC](https://internals.rust-lang.org/t/idea-relax-orphan-rule-and-remove-the-need-for-tryfrom/9797 "2019-04-09T23:03:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![earthengine](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/earthengine/32/2577_2.png) [@earthengine](https://internals.rust-lang.org/u/earthengine)\
**Post date:** [April 9, 2019, 11:03pm UTC](https://internals.rust-lang.org/t/idea-relax-orphan-rule-and-remove-the-need-for-tryfrom/9797/1 "2019-04-09T23:03:05Z")

</div>

I am thinking if we could just write

```rust
impl<T,R,E> From<T> for Result<R,E> {...}

```

we don’t actually need `TryFrom`. Is there a way we can relax the orphan rule to allow something like this (with some reasonable restrictions)?

---

<div class="post-metadata">

**Author:** ![RustyYato](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/rustyyato/32/13627_2.png) [@RustyYato](https://internals.rust-lang.org/u/RustyYato)\
**Post date:** [April 9, 2019, 11:29pm UTC](https://internals.rust-lang.org/t/idea-relax-orphan-rule-and-remove-the-need-for-tryfrom/9797/2 "2019-04-09T23:29:53Z")

</div>

You can already write `Into<Result<R, E>> for T {}` given some types `T`, `R`, `E` if you own `T`. But this is different from `TryFrom`. With `TryFrom` there is still only 1 way to go from `T` to `R`, but with your way there could be many ways to go from `T` to `R` just by giving a different error type. This seems bad. Also it seems bad to relax the orphan rules for 1 specific impl type (I would like to reduce special casing random stuff).

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [July 8, 2019, 11:29pm UTC](https://internals.rust-lang.org/t/idea-relax-orphan-rule-and-remove-the-need-for-tryfrom/9797/3 "2019-07-08T23:29:54Z")

</div>

Closed on July 8, 2019, 11:29pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
