LoginSignup
8
9

More than 5 years have passed since last update.

Rust環境構築(2016)

Posted at

もう何度目かわからないが、またRustをやりたくなったので環境を作ることにした。

  • multirustを入れる
  • そのために昔入れてたrustを削除
  • atomで補完できる環境を作る

昔インストーラからインスコしたことがある人向け

mulitrustで邪魔なので消す。multirustが消せと言ってくる。興味あるが使ってない人は1.0あたりが入ってると思う。

curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --uninstall

消し方探してたらここで言及されてて気づいた。 https://github.com/rust-lang/rust/issues/20283

multirust

curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh

途中なんか訊かれたが y と答えた。

デフォルトだとstable を勝手にインストールするっぽく、今1.6.0が入った。

プロジェクトを作成する

~/sandbox $ cargo new myapp --bin
~/sandbox $ cd myapp/
~/s/myapp (master) $ ls -l
total 16
drwxr-xr-x   6 mizchi  staff   204B  1 30 02:42 .
drwxr-xr-x  31 mizchi  staff   1.0K  1 30 02:42 ..
drwxr-xr-x   9 mizchi  staff   306B  1 30 02:42 .git
-rw-r--r--   1 mizchi  staff     7B  1 30 02:42 .gitignore
-rw-r--r--   1 mizchi  staff   109B  1 30 02:42 Cargo.toml
drwxr-xr-x   3 mizchi  staff   102B  1 30 02:42 src
~/s/myapp (master) $ cargo run
   Compiling myapp v0.1.0 (file:///Users/mizchi/sandbox/myapp)
     Running `target/debug/myapp`
Hello, world!

とりあえず実行可能なことを確認。

Atom

まあ好きなエディタを使ってくれという感じだが、自分はAtomがメインなのでAtom環境を作る。

基本的には http://qiita.com/nacika_ins/items/044c87fd8bd1d7c41191 を1.6.0に変えて実行した。

いじった点

  • apm uninstall rust-ctags は deprecated
  • 補完は出るようになったが、racerの警告出続けてうっとおしかったので ~/.atom/packages/racer/lib/racer-client.coffeeatom.notifications.addWarning "racer returned a non-zero exit code: #{code}\n#{@last_stderr}" をコメントアウトした。racerのビルド環境がおかしいのかもしれない。

参考

8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9