These are chat archives for rust-lang/rust

12th
Jun 2017
Sathya Narrayanan
@sourcepirate
Jun 12 2017 01:36
@snarf95_twitter @vorner I am trying to use rust-crypto but a different head https://github.com/palaviv/rust-crypto/tree/diffie-hellman/src
urugang
@urugang
Jun 12 2017 02:39
why rust's crate so annoying, no flexible. for example, to add a test, i need to modify dev.dependencies in cargo.toml, add 'extern crate name'; and add 'use self::cratename;'. too many step
Alexander Irbis
@alexander-irbis
Jun 12 2017 02:43
"add use self::cratename;" - why?
urugang
@urugang
Jun 12 2017 03:09
because my imported crate is only used in test, so i add crate spec into dev.dependencies
cargo.toml[dev-dependencies]
rand = "0.3"
extern crate rand;
use self::rand;
it cannot be written as "use rand;"
Alexander Irbis
@alexander-irbis
Jun 12 2017 04:29
You don't need use self::rand;. extern crate rand; does this work.
urugang
@urugang
Jun 12 2017 06:32
for a complete case;

/tmp/app $ cat Cargo.toml
[package]
name = "app"
version = "0.1.0"
authors = [""]

[dev-dependencies]
protobuf = { version = "^1.0.0"}
/tmp/app $ cat src/main.rs

[cfg(test)]

mod tests {
extern crate protobuf;
use protobuf::*;

#[test]
fn test1() {
    let _: &Message;
}

}

cargo test
Compiling app v0.1.0 (file:///tmp/app)
error[E0432]: unresolved import protobuf::*
--> main.rs:10:9
|
10 | use protobuf::*;
| ^^^^^^^^^^^^ Did you mean self::protobuf?

compiler complains, and it is ok when changed to 'use self::protobuf;'
Alexander Irbis
@alexander-irbis
Jun 12 2017 08:02
Hmm, it's very strange to replace protobuf::* with protobuf.
https://github.com/hyperium/hyper/blob/master/tests/client.rs#L13 - for example of working imports.
urugang
@urugang
Jun 12 2017 08:31
thanks
Da Xian Sheng
@daxiansheng
Jun 12 2017 15:00
hi all
I want to use rust to write an os for arm.
Denis Lisov
@tanriol
Jun 12 2017 15:04
@daxiansheng Well, that's certainly possible... what kind of ARM systems do you target?
Da Xian Sheng
@daxiansheng
Jun 12 2017 15:06
@tanriol Memory limited devices such as arm cortex m0 m3.
Denis Lisov
@tanriol
Jun 12 2017 15:09
There are several projects in this space, IIRC. If you don't require the experience of inventing everything from scratch, I'd suggest looking into them and contributing to some :-)
You should probably start by reading the internals post on the state of embedded in Rust.
Da Xian Sheng
@daxiansheng
Jun 12 2017 15:10
I noticed that rust-lang use llvm as compiler backend, and llvm support thumb instructions, so write os in rust is possiable, isn't?
@tanriol great Idea,
Sherzod Mutalov
@shmutalov
Jun 12 2017 15:12
@daxiansheng Possible, yes. https://github.com/redox-os/redox
Denis Lisov
@tanriol
Jun 12 2017 15:12
People are already doing them, so, unless you have some unique concepts, helping them out would probably be more productive than competing with them.
@shmutalov Isn't Redox currently x86_64-only?
Uwe Arzt
@uwearzt
Jun 12 2017 16:22
@daxiansheng Do you know the blog http://blog.japaric.io ? There re also a lot of helpful repos on github by japaric ;) His blog and repos are a nice starting point for rust on ARM Microcontrollers.