These are chat archives for rust-lang/rust

24th
Jan 2016
axiao
@joostshao
Jan 24 2016 05:38
hei, why rust have no net module or http module in langugae ?
hi, goog morning , everybody
Aleksei Mironov
@alexmironof
Jan 24 2016 05:40
Hi! Morning is in 0 +- 3 gtm
Peter Atashian
@retep998
Jan 24 2016 05:40
@joostshao Rust has a minimal standard library because it is really easy to use third party crates due to cargo
Aleksei Mironov
@alexmironof
Jan 24 2016 05:40
You can use third party http module
axiao
@joostshao
Jan 24 2016 05:40
i am in +8 timezone
Peter Atashian
@retep998
Jan 24 2016 05:41
@joostshao Also because anything that does go in the standard library has strict stability guarantees, and Rust doesn't want to commit to supporting an entire http thing in the standard library in the long term
axiao
@joostshao
Jan 24 2016 05:41
have any commercial company support the application lib ?
Peter Atashian
@retep998
Jan 24 2016 05:42
@joostshao I don't understand your question
axiao
@joostshao
Jan 24 2016 05:43
it is really brief
Peter Atashian
@retep998
Jan 24 2016 05:44
Also Rust's standard library does have std::net which contains some TCP/UDP socket stuff
axiao
@joostshao
Jan 24 2016 06:35
how to build rust from source with multi core or faster ?
llvm[3]: Compiling ProcessImplicitDefs.cpp for Release build
llvm[4]: Building AArch64.td MC code emitter with tblgen
llvm[4]: Building AArch64.td "fast" instruction selector implementation with tblgen
llvm[3]: Compiling PrologEpilogInserter.cpp for Release build
llvm[3]: Compiling PseudoSourceValue.cpp for Release build
it is too slow
axiao
@joostshao
Jan 24 2016 06:53
8.0K -rwxr-xr-x 1 root root 8.0K 1月 24 00:18 rustc* i built it , but it's size is 8.0 k .......
Peter Atashian
@retep998
Jan 24 2016 08:20
@joostshao make -j8 will do up to 8 things in parallel
axiao
@joostshao
Jan 24 2016 08:40
thank you
Thomas Koehler
@Bastacyclop
Jan 24 2016 12:27
I want to use a lot of FnOnce and I need to store them.
That's why I want to use an Arena instead of Boxìng them.
However, I found no Arena implementation suitable for this job and I decided to try and make my own:
https://gitlab.com/Bastacyclop/rust_arena/blob/master/src/lib.rs
I'm aware of my lack of knowledge on the matter and I would like to know if what I've done is okay. In particular, how I manage alignement (l.36) and Drop (l.80).
Jarred Nicholls
@jnicholls
Jan 24 2016 12:54
@Bastacyclop I haven't read your code yet, but perhaps the Slab crate would be sufficient for you? https://crates.io/crates/slab/
Jarred Nicholls
@jnicholls
Jan 24 2016 13:03
@Bastacyclop it's basically an Arena to store the same type. If your FnOnce will all be different, then this won't work of course.
Jarred Nicholls
@jnicholls
Jan 24 2016 13:08
@Bastacyclop also there is the typed-arena crate that fits the bill probably.
Hmm n/m, I think that one maintains all the same type also.
Thomas Koehler
@Bastacyclop
Jan 24 2016 13:17
@jnicholls I need to be able to store different FnOnce (like any kind of closure). And then to refer to them without knowing the actual type, just like Box<FnOnce>.
Jarred Nicholls
@jnicholls
Jan 24 2016 13:20
Reading your code...
Thomas Koehler
@Bastacyclop
Jan 24 2016 14:10
I'm gonna ask this on #rust IRC too
John C F
@critiqjo
Jan 24 2016 14:18
I stumbled upon this RFC, which says the borrow checker will automatically infer the lifetime of returned reference (from functions like from_raw_parts) based on usage. But I can't figure out a way to make the borrow checker complain when using from_raw_parts (my best try). That is, the lifetime of the returned reference seems to be 'static. Is there a way to restrict the lifetime of returned reference (to not behave like 'static)?
John C F
@critiqjo
Jan 24 2016 16:39
If it is not possible to restrict output lifetimes of functions (without input lifetimes), why does from_raw_parts simply not use this signature:
pub unsafe fn from_raw_parts<T>(p: *const T, len: usize) -> &'static [T]
Jarred Nicholls
@jnicholls
Jan 24 2016 18:05
@critiqjo depends on how you'd want to restrict it, you'd wrap it with a function of your own lifetime bounds.
John C F
@critiqjo
Jan 24 2016 18:32
@jnicholls you mean like the function coerced_new_u8 here?
But the function signatures in the first two lines seems interchangeable. Is there any difference between the two?
Peter Atashian
@retep998
Jan 24 2016 19:22
@critiqjo They are interchangeable but by returning 'static you're giving the impression that the data returned is in fact 'static which it often isn't. Returning a lifetime parameter makes it clear that the function returns data which isn't necessarily 'static.