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

2014-04-17 Thread Edward Wang
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) {} fn main() { let x = ~S as ~T2:Send; check_bounds(x); } Should check_bounds fail? It currentl

[rust-dev] Private trait items

2014-04-17 Thread Tommi
Could someone please commit this RFC for me, thank you: - Start Date: 2014-04-18 - RFC PR #: - Rust Issue #: # Summary I propose the ability to set trait items (i.e. just methods currently) private as well as public in order to expand the scope of possible use cases of provided methods (i.e. d

Re: [rust-dev] Why mod.rs files?

2014-04-17 Thread Tommi
Okay, thanks for explaining the reasoning. I think I'll conform to the standard way of doing things. On 2014-04-17, at 18:56, Niko Matsakis wrote: > On Thu, Apr 17, 2014 at 05:39:15PM +0300, Tommi wrote: >> ...but why not map such modules to files and folders as the following: >> >> foo.rs >>

Re: [rust-dev] Why mod.rs files?

2014-04-17 Thread Brian Anderson
On 04/17/2014 07:39 AM, Tommi wrote: Can someone explain me why the module system maps to the file system in the way it does? The problem is that you can end up with these modules named mod.rs instead of the more informative names. If you have the following modules: foo foo::lut bar bar::lut

Re: [rust-dev] Keeping up with Breaking Changes

2014-04-17 Thread Brian Anderson
On 04/17/2014 12:21 AM, Flaper87 wrote: 2014-04-17 2:11 GMT+02:00 Alex Crichton mailto:a...@crichton.co>>: The template which breaking changes will be required to look like is: First, a brief one-line summary of the change Second, take as long as is necessary to explai

Re: [rust-dev] Why mod.rs files?

2014-04-17 Thread Felix S. Klock II
Tommi (cc'ing rust-dev)- I don't know if this is considered an anti-pattern or not, but if you want to structure your files in the manner you describe, you can do so without resorting to `#[path=…]`, assuming you're willing to add a bit of boilerplate to the foo.rs and bar.rs to pull in the mod

Re: [rust-dev] Why mod.rs files?

2014-04-17 Thread Evan G
Sublime does this automatically. On Thu, Apr 17, 2014 at 10:56 AM, Niko Matsakis wrote: > On Thu, Apr 17, 2014 at 05:39:15PM +0300, Tommi wrote: > > ...but why not map such modules to files and folders as the following: > > > > foo.rs > > foo/lut.rs > > bar.rs > > bar/lut.rs > > > > ...and have

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

2014-04-17 Thread Steven Fackler
You can use task::try(...).ok().unwrap() for Results with non-Show error types. Steven Fackler On Thu, Apr 17, 2014 at 8:55 AM, Edward Wang wrote: > It current can compile, but judging from signatures: > > std::task::try is pub fn try(f: proc(): Send -> T) -> Result ~Any:Send> > std::result::un

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

2014-04-17 Thread Alex Crichton
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 wrote: > It current can compile

Re: [rust-dev] Why mod.rs files?

2014-04-17 Thread Niko Matsakis
On Thu, Apr 17, 2014 at 05:39:15PM +0300, Tommi wrote: > ...but why not map such modules to files and folders as the following: > > foo.rs > foo/lut.rs > bar.rs > bar/lut.rs > > ...and have each module informatively named. This used to be our system and we found it very confusing in practice. Ba

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

2014-04-17 Thread Edward Wang
It current can compile, but judging from signatures: std::task::try is pub fn try(f: proc(): Send -> T) -> Result std::result::unwrap on the other hand is impl Result { fn unwrap(self) -> T {...} } There's no way the error part of result from task::try(...) can fulfil Show so it shouldn't compile

[rust-dev] Why mod.rs files?

2014-04-17 Thread Tommi
Can someone explain me why the module system maps to the file system in the way it does? The problem is that you can end up with these modules named mod.rs instead of the more informative names. If you have the following modules: foo foo::lut bar bar::lut ...that maps to files and folders as su

Re: [rust-dev] Expected fields in traits

2014-04-17 Thread Tommi
On 2014-04-17, at 11:25, Marvin Löbel wrote: > Would you mind me taking this RFC over and including it into my proposal? Yes please, by all means. I'm looking forward to your proposal. But actually I just realized that my proposal is essentially just a syntax sugar for a macro producing boiler

Re: [rust-dev] Keeping up with Breaking Changes

2014-04-17 Thread Nicolas Silva
This is great, thanks! On Thu, Apr 17, 2014 at 9:21 AM, Flaper87 wrote: > > > > 2014-04-17 2:11 GMT+02:00 Alex Crichton : > > The template which breaking changes will be required to look like is: >> >> First, a brief one-line summary of the change >> >> Second, take as long as is neces

Re: [rust-dev] Expected fields in traits

2014-04-17 Thread Marvin Löbel
Hi, Im actually working on a more detailed version of this proposal myself, covering more of the problem space (thin pointer, implications, etc). However, I hadn't yet considered the possibility of remapping the fields, instead assuming a simple same-name prefix restriction. Would you mind me tak

Re: [rust-dev] Keeping up with Breaking Changes

2014-04-17 Thread Flaper87
2014-04-17 2:11 GMT+02:00 Alex Crichton : > The template which breaking changes will be required to look like is: > > First, a brief one-line summary of the change > > Second, take as long as is necessary to explain exactly what the > change is, > why it's being changed, what it can be