facebook / starlark-rust

A Rust implementation of the Starlark language
Apache License 2.0
699 stars 57 forks source link

build fails with stable and with nightly #73

Closed llimllib closed 1 year ago

llimllib commented 1 year ago

I tried installing with cargo install starlark, my system has rust stable set as the default. This fails with #![feature] may not be used on the stable release channel from the gazebo v0.6.0 package:

detailed error messages ``` error[E0554]: `#![feature]` may not be used on the stable release channel --> /Users/llimllib/.cargo/registry/src/github.com-1ecc6299db9ec823/gazebo-0.6.0/src/lib.rs:10:49 | 10 | #![cfg_attr(feature = "str_pattern_extensions", feature(pattern))] | ^^^^^^^^^^^^^^^^ error[E0554]: `#![feature]` may not be used on the stable release channel --> /Users/llimllib/.cargo/registry/src/github.com-1ecc6299db9ec823/gazebo-0.6.0/src/lib.rs:11:49 | 11 | #![cfg_attr(feature = "str_pattern_extensions", feature(associated_type_bounds))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0554]: `#![feature]` may not be used on the stable release channel --> /Users/llimllib/.cargo/registry/src/github.com-1ecc6299db9ec823/gazebo-0.6.0/src/lib.rs:10:57 | 10 | #![cfg_attr(feature = "str_pattern_extensions", feature(pattern))] ```

I then tried installing with nightly (with rustup toolchain install nightly and rustup run nightly cargo install starlark), which fails with feature has been removed for box_syntax:

detailed error messages ``` error[E0557]: feature has been removed --> /Users/llimllib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/starlark-0.8.0/src/lib.rs:352:12 | 352 | #![feature(box_syntax)] | ^^^^^^^^^^ feature has been removed | = note: replaced with `#[rustc_box]` error: `box_syntax` has been removed --> /Users/llimllib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/starlark-0.8.0/src/assert/assert.rs:225:25 | 225 | setup_eval: box |_| (), | ^^^^^^^^^^ | help: use `Box::new()` instead | 225 | setup_eval: Box::new(|_| ()), | ~~~~~~~~~~~~~~~~ ``` and a few more errors: ``` error[E0407]: method `backtrace` is not a member of trait `Error` --> /Users/llimllib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/starlark-0.8.0/src/errors/mod.rs:126:5 | 126 | / fn backtrace(&self) -> Option<&std::backtrace::Backtrace> { 127 | | Some(self.message.backtrace()) 128 | | } | |_____^ not a member of trait `Error` error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> /Users/llimllib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/starlark-0.8.0/src/syntax/ast.rs:84:1 | 84 | assert_eq_size!(AstStmt, [usize; 12]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `Spanned>` (704 bits) = note: target type: `[usize; 12]` (768 bits) = note: this error originates in the macro `assert_eq_size` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0512]: cannot transmute between types of different sizes, or dependently-sized types --> /Users/llimllib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/starlark-0.8.0/src/syntax/ast.rs:85:1 | 85 | assert_eq_size!(AstExpr, [usize; 9]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: source type: `Spanned>` (448 bits) = note: target type: `[usize; 9]` (576 bits) = note: this error originates in the macro `assert_eq_size` (in Nightly builds, run with -Z macro-backtrace for more info) ```

How can I install starlark-rust? I'm at the limit of my rust knowledge here.

stepancheg commented 1 year ago

We need to release new version which is compatible with stable.

For now the best option is to use some older nightly before box_syntax was removed. We are using nightly-2023-01-24 currently.

llimllib commented 1 year ago

I randomly tried using 2023-01-01, but it failed - possibly I was doing it wrong.

Anyway, installing from HEAD with: rustup run nightly cargo install --git https://github.com/facebookexperimental/starlark-rust starlark seems to have worked.

Thanks for the quick response!

stepancheg commented 1 year ago

Note starlark has very simple command line interface, but primary purpose of starlark is to be embedded in another program.

llimllib commented 1 year ago

I want to use it as my lsp, I bought a tidbyt which uses starlark as its programming language, and nvim-lsp supports this program as an lsp

ndmitchell commented 1 year ago

Usually most "Starlark" things have a bunch of extra functions, and those won't be available in the LSP unless you teach it. The way you teach it is by writing a Rust program that builds on the starlark-rust library. If you do this seriously, you'll probably want to switch to that, but for getting started the generic version probably works fine.

llimllib commented 1 year ago

I am doing this as unseriously as possible 🤣