Commit graph

11 commits

Author SHA1 Message Date
Amaan Qureshi
28bb2a8c1c
chore(lib): apply clippy fixes 2024-02-04 04:18:59 -05:00
Andrew Hlynskyi
67a5dbdd93 fix: dealloc calls on zero pointers 2023-09-03 06:53:18 +03:00
Max Brunsfeld
622359b400 Simplify allocation-recording in test suite using new ts_set_allocator API 2021-12-30 16:09:07 -08:00
Douglas Creager
a29c8d9264 Move allocation tracking into lib crate
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
2021-02-23 09:16:37 -05:00
Max Brunsfeld
b661050a61 Simplify setup for enabling/disabling allocation recording in the C lib 2020-12-02 15:35:13 -08:00
Max Brunsfeld
7aca288330 Move LossyUtf8 struct out of util module 2020-10-14 11:59:56 -07:00
Max Brunsfeld
0a46033391 Remove duplication of LossyUtf8 helper 2020-10-14 11:35:50 -07:00
Max Brunsfeld
b4a2f4ed60 Fix debug/release conditional compilation flags for free() 2019-11-15 10:09:22 -08:00
Max Brunsfeld
967da88371 Avoid unnecessary recompiles between debug & test builds
This makes development much quicker when switching back and forth
between compiling with RLS while editing and running tests with
`cargo test`.
2019-11-14 13:34:25 -08:00
Tuấn-Anh Nguyễn
f0999d7ac0 Make Rust functions return ExactSizeIterator instead of just Iterator (#438)
* Add CBufferIter::size_hint

* Make Rust functions return ExactSizeIterator instead of just Iterator

* Fix wrong CBufferIter::size_hint
2019-08-28 09:28:47 -07:00
Tuấn-Anh Nguyễn
d96ba09391 Make Tree::changed_ranges return an Iterator instead of a Vec (#437)
* Make Tree::changed_ranges return an Iterator instead of a Vec

* Remove CBufferIter.free parameter
2019-08-26 19:36:16 -07:00