These are chat archives for rust-lang/rust

4th
Jul 2017
David Harvey-Macaulay
@alteous
Jul 04 2017 09:48
Hi, is it possible to construct an Arc<[u8]> in a similar way to how Box<[u8]> is constructed? Currently I have Arc<Box<[u8]>> in the code which isn't ideal.
(I'm constructing Box<[u8]> with vec![].into_boxed_slice())
Serhii Plyhun
@snuk182
Jul 04 2017 09:53
well, you can use smth like Arc::from_raw and feed it with Vec's raw data pointer
However you have to mem::forget the vector then, and I'm not sure how safe is that
David Harvey-Macaulay
@alteous
Jul 04 2017 09:54
@snuk182 It says "The raw pointer must have been previously returned by a call to a Arc::into_raw."
Serhii Plyhun
@snuk182
Jul 04 2017 09:54
crap
David Harvey-Macaulay
@alteous
Jul 04 2017 09:54
Not very useful :/
Serhii Plyhun
@snuk182
Jul 04 2017 09:55
rust-lang/rust#40475 there is a ticket for that
David Harvey-Macaulay
@alteous
Jul 04 2017 09:57
@snuk182 Oh great, thanks! I'll just wait it out.
Serhii Plyhun
@snuk182
Jul 04 2017 15:28
after the introduction of rust-lang/rust#41620 - how can I perform floats comparison to pre-defined values, e.g. zero?
Michal 'vorner' Vaner
@vorner
Jul 04 2017 18:19
Hello. If I have a code that compiles fine with stable and beta, but produces an error on nightly, I should probably file a bug, right? Because code should not stop compiling, am I right? (the error is „unexpected end of macro invocation“)
Andrey Lesnikov
@ozkriff
Jul 04 2017 18:44
yep, sounds like a regression
vorner @vorner will try to find the exact nightly version that broke it first...
Denis Lisov
@tanriol
Jul 04 2017 20:23
@snuk182 It's generally not a good idea to perform exact comparison on floats - you'll get false negatives due to rounding errors.