These are chat archives for rust-lang/rust

22nd
Mar 2017
Michal 'vorner' Vaner
@vorner
Mar 22 2017 14:44
Hello. Is there a documentation how to add another target to rustc? If I'm lucky to target something that has a binary distribution, everything works smoothly (I just need to find a working linker and link statically with the musl target). But one of my boxes is powerpc and the powerpc don't have musl targets and the gnu one fails to run for me (the system uses uclibc).
(crap, it ate the wildcard stars and made it into formatting)
Peter Atashian
@retep998
Mar 22 2017 14:57
@vorner If you put asterisks inside *code blocks* using backticks, then they won't turn into formatting. Also you can edit your messages on gitter
Scott Corbeil
@scorbeil
Mar 22 2017 19:11
In Rust, what is the meaning of ident.ident::<Type>();? For context, I'm looking at the example at https://github.com/slide-rs/specs where I'm seeing the line w.register::<Position>();
Jonas Platte
@jplatte
Mar 22 2017 19:14
@scorbeil It means calling register with the first type parameter set to Position.
The ::<> ("turbofish") is simply used to supply type parameters
Scott Corbeil
@scorbeil
Mar 22 2017 19:15
I thought that might be the case, but the colons threw me off. I'm used to generic syntax being just w.register<Position>();
Is that only the case for methods? All functions? I don't believe I've seen this used for types...
Jonas Platte
@jplatte
Mar 22 2017 19:17
It's all function calls AFAIK. It's probably to avoid some sort of parsing ambiguity
Scott Corbeil
@scorbeil
Mar 22 2017 19:18
@jplatte okay, thanks for the help!
Jonas Platte
@jplatte
Mar 22 2017 19:18
Oh, it's for types as well, if used inside of an expression
Scott Corbeil
@scorbeil
Mar 22 2017 19:18
Well that's not confusing at all lol
Jonas Platte
@jplatte
Mar 22 2017 19:18
In general when you wonder about a piece of syntax, have a look at the Syntax Index
Scott Corbeil
@scorbeil
Mar 22 2017 19:19
Oh that's super helpful. Thanks again.
Jonas Platte
@jplatte
Mar 22 2017 19:20
you're welcome :)
Vladimir
@Crazy-Owl
Mar 22 2017 19:44
what is the idiomatic way of implementing Rand for some type, say, position on screen, which by design is limited, but limitations are enforced at runtime?
Right now I generate the absolutely random values and mod them in a calling function. Can that behavior somehow be injected into Rand?
Stan Kondrat
@stan-kondrat
Mar 22 2017 23:34
@Crazy-Owl what do you mean "absolutely random", based on Physical methods? https://en.wikipedia.org/wiki/Random_number_generation#.22True.22_vs._pseudo-random_numbers