facebook / starlark-rust

A Rust implementation of the Starlark language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starlark update throws errors related to the Allocative trait.

hulto opened this issue Β· comments

commented

I'm working on updating to the latest version of starlark (acf6384) on the main branch so I can leverage the PrintHandle attribute and set a custom handler.

I was having some issues around allocative so I tried just building one of the example code sections but ran into the same compiler error.
https://github.com/facebookexperimental/starlark-rust/blob/acf638430a00ca3855862e8c669670e1adaa42aa/starlark/src/lib.rs#L287

I made some minor modifications like moving the struct definition and impl's out of the run function.

#![feature(trivial_bounds)]

use starlark::environment::{Globals, Module};
use starlark::eval::Evaluator;
use starlark::syntax::{AstModule, Dialect};
use starlark::values::{Heap, StarlarkValue, Value, ValueError, ValueLike, ProvidesStaticType, NoSerialize};
use starlark::{starlark_type, starlark_simple_value};
use std::fmt::{self, Display, Write};
use allocative::Allocative;

// Define complex numbers
#[derive(Debug, PartialEq, Eq, ProvidesStaticType, Allocative, NoSerialize)]
struct Complex {
    real: i32,
    imaginary: i32,
}
starlark_simple_value!(Complex);

impl Display for Complex {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{} + {}i", self.real, self.imaginary)
    }
}

impl<'v> StarlarkValue<'v> for Complex {
    starlark_type!("complex");

    // How we add them
    fn add(&self, rhs: Value<'v>, heap: &'v Heap)
            -> Option<anyhow::Result<Value<'v>>> {
        if let Some(rhs) = rhs.downcast_ref::<Self>() {
            Some(Ok(heap.alloc(Complex {
                real: self.real + rhs.real,
                imaginary: self.imaginary + rhs.imaginary,
            })))
        } else {
            None
        }
    }
}

fn run() -> anyhow::Result<()> {
    let content = "str(a + b)";

    let ast = AstModule::parse("complex.star", content.to_owned(), &Dialect::Standard)?;
    let globals = Globals::standard();
    let module = Module::new();
    // We inject some complex numbers into the module before we start.
    let a = module.heap().alloc(Complex {real: 1, imaginary: 8});
    module.set("a", a);
    let b = module.heap().alloc(Complex {real: 4, imaginary: 2});
    module.set("b", b);
    let mut eval = Evaluator::new(&module);
    let res = eval.eval_module(ast, &globals)?;
    assert_eq!(res.unpack_str(), Some("5 + 10i"));
    Ok(())
}
fn main(){ run().unwrap(); }

When building the project I get an error that the Allocative trait is not implemented for the Complex struct.

Downloads/starlark-test/starlark-test-proj ξ‚° πŸ¦€ 1.70.0-nightly ξ‚° ξ‚  master ✘ ✭ ξ‚°
$ cargo run
   Compiling rustix v0.36.11
   Compiling terminal_size v0.2.5
   Compiling clap_builder v4.2.1
   Compiling clap v4.2.1
   Compiling starlark v0.9.0-pre (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
   Compiling starlark-test-proj v0.1.0 (/Users/hulto/Downloads/starlark-test/starlark-test-proj)
warning: unused import: `ValueError`
 --> src/main.rs:6:52
  |
6 | use starlark::values::{Heap, StarlarkValue, Value, ValueError, ValueLike, ProvidesStaticType, NoSerialize};
  |                                                    ^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0277]: the trait bound `Complex: allocative::allocative_trait::Allocative` is not satisfied
   --> src/main.rs:25:32
    |
