Alex, you are right. I need to rephrase my question. Consider the following:
pub trait T1 {} pub trait T2 {} impl T1 for ~T2 {} pub struct S; impl T2 for S {} fn check_bounds<U: T1>(_: U) {} fn main() { let x = ~S as ~T2:Send; check_bounds(x); } Should check_bounds fail? It currently compiles, but according to https://github.com/mozilla/rust/issues/5781, trait matching should be invariant. If that's true, ~T2 and ~T2:Send would be different so here we only have a T1 implementation for ~T2, not ~T2:Send, an error. Then task::try(...).unwrap() should fail, too, if my interpretation is correct. On Fri, Apr 18, 2014 at 12:10 AM, Alex Crichton <a...@crichton.co> wrote: > 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.w...@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@mozilla.org > > https://mail.mozilla.org/listinfo/rust-dev > > >
_______________________________________________ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev