[rust-dev] does not fulfill `Send` error since last pull request

Alex Crichton alex at crichton.co
Thu Apr 10 11:28:46 PDT 2014


Your BaseImpl enum isn't necessarily Send because it contains a trait
object (~Base). The typechecker doesn't know what type is behind this
trait object, so it doesn't know whether it's send or not. To make the
BaseImpl type Send again, you can change the definition to:

    enum BaseImpl {
        FirstThinkImpl(~Base:Send), // note the ":Send"
        SecondThinkImpl(~SecondThink),
    }

This error message should get much better with opt-in bounds [1] as it
will point exactly at what's not Send.

[1] - https://github.com/rust-lang/rfcs/blob/master/active/0003-opt-in-builtin-traits.md
as

On Thu, Apr 10, 2014 at 11:23 AM, Philippe Delrieu
<philippe.delrieu at free.fr> wrote:
> Since my last today gill fetch I have this error:
>
> error: instantiating a type parameter with an incompatible type `~BaseImpl`,
> which does not fulfill `Send`
>
> for this code :
> trait Base{}
>
> struct SecondThink{
>     count2: int,
> }
>
> enum BaseImpl    {
>     FirstThinkImpl(~Base),
>     SecondThinkImpl(~SecondThink),
> }
>
> let (newchan, newport): (Sender<BaseImpl>, Receiver<BaseImpl>) = channel();
> <-- error here
> ^~~~~~~
> The Send behavior has changed? Is it permanent and if yes is there a work
> around?
>
> Philippe
> _______________________________________________
> Rust-dev mailing list
> Rust-dev at mozilla.org
> https://mail.mozilla.org/listinfo/rust-dev


More information about the Rust-dev mailing list