# Allow convert T into Ok(T)

**URL:** <https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273>\
**Category:** language design\
**Created:** [February 4, 2023, 6:54pm UTC](https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273 "2023-02-04T18:54:12Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Nemo157](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nemo157/32/11585_2.png) [@Nemo157](https://internals.rust-lang.org/u/Nemo157)\
**Post date:** [February 5, 2023, 11:47am UTC](https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273/22 "2023-02-05T11:47:39Z")

</div>

We have nightly [`do yeet`](https://doc.rust-lang.org/nightly/unstable-book/language-features/yeet-expr.html) syntax that allows early-returning the residual from a `try` block, emulated via `fehler`'s `throw!` macro.

---

<div class="post-metadata">

**Author:** ![Helltraitor](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/helltraitor/32/10504_2.png) [@Helltraitor](https://internals.rust-lang.org/u/Helltraitor)\
**Post date:** [February 5, 2023, 12:31pm UTC](https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273/24 "2023-02-05T12:31:11Z")

</div>

I have no words to describe my feelings... It looks terrible. I just hope that this will be removed from Rust

---

<div class="post-metadata">

**Author:** ![hydroper1](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/hydroper1/32/12099_2.png) [@hydroper1](https://internals.rust-lang.org/u/hydroper1)\
**Post date:** [February 5, 2023, 1:07pm UTC](https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273/25 "2023-02-05T13:07:56Z")

</div>

IMO `do yeet` looks beautiful and Rust-compliant, although it's almost as verbose as `return Err(...);`... (four characters less)

BTW `fn f() try` is not still a nightly feature? There is only `fn f() { try {} }` for now.

---

<div class="post-metadata">

**Author:** ![Nemo157](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nemo157/32/11585_2.png) [@Nemo157](https://internals.rust-lang.org/u/Nemo157)\
**Post date:** [February 5, 2023, 2:00pm UTC](https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273/26 "2023-02-05T14:00:32Z")

</div>

> These are highly experimental, thus the placeholder syntax.

This is not how it's intended to be stabilized, it's using the pre-reserved `do` keyword that has been used for other experimental syntax along with an obviously to-be-bikeshedded contextual keyword `yeet` to describe the operation. It's just implemented to allow exploring the semantics. The eventual syntax will likely use a direct keyword like `throw err;`, with an edition change to allow reserving a new keyword for it.

---

<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:** [May 6, 2023, 2:00pm UTC](https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273/27 "2023-05-06T14:00:50Z")

</div>

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

[Previous page](https://internals.rust-lang.org/t/allow-convert-t-into-ok-t/18273.md?page=1)
