facebook / starlark-rust

A Rust implementation of the Starlark language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

document the build instructions

adonovan opened this issue · comments

It would be great if the project README linked to instructions---or simply demonstrated using an example---how to build it, ideally assuming only a minimum of Rust knowledge.

I cloned the repo, installed cargo using brew install rust, and attempted to build the REPL using variations of these commands:

$ cargo build --bin=starlark
$ cargo build
$ cargo build --release --bin=starlark
$ (cd starlark/bin/ && cargo build)

but in each case got this error:

error[E0554]: `#![feature]` 
  --> /Users/adonovan/.cargo/registry/src/github.com-1ecc6299db9ec823/gazebo-0.6.0/src/lib.rs:10:49
   |
10 | #![cfg_attr(feature = "str_pattern_extensions", feature(pattern))]

I'm sure I'm missing something elementary. Following clues from StackOverflow, I tried removing the homebrew rust and installing rustup, eventually fumbling my way to success:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ ~/.cargo/bin/rustup install nightly
$ ~/.cargo/bin/cargo +nightly install starlark 
$ ~/.cargo/bin/starlark --repl
$> print(1+2)
3

Perhaps someone could turn my drunken walk into a signpost. Thanks!

We have a file at the root rust-toolchain which tells Rust which toolchain to use. Unfortunately it seems the brew version of Rust doesn't honour that, so you do need to use rustup, which knows about it. I think the minimal set is probably:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ cargo run -- --repl`
$> print (1+2)
3

Which works for me. I'll add to the README - thanks for the suggestion.

Also: there's a P in REPL. ;-)

$> print (1+2)
3
$> 1+2
$>

@adonovan that was fixed recently

6360c99

$> 1+2
3
$>

Done in 2d507c7 - thanks for the feedback!