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

2014-04-11 Thread Patrick Walton

On 4/10/14 10:17 PM, comex wrote:

On Thu, Apr 10, 2014 at 2:28 PM, Alex Crichton a...@crichton.co wrote:

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


Off topic, but sigh... first private fields, now this to add even more
verbosity to declaring a struct, which really should be a very low
friction thing.  Not the end of the world but I don't like it.


The API stability problem and the inability for us to add more bounds 
later are real issues though.


(Not to mention the fact that I've spent a lot of time in Servo hunting 
down the one field that caused a big complex structure not to become 
`Send`. I've also had issues whereby commits in a large project sneak in 
that make structures that I wanted to remain sendable suddenly become 
not sendable, requiring awkward useless assertion functions that 
ensure that it doesn't happen in the future. These are potentially 
fixable in other ways, but it just seems cleaner to require structures 
opt in to the built-in traits.)


Patrick
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


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

2014-04-10 Thread Alex Crichton
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.delr...@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): (SenderBaseImpl, ReceiverBaseImpl) = 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@mozilla.org
 https://mail.mozilla.org/listinfo/rust-dev
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev


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

2014-04-10 Thread comex
On Thu, Apr 10, 2014 at 2:28 PM, Alex Crichton a...@crichton.co wrote:
 [1] - 
 https://github.com/rust-lang/rfcs/blob/master/active/0003-opt-in-builtin-traits.md

Off topic, but sigh... first private fields, now this to add even more
verbosity to declaring a struct, which really should be a very low
friction thing.  Not the end of the world but I don't like it.
___
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev