fix(rust): use core crates for no_std#4303
Conversation
|
I tried applying your patch locally but still got a compile error related to the It looks like locking the call to diff --git a/lib/binding_rust/lib.rs b/lib/binding_rust/lib.rs
index 62839d9b..8577fb1d 100644
--- a/lib/binding_rust/lib.rs
+++ b/lib/binding_rust/lib.rs
@@ -1432,7 +1432,10 @@ impl Parser {
impl Drop for Parser {
fn drop(&mut self) {
- self.stop_printing_dot_graphs();
+ #[cfg(feature = "std")]
+ {
+ self.stop_printing_dot_graphs();
+ }
self.set_logger(None);
unsafe { ffi::ts_parser_delete(self.0.as_ptr()) }
}
A new test case would be welcome, but could also be taken care of in a followup. |
I would strongly encourage adding a test now. Otherwise it'll likely never happen and things can easily backslide. (In fact, I would always start with the test so you know which changes to make to have it work.) |
|
I've pushed the above fix for the call to stop_printing_dot_graphs, thanks for that - however I'm unsure of how go about setting up the no_std test case. The repo has a Dockerfile set up to test with Just looking for some direction on how this should be acheived, cheers! |
|
- name: Check no_std
if: ${{ !matrix.no-run && inputs.run-test }}
run: |
cd ..
cargo new no_std_check
cd no_std_check
echo "tree-sitter = { path = \"../tree-sitter/lib/\", default-features = false, features = [] }" >> Cargo.toml
cargo buildCC @ObserverOfTime? |
|
What about |
That succeeds when it's run from the root directory, but fails with the expected errors when I run it inside @Tiggilyboo do you mind adding the CI changes, or would you prefer for me to push to your branch? |
|
Sorry for the delay, I've added the build check in the workflow. Let me know if anything looks off |
WillLillis
left a comment
There was a problem hiding this comment.
Besides the extra empty line, everything LGTM. Thanks!
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
|
Git push to origin failed for release-0.25 with exitcode 1 |
Fixes #4302
Adds a feature flag to the binding lib, used core where possible. Maybe worth a no_std test case?