[rust-dev] Shouldn't task::try(...).unwrap() fail to compile?

Alex Crichton alex at crichton.co
Thu Apr 17 09:10:07 PDT 2014


The ~Any type has a special implementation of Show:

https://github.com/mozilla/rust/blob/master/src/libstd/any.rs#L151-L155

I believe it was primarily used in failure messages originally (you
can fail a task with ~Any)

On Thu, Apr 17, 2014 at 8:55 AM, Edward Wang <edward.yu.wang at gmail.com> wrote:
> It current can compile, but judging from signatures:
>
> std::task::try is pub fn try<T: Send>(f: proc(): Send -> T) -> Result<T,
> ~Any:Send>
> std::result::unwrap on the other hand is impl<T, E: Show> Result<T, E> { fn
> unwrap(self) -> T {...} }
>
> There's no way the error part of result from task::try(...) can fulfil Show
> so it shouldn't compile.
>
> Though to ask the list first before filing a bug report.
>
> Regards,
> Edward
>
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev
>


More information about the Rust-dev mailing list