Re: [rust-dev] PipeStream.by_ref() - Multiple applicable methods problem

2014-04-29 Thread Alex Crichton
The by_ref() method exists on both the Reader and the Writer trait, and you're working with a stream which implements both Reader and Writer (hence the confusion by the compiler). You could work around it with something like: fn rdr<'a, T: Reader>(t: &'a mut T) -> RefReader<'a, T> { t

Re: [rust-dev] PipeStream.by_ref() - Multiple applicable methods problem

2014-04-30 Thread Alex Crichton
Oddly enough, that was the first thing I jumped to as well! I think that type inference like that doesn't drive method selection, which is why it ended up not working out. On Wed, Apr 30, 2014 at 3:54 AM, Michael Neumann wrote: > > > Am 29.04.2014 22:51, schrieb Alex Crichton: &

Re: [rust-dev] Symbol visibility problem

2014-04-30 Thread Alex Crichton
In an rlib, all publicly reachable symbols will be exported from the object, for example: mod foo { pub static BAR: int = 3; } That symbol is not exported because BAR is not reachable from the outside world. pub use foo::BAR; mod foo { pub static BAR: int = 3; } This time, BAR will

Re: [rust-dev] Symbol visibility problem

2014-04-30 Thread Alex Crichton
morestack, used >> implicitly). >> >> I have the same problem with ISRs that re defined in libzinc. For now, I >> make trampolines in the app code: >> >> #[no_mangle] >> #[inline(never)] >> #[no_split_stack] >> pub unsafe fn task_schedule

Re: [rust-dev] proper linking with exchange_malloc lang item

2014-05-11 Thread Alex Crichton
While not currently possible, we plan on accommodating use cases such as this through first-class allocators via type parameters. You'll be able to specify your own allocator an standard library routines that allocate memory. Your other option currently is to link to libcore (which doesn't provide

Re: [rust-dev] how to capture de-reference to ~int

2014-05-13 Thread Alex Crichton
The ~int type has since moved to Box, which will one day be a library type with Deref implemented on it (currently it is implemented by the compiler). Regardless, there's no need to implement the Deref trait for the type today, the compiler already takes care of it. For example, your code will com

Re: [rust-dev] How to translate and use a void(*)(void*) in Rust ?

2014-05-13 Thread Alex Crichton
The equivalent of a function pointer in C is the bare fn type in rust. For example, you could write your binding as: // C code int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); // Rust definition fn sqlite3_bind_text(stmt: *mut sqlite3_

Re: [rust-dev] chaining #[start] methods

2014-05-15 Thread Alex Crichton
Rust doesn't support life-before-main, which is basically what this ends up entailing. What you've done already is likely what you'll want to keep doing, which is explicitly chaining control flow through the startup process. On Thu, May 15, 2014 at 1:11 PM, Noah Watkins wrote: > I'd like to put t

Re: [rust-dev] Any way to wake up rust task?

2014-05-15 Thread Alex Crichton
There is no way to generically wake up or kill a task, it must be arranged via some other means for the task to wake up. For TCP connections, you can use the close_read() method or the set_read_timeout() methods. In 0.10, this was not implemented (we recommend you use master). On Thu, May 15, 2014

Re: [rust-dev] Any way to wake up rust task?

2014-05-15 Thread Alex Crichton
> Waking up on timeout is hardly a good decision. Let's think about > thousands of connections, each waking up at a reasonable timeouts > (sometimes between 100 ms to 1 sec for my taste). The close_read is a > hack that doesn't work for many cases (listening sockets, pipes, SCTP > sockets, etc.) >

Re: [rust-dev] No stdout in test builds?

2014-05-26 Thread Alex Crichton
The test runner captures stdout by default and prints it at the end of the test run, but only if the test failed. This is intended to turn down the noise of successful tests, especially the failing ones. If you pass the --nocapture option to the test binary, it will disable this behavior and print

Re: [rust-dev] A better type system

2014-05-31 Thread Alex Crichton
> Sorry for the brevity, I'm writing this from a phone and I haven't thought of > this issue very thoroughly. You appear to dislike one of the most fundamental features of Rust, so I would encourage you to think through ideas such as this before hastily posting to the mailing list. The current i

Re: [rust-dev] How to kill a child task from parent?

2014-06-04 Thread Alex Crichton
Rust tasks do not support being killed at arbitrary points. You'll have to arrange ahead of time for a "please die" message to be sent a long a channel, or a similar scheme for transmitting this information. On Wed, Jun 4, 2014 at 9:33 AM, Aravinda VK wrote: > Hi, > > I am trying different altern

Re: [rust-dev] iOS cross compilation

2014-06-16 Thread Alex Crichton
Nice job Valerii! This is all thanks to the awesome work you've been doing wrangling compiler-rt and the standard libraries. I'm excited to see what new applications Rust can serve on iOS! On Mon, Jun 16, 2014 at 9:19 AM, Valerii Hiora wrote: > Hi, > > So finally Rust can cross-compile for iOS

[rust-dev] 0.11.0 prerelease testing

2014-06-28 Thread Alex Crichton
Hello Rustilians! Bors has outdone himself once again in preparing an 0.11.0 release candidate for us. I've done the usual smoke test, but if you'd also like to try them out the links are all pasted below. Remember that this is not a signed release yet, we've only got checksums for these files at

Re: [rust-dev] ref binding for parameters of functions?

2014-07-02 Thread Alex Crichton
Binding by ref is subtly different that the function still owns the argument. For example, this may go awry with "ref:T" struct Foo; impl Drop for Foo { fn drop(&mut self) { println!("dropping"); } } fn foo(ref _param: Foo) {} fn main() { let f1: fn(ref:Foo) = foo; let f2: fn(Foo) =

[rust-dev] Rust 0.11.0 Released

2014-07-02 Thread Alex Crichton
ntributors to Rust 0.11.0 --- Aaron Raimist Aaron Turon Adolfo Ochagavía Adrien Tétar Ahmed Charles Alan Andrade Alan Williams Alex Crichton Alexandre Gagnon Alexei Sholik Ali Smesseim Andrew Gallant Anton Löfgren Arcterus Ariel Ben-Yehuda Axel Viala Ben No

[rust-dev] A case for removing rusti

2013-05-28 Thread Alex Crichton
I've been tinkering with rusti recently, and I'm reaching the conclusion that it should be removed entirely from the compiler. As many people are probably aware, rusti hasn't been working fantastically for awhile now, but that's only partially why I think that it should be removed. - What I think

Re: [rust-dev] A case for removing rusti

2013-05-28 Thread Alex Crichton
Thanks for your input! It sounds like one thing we can definitely agree that rustc isn't ready for a rusti-like tool to work 100% today. > I knew that pretty printing history into a big list of strings was a bad way > for it to work, but there was no other way to make it work at the time. Each > c

Re: [rust-dev] Static initialisation of LinearMap

2013-07-02 Thread Alex Crichton
> I was looking for something like: static h:HashMap = > {(K,V),(K,V).}. > Is this possible at all? Unfortunately this is more difficult than it seems. One of the nice things about the standard HashMap implementation is that it keys the hashes with random values (stored in each hash map). If t

[rust-dev] Making `lang_item`s optional

2013-07-15 Thread Alex Crichton
It's awesome to have a lot of syntactic sugar for the compiler for things like overloading operators, automatic borrows (@mut in a lib), etc. What's unfortunate is that each of these features requires a new `lang_item` to be defined by the compiler *and* any crate which is compiled. To alleviate t

[rust-dev] Redesigning fmt!

2013-07-26 Thread Alex Crichton
I recently looked into redesigning fmt!, and I wanted to post my ideas before going all the way to ensure that I'm not missing out on anything. == Today's state == As of today, fmt! works pretty well. It's a very useful function and will likely be a very common thing in all rust code using libstd

Re: [rust-dev] Met with a terrible fate

2014-07-02 Thread Alex Crichton
If you touch runtime services (such as those mentioned by Benjamin), it is assume that a Rust Task [1] is available. In your case, you're touching the unwinding service, but you have no set a catch-point for the call to unwinding anywhere. This sounds like you're triggering a failure without a task

Re: [rust-dev] Met with a terrible fate

2014-07-03 Thread Alex Crichton
> I am thinking that maybe one solution could be that the C code calls > an init function that calls native::start and provides a function pointer > that start calls back into C. That way the C main thread will have a rust > runtime in the background, I *think*?. That is correct! > I hope this wo

Re: [rust-dev] Impending change in RPATH behavior when linking to Rust dynamic libraries

2014-07-09 Thread Alex Crichton
It is indeed! You'll need to ensure that `/Users/ilya/Library/Local/Rust/current/lib` is in your DYLD_LIBRARY_PATH environment variable for OSX. On Wed, Jul 9, 2014 at 6:25 AM, Ilya Dmitrichenko wrote: > Is the following error cause by this change? > > % rustc -v > dyld: Library not loaded: > x86

Re: [rust-dev] Issue running documented functions from doc code w/ rustdoc

2014-07-09 Thread Alex Crichton
Doc tests are compiled as if they were clients of a library, so you'll have to write the test assuming the rest of the source was built with `--crate-type lib` and then import it directly. For example, you may have to do this: ```rust main::under_test(); ``` Doc test aren't really designed with

Re: [rust-dev] Stack usage of green tasks

2014-07-09 Thread Alex Crichton
By default, each stack is allocated with a "red zone" at the end for running code on stack overflow, calling C functions, etc. The current size of the red zone is 20K. Requested stack sizes are always at least 20K, but the 20K is not currently added to the stack size. So for your test case when yo

Re: [rust-dev] Seemingly Poor Scalability of M:N Scheduler

2014-07-11 Thread Alex Crichton
This is a known performance bug in the green schedulers being tracked at https://github.com/rust-lang/rust/issues/11730. To see the difference, you can run with RUST_THREADS=1 when using the green scheduler. On Fri, Jul 11, 2014 at 1:39 PM, Chandru wrote: > I tried the rust-http's comparison wit

Re: [rust-dev] Impending change in RPATH behavior when linking to Rust dynamic libraries

2014-07-11 Thread Alex Crichton
> LD_LIBRARY_PATH is not known about by many The install.sh script now recommends adding an entry to this variable if it detects that this is necessary, so it's not *entirely* unknown. This doesn't help, however, if it's considered a bad practice. > 1) Link dependencies of rustc statically to it?

Re: [rust-dev] How to get the file descriptors of standard I/O types?

2014-07-14 Thread Alex Crichton
There is not currently a method of doing so through the `std::io` apis. While possible through the rustuv and native apis, I would discourage manual use of those crates as they have experimental and volatile APIs. You may be interested in https://github.com/rust-lang/rust/pull/15643 which may add

[rust-dev] Migrating libs out of rust-lang/rust

2014-07-29 Thread Alex Crichton
Now that cargo is starting to become a larger part of the Rust ecosystem it's time for some of the crates as part of the standard distribution to move out of the main rust repository. This movement has been planned for quite some time now, and it has only recently become possible with the advent of

Re: [rust-dev] Migrating libs out of rust-lang/rust

2014-07-29 Thread Alex Crichton
Currently the threshold for being "officially supported" will be one of being in the rust-lang organization or being on the travis dashboard. At this time there are no plans to have an in-tree way to distinguish, although I suspect that a README with a description would likely suffice. On Tue, Jul

Re: [rust-dev] Migrating libs out of rust-lang/rust

2014-07-30 Thread Alex Crichton
>> We plan to implement any necessary infrastructure to ensure that the >> crates >> move out of the rust repository maintain the same level of quality they >> currently have. > > > Will these crates’ documentation be available online? At this time there are no plans for this, but we're certainly

Re: [rust-dev] Migrating libs out of rust-lang/rust

2014-07-30 Thread Alex Crichton
> Ok, I got the basic going with a temporary for of `libsemver` here: > - https://travis-ci.org/errordeveloper/rust-libsemver/builds/31217706 > - https://github.com/errordeveloper/rust-libsemver Awesome! I've created a new repo for you to make a PR against: https://github.com/rust-lang/semver

Re: [rust-dev] Migrating libs out of rust-lang/rust

2014-07-31 Thread Alex Crichton
>> There's a cron job running which will trigger each build each night >> after the nightlies have finished building, and the .travis.yml script >> for these repos are all wired to nightlies rather than the PPA. > > > Could the source code for this cron job be published, with instructions on > how

Re: [rust-dev] First impressions of Rust

2014-10-08 Thread Alex Crichton
> Disclaimer: please take all of this with a huge grain of salt. This > feedback is meant with the humility of someone who surely doesn't > fully understand the language yet and hasn't invested enough time into > yet to be taken seriously. Much of what I say may have little bearing > on anything.

Re: [rust-dev] First impressions of Rust

2014-10-09 Thread Alex Crichton
>> Feel free to open a bug on the >> issue tracker (https://github.com/rust-lang/rfcs/issues) or even open >> an RFC on it! Due to it being a language change, you should register >> the issue in the RFC repo instead of the rust repo. > > Oh my, I'm allowed to start an RFC? I don't feel confident i

Re: [rust-dev] First impressions of Rust

2014-10-10 Thread Alex Crichton
>> The syntax was pioneered before the RFC process was in effect, so it >> may not have an official grammar, but it looks something like: >> >> expr := 'box' expr | 'box' '(' expr ')' expr >> >> The first form is "rewritten" as `box(::std::owned::HEAP) expr` and >> the second form (the more gen

<    1   2