We have several test cases defined in the `cli` crate that depend on the `lib` crate's `allocation-tracking` feature. The implementation of the actual allocation tracker used to live in the `cli` crate, close to the test cases that use it. The `allocation-tracking` feature in the `lib` crate was just used to tell the tree-sitter implementation to expect that the allocation tracker exists, and to use it. That pattern meant that we had a circular dependency: `cli` depends on `lib`, but `lib` required some code that was implemented in `cli`. That, in turn, caused linker errors — but only when compiling in certain configurations! [1] This patch moves all of the allocation tracking implementation into the `lib` crate, gated on the existing `allocation-tracking` feature, which fixes the circular dependency. Note that this patch does **not** fix the fact that feature unification causes the `lib` crate to be built with the `allocation-tracking` feature enabled, even though it's not a default. Fixing that depends on the forthcoming version 2 feature resolver [2], or using the `dev_dep` workaround [3] in the meantime. [1] https://github.com/tree-sitter/tree-sitter/issues/919 [2] https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2 [3] https://github.com/tree-sitter/tree-sitter/issues/919#issuecomment-777107086
38 lines
946 B
TOML
38 lines
946 B
TOML
[package]
|
|
name = "tree-sitter"
|
|
description = "Rust bindings to the Tree-sitter parsing library"
|
|
version = "0.17.1"
|
|
authors = ["Max Brunsfeld <maxbrunsfeld@gmail.com>"]
|
|
edition = "2018"
|
|
license = "MIT"
|
|
readme = "binding_rust/README.md"
|
|
keywords = ["incremental", "parsing"]
|
|
categories = ["api-bindings", "parsing", "text-editors"]
|
|
repository = "https://github.com/tree-sitter/tree-sitter"
|
|
|
|
build = "binding_rust/build.rs"
|
|
|
|
include = [
|
|
"/binding_rust/*",
|
|
"/Cargo.toml",
|
|
"/include/*",
|
|
"/src/*.h",
|
|
"/src/*.c",
|
|
"/src/unicode/*",
|
|
]
|
|
|
|
[dependencies]
|
|
lazy_static = { version="1.2.0", optional=true }
|
|
regex = "1"
|
|
spin = { version="0.5", optional=true }
|
|
|
|
[build-dependencies]
|
|
cc = "^1.0.58"
|
|
|
|
[lib]
|
|
path = "binding_rust/lib.rs"
|
|
|
|
# This feature is only useful for testing the Tree-sitter library itself.
|
|
# It is exposed because all of Tree-sitter's tests live in the Tree-sitter CLI crate.
|
|
[features]
|
|
allocation-tracking = ["lazy_static", "spin"]
|