# Syntax for returning early with an error

**URL:** <https://internals.rust-lang.org/t/syntax-for-returning-early-with-an-error/14181>\
**Category:** language design\
**Created:** [March 5, 2021, 3:32pm UTC](https://internals.rust-lang.org/t/syntax-for-returning-early-with-an-error/14181 "2021-03-05T15:32:01Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![steffahn](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/steffahn/32/13288_2.png) [@steffahn](https://internals.rust-lang.org/u/steffahn)\
**Post date:** [March 5, 2021, 4:53pm UTC](https://internals.rust-lang.org/t/syntax-for-returning-early-with-an-error/14181/10 "2021-03-05T16:53:22Z")

</div>

> [@steffahn](#):
>
> one can archieve `yeet` -compatibility for any type `Foo<Bar, T>` by implementing
> 
> ```rust
> impl<T> FromResidual<Yeeted<T>> for Foo<Bar, T> {...}
> 
> ```

I like this. One could add another type, e.g. `YeetedNothing` for supporting an argument-less `yeet;` call. Something like `Option` would implement this. The implementations for `Result` and `Option` would be:

```rust
impl<T, E> FromResidual<Yeeted<E>> for Result<T, E> {...}
impl<T> FromResidual<YeetedNothing> for Option<T> {...}

```

---

_[View the full topic](https://internals.rust-lang.org/t/syntax-for-returning-early-with-an-error/14181)._