25  | impl<'v> StarlarkValue<'v> for Complex {
    |                                ^^^^^^^ the trait `allocative::allocative_trait::Allocative` is not implemented for `Complex`
    |
    = help: the following other types implement trait `allocative::allocative_trait::Allocative`:
              !
              &'static T
              ()
              (A, B)
              (A, B, C)
              (A, B, C, D)
              (A, B, C, D, E)
              (A,)
            and 118 others
note: required by a bound in `StarlarkValue`
   --> /Users/hulto/.cargo/git/checkouts/starlark-rust-59575ffdf833204c/acf6384/starlark/src/values/traits.rs:206:31
    |
206 |     'v + ProvidesStaticType + Allocative + Debug + Display + Serialize + Sized
    |                               ^^^^^^^^^^ required by this bound in `StarlarkValue`

For more information about this error, try `rustc --explain E0277`.
warning: `starlark-test-proj` (bin "starlark-test-proj") generated 1 warning
error: could not compile `starlark-test-proj` (bin "starlark-test-proj") due to previous error; 1 warning emitted

I tried implementing the Allocative trait manually instead of through a derive but got the same error.

image

Doing both, defining the Allocative trait manuallly and through derive throws an error that Allocative is defined twice.

image

cargo version
cargo 1.70.0-nightly (145219a9f 2023-03-27)

Cargo.toml

[dependencies]
starlark = { git = "https://github.com/facebookexperimental/starlark-rust", rev = "acf638430a00ca3855862e8c669670e1adaa42aa" }
allocative = { version = "0.2" }
allocative_derive = { version = "0.2" }
anyhow = "1.0.65"

Just derive(Allocative) should be sufficient.

Check cargo tree please, do you have the same version of allocative in starlark dependency and in your crate dependency?

commented

I think the versions in my crate & Starlark are the same.
I'm not vendoring the allocative crate though.

starlark-test-proj v0.1.0 (/Users/hulto/Downloads/starlark-test/starlark-test-proj)
β”œβ”€β”€ allocative v0.2.0
β”‚   └── allocative_derive v0.2.0 (proc-macro)
β”‚       β”œβ”€β”€ proc-macro2 v1.0.54
β”‚       β”‚   └── unicode-ident v1.0.8
β”‚       β”œβ”€β”€ quote v1.0.26
β”‚       β”‚   └── proc-macro2 v1.0.54 (*)
β”‚       └── syn v1.0.109
β”‚           β”œβ”€β”€ proc-macro2 v1.0.54 (*)
β”‚           β”œβ”€β”€ quote v1.0.26 (*)
β”‚           └── unicode-ident v1.0.8
β”œβ”€β”€ allocative_derive v0.2.0 (proc-macro) (*)
β”œβ”€β”€ anyhow v1.0.70
└── starlark v0.9.0-pre (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”œβ”€β”€ allocative v0.2.0 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚   β”œβ”€β”€ allocative_derive v0.2.0 (proc-macro) (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚   β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚   └── syn v1.0.109 (*)
    β”‚   β”œβ”€β”€ bumpalo v3.12.0
    β”‚   β”œβ”€β”€ ctor v0.1.26 (proc-macro)
    β”‚   β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚   └── syn v1.0.109 (*)
    β”‚   β”œβ”€β”€ hashbrown v0.12.3
    β”‚   β”‚   └── ahash v0.7.6
    β”‚   β”‚       β”œβ”€β”€ getrandom v0.2.8
    β”‚   β”‚       β”‚   β”œβ”€β”€ cfg-if v1.0.0
    β”‚   β”‚       β”‚   └── libc v0.2.140
    β”‚   β”‚       └── once_cell v1.17.1
    β”‚   β”‚       [build-dependencies]
    β”‚   β”‚       └── version_check v0.9.4
    β”‚   └── num-bigint v0.4.3
    β”‚       β”œβ”€β”€ num-integer v0.1.45
    β”‚       β”‚   └── num-traits v0.2.15
    β”‚       β”‚       [build-dependencies]
    β”‚       β”‚       └── autocfg v1.1.0
    β”‚       β”‚   [build-dependencies]
    β”‚       β”‚   └── autocfg v1.1.0
    β”‚       └── num-traits v0.2.15 (*)
    β”‚       [build-dependencies]
    β”‚       └── autocfg v1.1.0
    β”œβ”€β”€ annotate-snippets v0.9.1
    β”‚   └── unicode-width v0.1.10
    β”œβ”€β”€ anyhow v1.0.70
    β”œβ”€β”€ argfile v0.1.5
    β”‚   └── os_str_bytes v6.5.0
    β”‚       └── memchr v2.5.0
    β”œβ”€β”€ bumpalo v3.12.0
    β”œβ”€β”€ clap v4.2.1
    β”‚   β”œβ”€β”€ clap_builder v4.2.1
    β”‚   β”‚   β”œβ”€β”€ anstream v0.2.6
    β”‚   β”‚   β”‚   β”œβ”€β”€ anstyle v0.3.5
    β”‚   β”‚   β”‚   β”œβ”€β”€ anstyle-parse v0.1.1
    β”‚   β”‚   β”‚   β”‚   └── utf8parse v0.2.1
    β”‚   β”‚   β”‚   β”œβ”€β”€ concolor-override v1.0.0
    β”‚   β”‚   β”‚   β”œβ”€β”€ concolor-query v0.3.3
    β”‚   β”‚   β”‚   β”œβ”€β”€ is-terminal v0.4.6
    β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ io-lifetimes v1.0.9
    β”‚   β”‚   β”‚   β”‚   β”‚   └── libc v0.2.140
    β”‚   β”‚   β”‚   β”‚   └── rustix v0.37.5
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ bitflags v1.3.2
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ errno v0.3.0
    β”‚   β”‚   β”‚   β”‚       β”‚   └── libc v0.2.140
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ io-lifetimes v1.0.9 (*)
    β”‚   β”‚   β”‚   β”‚       └── libc v0.2.140
    β”‚   β”‚   β”‚   └── utf8parse v0.2.1
    β”‚   β”‚   β”œβ”€β”€ anstyle v0.3.5
    β”‚   β”‚   β”œβ”€β”€ bitflags v1.3.2
    β”‚   β”‚   β”œβ”€β”€ clap_lex v0.4.1
    β”‚   β”‚   β”œβ”€β”€ strsim v0.10.0
    β”‚   β”‚   └── terminal_size v0.2.5
    β”‚   β”‚       └── rustix v0.36.11
    β”‚   β”‚           β”œβ”€β”€ bitflags v1.3.2
    β”‚   β”‚           β”œβ”€β”€ errno v0.2.8
    β”‚   β”‚           β”‚   └── libc v0.2.140
    β”‚   β”‚           β”œβ”€β”€ io-lifetimes v1.0.9 (*)
    β”‚   β”‚           └── libc v0.2.140
    β”‚   β”œβ”€β”€ clap_derive v4.2.0 (proc-macro)
    β”‚   β”‚   β”œβ”€β”€ heck v0.4.1
    β”‚   β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚   └── syn v2.0.11
    β”‚   β”‚       β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”‚       β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚       └── unicode-ident v1.0.8
    β”‚   └── once_cell v1.17.1
    β”œβ”€β”€ debugserver-types v0.5.0
    β”‚   β”œβ”€β”€ schemafy v0.5.2 (proc-macro)
    β”‚   β”‚   β”œβ”€β”€ Inflector v0.11.4
    β”‚   β”‚   β”‚   β”œβ”€β”€ lazy_static v1.4.0
    β”‚   β”‚   β”‚   └── regex v1.7.3
    β”‚   β”‚   β”‚       β”œβ”€β”€ aho-corasick v0.7.20
    β”‚   β”‚   β”‚       β”‚   └── memchr v2.5.0
    β”‚   β”‚   β”‚       β”œβ”€β”€ memchr v2.5.0
    β”‚   β”‚   β”‚       └── regex-syntax v0.6.29
    β”‚   β”‚   β”œβ”€β”€ schemafy_core v0.5.2
    β”‚   β”‚   β”‚   β”œβ”€β”€ serde v1.0.159
    β”‚   β”‚   β”‚   β”‚   └── serde_derive v1.0.159 (proc-macro)
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚   β”‚   β”‚       └── syn v2.0.11 (*)
    β”‚   β”‚   β”‚   └── serde_json v1.0.95
    β”‚   β”‚   β”‚       β”œβ”€β”€ itoa v1.0.6
    β”‚   β”‚   β”‚       β”œβ”€β”€ ryu v1.0.13
    β”‚   β”‚   β”‚       └── serde v1.0.159 (*)
    β”‚   β”‚   β”œβ”€β”€ schemafy_lib v0.5.2
    β”‚   β”‚   β”‚   β”œβ”€β”€ Inflector v0.11.4 (*)
    β”‚   β”‚   β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”‚   β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚   β”‚   β”œβ”€β”€ schemafy_core v0.5.2 (*)
    β”‚   β”‚   β”‚   β”œβ”€β”€ serde v1.0.159 (*)
    β”‚   β”‚   β”‚   β”œβ”€β”€ serde_derive v1.0.159 (proc-macro) (*)
    β”‚   β”‚   β”‚   β”œβ”€β”€ serde_json v1.0.95 (*)
    β”‚   β”‚   β”‚   └── syn v1.0.109 (*)
    β”‚   β”‚   β”œβ”€β”€ serde v1.0.159 (*)
    β”‚   β”‚   β”œβ”€β”€ serde_derive v1.0.159 (proc-macro) (*)
    β”‚   β”‚   β”œβ”€β”€ serde_json v1.0.95 (*)
    β”‚   β”‚   β”œβ”€β”€ serde_repr v0.1.12 (proc-macro)
    β”‚   β”‚   β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”‚   β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚   β”‚   └── syn v2.0.11 (*)
    β”‚   β”‚   └── syn v1.0.109 (*)
    β”‚   β”œβ”€β”€ serde v1.0.159 (*)
    β”‚   └── serde_json v1.0.95 (*)
    β”œβ”€β”€ derivative v2.2.0 (proc-macro)
    β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   └── syn v1.0.109 (*)
    β”œβ”€β”€ derive_more v0.99.17 (proc-macro)
    β”‚   β”œβ”€β”€ convert_case v0.4.0
    β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   └── syn v1.0.109 (*)
    β”‚   [build-dependencies]
    β”‚   └── rustc_version v0.4.0
    β”‚       └── semver v1.0.17
    β”œβ”€β”€ dupe v0.8.1 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚   └── dupe_derive v0.8.0 (proc-macro) (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚       β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚       β”œβ”€β”€ quote v1.0.26 (*)
    β”‚       └── syn v1.0.109 (*)
    β”œβ”€β”€ either v1.8.1
    β”œβ”€β”€ erased-serde v0.3.25
    β”‚   └── serde v1.0.159 (*)
    β”œβ”€β”€ fancy-regex v0.10.0
    β”‚   β”œβ”€β”€ bit-set v0.5.3
    β”‚   β”‚   └── bit-vec v0.6.3
    β”‚   └── regex v1.7.3 (*)
    β”œβ”€β”€ gazebo v0.8.1 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚   β”œβ”€β”€ dupe v0.8.1 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843) (*)
    β”‚   └── gazebo_derive v0.8.0 (proc-macro) (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚       β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚       β”œβ”€β”€ quote v1.0.26 (*)
    β”‚       └── syn v1.0.109 (*)
    β”œβ”€β”€ hashbrown v0.12.3 (*)
    β”œβ”€β”€ inventory v0.1.11
    β”‚   β”œβ”€β”€ ctor v0.1.26 (proc-macro) (*)
    β”‚   β”œβ”€β”€ ghost v0.1.9 (proc-macro)
    β”‚   β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   β”‚   └── syn v2.0.11 (*)
    β”‚   └── inventory-impl v0.1.11 (proc-macro)
    β”‚       β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚       β”œβ”€β”€ quote v1.0.26 (*)
    β”‚       └── syn v1.0.109 (*)
    β”œβ”€β”€ itertools v0.10.5
    β”‚   └── either v1.8.1
    β”œβ”€β”€ lalrpop-util v0.19.9
    β”œβ”€β”€ logos v0.12.1
    β”‚   └── logos-derive v0.12.1 (proc-macro)
    β”‚       β”œβ”€β”€ beef v0.5.2
    β”‚       β”œβ”€β”€ fnv v1.0.7
    β”‚       β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚       β”œβ”€β”€ quote v1.0.26 (*)
    β”‚       β”œβ”€β”€ regex-syntax v0.6.29
    β”‚       └── syn v1.0.109 (*)
    β”œβ”€β”€ lsp-server v0.5.2
    β”‚   β”œβ”€β”€ crossbeam-channel v0.5.7
    β”‚   β”‚   β”œβ”€β”€ cfg-if v1.0.0
    β”‚   β”‚   └── crossbeam-utils v0.8.15
    β”‚   β”‚       └── cfg-if v1.0.0
    β”‚   β”œβ”€β”€ log v0.4.17
    β”‚   β”‚   └── cfg-if v1.0.0
    β”‚   β”œβ”€β”€ serde v1.0.159 (*)
    β”‚   └── serde_json v1.0.95 (*)
    β”œβ”€β”€ lsp-types v0.93.2
    β”‚   β”œβ”€β”€ bitflags v1.3.2
    β”‚   β”œβ”€β”€ serde v1.0.159 (*)
    β”‚   β”œβ”€β”€ serde_json v1.0.95 (*)
    β”‚   β”œβ”€β”€ serde_repr v0.1.12 (proc-macro) (*)
    β”‚   └── url v2.3.1
    β”‚       β”œβ”€β”€ form_urlencoded v1.1.0
    β”‚       β”‚   └── percent-encoding v2.2.0
    β”‚       β”œβ”€β”€ idna v0.3.0
    β”‚       β”‚   β”œβ”€β”€ unicode-bidi v0.3.13
    β”‚       β”‚   └── unicode-normalization v0.1.22
    β”‚       β”‚       └── tinyvec v1.6.0
    β”‚       β”‚           └── tinyvec_macros v0.1.1
    β”‚       β”œβ”€β”€ percent-encoding v2.2.0
    β”‚       └── serde v1.0.159 (*)
    β”œβ”€β”€ maplit v1.0.2
    β”œβ”€β”€ memchr v2.5.0
    β”œβ”€β”€ memoffset v0.6.5
    β”‚   [build-dependencies]
    β”‚   └── autocfg v1.1.0
    β”œβ”€β”€ num-bigint v0.4.3 (*)
    β”œβ”€β”€ num-traits v0.2.15 (*)
    β”œβ”€β”€ once_cell v1.17.1
    β”œβ”€β”€ paste v1.0.12 (proc-macro)
    β”œβ”€β”€ regex v1.7.3 (*)
    β”œβ”€β”€ rustyline v7.1.0
    β”‚   β”œβ”€β”€ bitflags v1.3.2
    β”‚   β”œβ”€β”€ cfg-if v1.0.0
    β”‚   β”œβ”€β”€ dirs-next v2.0.0
    β”‚   β”‚   β”œβ”€β”€ cfg-if v1.0.0
    β”‚   β”‚   └── dirs-sys-next v0.1.2
    β”‚   β”‚       └── libc v0.2.140
    β”‚   β”œβ”€β”€ fs2 v0.4.3
    β”‚   β”‚   └── libc v0.2.140
    β”‚   β”œβ”€β”€ libc v0.2.140
    β”‚   β”œβ”€β”€ log v0.4.17 (*)
    β”‚   β”œβ”€β”€ memchr v2.5.0
    β”‚   β”œβ”€β”€ nix v0.19.1
    β”‚   β”‚   β”œβ”€β”€ bitflags v1.3.2
    β”‚   β”‚   β”œβ”€β”€ cfg-if v1.0.0
    β”‚   β”‚   └── libc v0.2.140
    β”‚   β”œβ”€β”€ unicode-segmentation v1.10.1
    β”‚   β”œβ”€β”€ unicode-width v0.1.10
    β”‚   └── utf8parse v0.2.1
    β”œβ”€β”€ serde v1.0.159 (*)
    β”œβ”€β”€ serde_json v1.0.95 (*)
    β”œβ”€β”€ starlark_derive v0.9.0-pre (proc-macro) (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚   β”œβ”€β”€ dupe v0.8.1 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843) (*)
    β”‚   β”œβ”€β”€ gazebo v0.8.1 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843) (*)
    β”‚   β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚   β”œβ”€β”€ quote v1.0.26 (*)
    β”‚   └── syn v1.0.109 (*)
    β”œβ”€β”€ starlark_map v0.9.0-pre (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843)
    β”‚   β”œβ”€β”€ allocative v0.2.0 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843) (*)
    β”‚   β”œβ”€β”€ dupe v0.8.1 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843) (*)
    β”‚   β”œβ”€β”€ fnv v1.0.7
    β”‚   β”œβ”€β”€ gazebo v0.8.1 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843) (*)
    β”‚   └── hashbrown v0.12.3 (*)
    β”œβ”€β”€ static_assertions v1.1.0
    β”œβ”€β”€ strsim v0.10.0
    β”œβ”€β”€ textwrap v0.11.0
    β”‚   └── unicode-width v0.1.10
    β”œβ”€β”€ thiserror v1.0.40
    β”‚   └── thiserror-impl v1.0.40 (proc-macro)
    β”‚       β”œβ”€β”€ proc-macro2 v1.0.54 (*)
    β”‚       β”œβ”€β”€ quote v1.0.26 (*)
    β”‚       └── syn v2.0.11 (*)
    └── walkdir v2.3.3
        └── same-file v1.0.6
    [build-dependencies]
    └── lalrpop v0.19.9
        β”œβ”€β”€ ascii-canvas v3.0.0
        β”‚   └── term v0.7.0
        β”‚       └── dirs-next v2.0.0 (*)
        β”œβ”€β”€ bit-set v0.5.3
        β”‚   └── bit-vec v0.6.3
        β”œβ”€β”€ diff v0.1.13
        β”œβ”€β”€ ena v0.14.2
        β”‚   └── log v0.4.17 (*)
        β”œβ”€β”€ is-terminal v0.4.6 (*)
        β”œβ”€β”€ itertools v0.10.5
        β”‚   └── either v1.8.1
        β”œβ”€β”€ lalrpop-util v0.19.9
        β”‚   └── regex v1.7.3 (*)
        β”œβ”€β”€ petgraph v0.6.3
        β”‚   β”œβ”€β”€ fixedbitset v0.4.2
        β”‚   └── indexmap v1.9.3
        β”‚       └── hashbrown v0.12.3
        β”‚       [build-dependencies]
        β”‚       └── autocfg v1.1.0
        β”œβ”€β”€ pico-args v0.4.2
        β”œβ”€β”€ regex v1.7.3 (*)
        β”œβ”€β”€ regex-syntax v0.6.29
        β”œβ”€β”€ string_cache v0.8.7
        β”‚   β”œβ”€β”€ new_debug_unreachable v1.0.4
        β”‚   β”œβ”€β”€ once_cell v1.17.1
        β”‚   β”œβ”€β”€ parking_lot v0.12.1
        β”‚   β”‚   β”œβ”€β”€ lock_api v0.4.9
        β”‚   β”‚   β”‚   └── scopeguard v1.1.0
        β”‚   β”‚   β”‚   [build-dependencies]
        β”‚   β”‚   β”‚   └── autocfg v1.1.0
        β”‚   β”‚   └── parking_lot_core v0.9.7
        β”‚   β”‚       β”œβ”€β”€ cfg-if v1.0.0
        β”‚   β”‚       β”œβ”€β”€ libc v0.2.140
        β”‚   β”‚       └── smallvec v1.10.0
        β”‚   β”œβ”€β”€ phf_shared v0.10.0
        β”‚   β”‚   └── siphasher v0.3.10
        β”‚   └── precomputed-hash v0.1.1
        β”œβ”€β”€ term v0.7.0 (*)
        β”œβ”€β”€ tiny-keccak v2.0.2
        β”‚   └── crunchy v0.2.2
        └── unicode-xid v0.2.4

cargo tree output shows they are not the same: there are two versions: allocative v0.2.0 and allocative v0.2.0 (https://github.com/facebookexperimental/starlark-rust?rev=acf638430a00ca3855862e8c669670e1adaa42aa#acf63843).

To fix it, you need to tell Cargo to take allocative from starlark-rust repo.

(Also we should release new starlark-rust).

commented

Ah! Awesome thank you πŸ™‚

commented

Updated cargo file.
Old

[dependencies]
starlark = { git = "https://github.com/facebookexperimental/starlark-rust", rev = "acf638430a00ca3855862e8c669670e1adaa42aa" }
allocative = { version = "0.2" }
allocative_derive = { version = "0.2" }
anyhow = "1.0.65"

New

[dependencies]
starlark = { git = "https://github.com/facebookexperimental/starlark-rust", rev = "acf638430a00ca3855862e8c669670e1adaa42aa" }
allocative = { git = "https://github.com/facebookexperimental/starlark-rust", rev = "acf638430a00ca3855862e8c669670e1adaa42aa" }
allocative_derive = { git = "https://github.com/facebookexperimental/starlark-rust", rev = "acf638430a00ca3855862e8c669670e1adaa42aa" }
anyhow = "1.0.65"