These are chat archives for rust-lang/rust

27th
Oct 2016
Kane Rogers
@kanerogers
Oct 27 2016 01:01
Hey guys, I'm having trouble updating to the latest nightly with the musl toolchain. Can someone just sanity check I'm doing the right thing?
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:01
@kanerogers what’s the symptom?
Kane Rogers
@kanerogers
Oct 27 2016 01:02
@lifthrasiir I'm just getting output now, sorry! :smile:
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:02
:D
Kane Rogers
@kanerogers
Oct 27 2016 01:03
rust@17dc158feff6:~/src$ rustup default nightly
info: syncing channel updates for 'nightly-x86_64-unknown-linux-gnu'
info: update not yet available, sorry! try again later
error: checksum failed, expected: 'ccca6fbbc20c832d004164ffdc50fa50fd19aa6360916d643a508e71dff6a219', calculated: '25567453a21d61007d238d9f8d1c6629f0730b26a702d88399e565d877b4b8fa'
rust@17dc158feff6:~/src$
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:04
huh, did it download the whole file? it might be possible that you are being MitMed or similar.
Kane Rogers
@kanerogers
Oct 27 2016 01:04
Nothing is being downloaded. :(
Sorry, what does MitMed mean?
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:04
ugh, hmm
Kane Rogers
@kanerogers
Oct 27 2016 01:04
rust@17dc158feff6:~/src$ rustup default nightly-2016-10-25-x86_64-unknown-linux-musl
info: syncing channel updates for 'nightly-2016-10-25-x86_64-unknown-linux-musl'
error: target not found: 'x86_64-unknown-linux-musl'
rust@17dc158feff6:~/src$ rustup default nightly-x86_64-unknown-linux-musl
info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'
info: update not yet available, sorry! try again later
error: checksum failed, expected: 'ccca6fbbc20c832d004164ffdc50fa50fd19aa6360916d643a508e71dff6a219', calculated: '25567453a21d61007d238d9f8d1c6629f0730b26a702d88399e565d877b4b8fa'
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:05
MitM indicates that between you and the server someone (the proxy, the attacker or anything else) is monitoring and possibly alternating the data
Kane Rogers
@kanerogers
Oct 27 2016 01:05
Man in the Middle? :laughing:
Oh dear!
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:06
hmm strange, for me rustup default nightly-x86_64-unknown-linux-musl simply errors
info: syncing channel updates for 'nightly-x86_64-unknown-linux-musl'
error: target not found: 'x86_64-unknown-linux-musl'
Kane Rogers
@kanerogers
Oct 27 2016 01:06
Now here's another weird thing - that toolchain is missing in /dist
Screen Shot 2016-10-27 at 12.07.00 pm.png
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:08
@kanerogers did it exist before?
Kane Rogers
@kanerogers
Oct 27 2016 01:09
@lifthrasiir whelp, every other toolchain is there
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:09
that is, is it the first-time install for that particular target?
Kane Rogers
@kanerogers
Oct 27 2016 01:09
On this particular container, yes
(I'm running in a rust-musl-builder container)
I've updated to nightly with musl many times before previously
I had to restart my laptop, and thus had to restart the container and update again, and am now running into this issue for the first time
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:10
to be fair, other nightly builds seem to miss that particular target
Kane Rogers
@kanerogers
Oct 27 2016 01:10
@lifthrasiir Fair enough, might be a red herring
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:10
you can build for musl without having musl compiler itself, but if you are using a container it might be problematic
(since the compiler will need glibc anyway)
Kane Rogers
@kanerogers
Oct 27 2016 01:11
https://github.com/emk/rust-musl-builder <-- That's what this guy is for
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:12
Dockerfile seems to install build-essential, that’s enough for glibc
Kane Rogers
@kanerogers
Oct 27 2016 01:12
Ah well, if it's not something obvious then something else must be going on. I'm sure I'll figure it out.
Thanks for your help anyway!
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:12
@kanerogers I guess you can just install rustup install nightly and set the target later
Kane Rogers
@kanerogers
Oct 27 2016 01:12
Yeah, maybe I'm going about this the wrong way
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:12
that is, rustup target add x86_64-unknown-linux-musl
Kane Rogers
@kanerogers
Oct 27 2016 01:13
Thanks!
Kang Seonghoon
@lifthrasiir
Oct 27 2016 01:13
it does seem mildly confusing :p
some unexpected downside having a self-hosting compiler.
Kane Rogers
@kanerogers
Oct 27 2016 03:27
@lifthrasiir Just as an update, I was originally tethering through my mobile phone, am now using my (much, much slower) home WiFi - no issues.
@lifthrasiir I'm gonna put it down to solar flares, essentially. ;)
Kang Seonghoon
@lifthrasiir
Oct 27 2016 04:07
:D
Sebastian Blei
@iamsebastian
Oct 27 2016 09:52
Hello, hello. :)
Kane Rogers
@kanerogers
Oct 27 2016 09:53
@iamsebastian Hey!
Sebastian Blei
@iamsebastian
Oct 27 2016 09:54
I've just a simple question.
I need to write some Structs with same properties. But properties may not can be defined in traits. Is there another way to implement some same properties to different structs?
Kane Rogers
@kanerogers
Oct 27 2016 09:54
Like inheritance, you mean?
I don't think that's supported in Rust, as far as I know. :frowning:
Sebastian Blei
@iamsebastian
Oct 27 2016 09:54
Hmm. No & yes.
It would be useful, if I could use Traits to implement some properties into structs.
I've never stepped upon that, but at the moment, I have to import some CSV-data into the nickel.rs API and much of the data just differs in one, or two of ~ twenty properties.
Will be much bloat, to implement that without macros.
Kane Rogers
@kanerogers
Oct 27 2016 09:57
@iamsebastian I've had that exact same issue before. :(
Sebastian Blei
@iamsebastian
Oct 27 2016 09:57
There must be a way to do this. :/
Thanks so far, @kanerogers
Kane Rogers
@kanerogers
Oct 27 2016 10:02
@iamsebastian Let me know what you come up with! I'm sure there would be a funky macro solution to this.
Sebastian Blei
@iamsebastian
Oct 27 2016 10:03
Yeah, it's for sure possible to do that with macros. But imho macros are hard to implement into a well-formed API documentation.
Kane Rogers
@kanerogers
Oct 27 2016 10:23
Yeah, they're not perfect
Soham Chowdhury
@mrkgnao
Oct 27 2016 10:27
@jplatte I meant #rust on freenode. I was seeing very little activity there.
I'm trying to get the ndarray examples to compile.
I've cloned the repo. How do I get cargo to compile the examples?
Never mind, I'm dumb
Sebastian Blei
@iamsebastian
Oct 27 2016 10:36
Do you mean cargo run --example foo?
It seems, I can't drop a screenshot in the Linux Gitter client right now.
Screenshot from 2016-10-27 13-02-00.png
But it seems it worked in Firefox.
Kane Rogers
@kanerogers
Oct 27 2016 12:07
@iamsebastian Nice! Crate that thing! :D
Sebastian Blei
@iamsebastian
Oct 27 2016 12:08
Is it worth it? :shipit:
Kane Rogers
@kanerogers
Oct 27 2016 12:08
@iamsebastian why not!? Write a blog post with some examples, put it out there into the world
We can't be the only people who've encountered this
Sebastian Blei
@iamsebastian
Oct 27 2016 12:10
Yeah, for sure. But to crate it, you need to write a macro, that generates this macro. :)
Kane Rogers
@kanerogers
Oct 27 2016 12:27
@iamsebastian Macroception!
Maciej Hirsz
@maciejhirsz
Oct 27 2016 12:56
random question about enums, I know I can get an integer value of an enum if it doesn’t contain any data, e.g.:
enum Foo {
    Bar,
    Baz,
}

fn main() {
    println!("{}", Foo::Baz as u8); // works fine
}
but as soon as I add data to any variant, this becomes unusable:
enum Foo {
    Bar(String),
    Baz,
}

fn main() {
    println!("{}", Foo::Baz as u8); // won't compile, trying to cast non-scalar value
}
which on one hand makes perfect sense (how do you cast an enum that can contain a String to a u8?), but on the other hand since enums are effectively tagged unions, it would be nice to grab the tag and put it into a lookup table or so
so the question is, is it possible to get an integer value of a tag in an enum that can contain data?
Roman Akberov
@RomanAkberov
Oct 27 2016 13:19
@maciejhirsz There is std::intrinsics::discriminant_value, but it's both unstable and unsafe.
Jonas Platte
@jplatte
Oct 27 2016 19:57

@mrkgnao

@jplatte I meant #rust on freenode. I was seeing very little activity there.

The official channel is #rust on the mozilla IRC network, not freenode.

mhsjlw
@mhsjlw
Oct 27 2016 20:49
udp networking library / eventing library recommendations ?