These are chat archives for rust-lang/rust

21st
Oct 2016
Jason Bock
@JasonBock
Oct 21 2016 14:19
Just checking out Rust, and I was trying to create a simple benchmark test based on what the docs say here: https://doc.rust-lang.org/1.1.0/book/benchmark-tests.html. When I add "#![feature(test)]" to my code, I get "#[feature] may not be used on the stable release channel [E0554]" - the docs state "Note the test feature gate, which enables this unstable feature." So, I'm a bit confused as to how I get benchmark tests to work. Any insight is appreciated - TIA
Kang Seonghoon
@lifthrasiir
Oct 21 2016 14:20
@JasonBock How did you install Rust? An executable installer?
Michael Howell
@notriddle
Oct 21 2016 14:20
That's exactly true. Feature declarations are used when you're using a feature that isn't stable yet
Kang Seonghoon
@lifthrasiir
Oct 21 2016 14:21
Yeah, but depending on the installation method there are several ways to easily try them out.
Jason Bock
@JasonBock
Oct 21 2016 14:22
Basically installed from here: https://www.rust-lang.org/en-US/. So, ok, it makes sense that's the "stable" version of Rust. I misunderstood that adding the declaration would say it's OK to use unstable features.
Again, newbie here :)
Michael Howell
@notriddle
Oct 21 2016 14:22
Here's an article on the stability rules:
H
Kang Seonghoon
@lifthrasiir
Oct 21 2016 14:23
Basically there are two methods. One is to install nightly (preferrably via rustup), another is to use the bencher crate which is a copy of the unstable test crate.
Jason Bock
@JasonBock
Oct 21 2016 14:24
Thanks @lifthrasiir that makes sense
Jason Bock
@JasonBock
Oct 21 2016 14:24
Thanks @notriddle
Kang Seonghoon
@lifthrasiir
Oct 21 2016 14:24
Note that the bencher crate has some issue on the benchmark result, so it might not be as accurate as the original version especially when the code you’re testing finishes very quickly.
Unless you absolutely need to use the stable, I recommend using rustup; it has other benefits including the simple update and use of multiple targets & versions.
(The link.)
Jason Bock
@JasonBock
Oct 21 2016 14:27
SO much to learn :)
Mika Attila
@crumblingstatue
Oct 21 2016 19:53
Dare I try talking here? Okay, I'll do it for the sake of testing the IRC bridge.
Nice. Seems to be working :+1:
Remi Rampin
@remram44
Oct 21 2016 19:54
So much bridging
Michael Howell
@notriddle
Oct 21 2016 19:54
It's working.
Remi Rampin
@remram44
Oct 21 2016 19:54
Wait this is Gitter right? Is it bridged? To what?
Mika Attila
@crumblingstatue
Oct 21 2016 19:55
I'm using irc.gitter.im
Remi Rampin
@remram44
Oct 21 2016 19:55
oh
Mika Attila
@crumblingstatue
Oct 21 2016 19:55
Because I don't want to have a browser tab dedicated to gitter
My RAM is quite limited
Remi Rampin
@remram44
Oct 21 2016 19:55
Yeah I use riot.im
Mika Attila
@crumblingstatue
Oct 21 2016 19:57
This is pretty nice, because people unfamiliar with IRC can just click the link in their browser if they want to talk, while people who don't want to keep a dedicated browser tab can use the IRC bridge.
Alexander Ronald Altman
@pthariensflame
Oct 21 2016 20:01
And people in both camps can use the dedicated app. :P
Mika Attila
@crumblingstatue
Oct 21 2016 20:01
I guess I could check it out
ugh
It's a binary blob?
Alexander Ronald Altman
@pthariensflame
Oct 21 2016 20:03
Yeah.
Mika Attila
@crumblingstatue
Oct 21 2016 20:04
I think I'll stick with IRC for now
Alexander Ronald Altman
@pthariensflame
Oct 21 2016 20:05
Sure. :)
Matanel Levi
@matanelevi
Oct 21 2016 21:36
question - the mod keyword simply copy & paste the contents of the module into mod { contents } to the file? if it is, it means the the root crate file contains all of the code?
^ just like #include in C?
Alexander Ronald Altman
@pthariensflame
Oct 21 2016 21:41
No.
You can think of it that way, but hygiene applies.
No textual processing is ever done by rustc on your code.
Module imports happen after parsing.
Michael Howell
@notriddle
Oct 21 2016 21:55
Even include! operates at the token tree level.
Matanel Levi
@matanelevi
Oct 21 2016 21:55
@pthariensflame hygiene?
Alexander Ronald Altman
@pthariensflame
Oct 21 2016 21:57
(That's about macros, but the same stuff applies to imports and for the same reasons.)
Matanel Levi
@matanelevi
Oct 21 2016 21:59
@pthariensflame thanks :)