You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since feat(loader): replace usage nm with object crate #5252 is a no-go, we should at least warn users when building on Windows that we can't verify the symbols of their built parsers. This warning will print every time tree-sitter b is run on Windows, but I think that's better than potentially silently failing.
I missed this while testing feat: dynamically expose queries in bindings #4955, but since the path separator on Windows is \, this gets treated as an escape slash when in a grammar's rust bindings files, causing a build failure. The unix / works for both platforms (at least where we're placing those paths in lib.rs and build.rs), so it's easiest to just go with that.
Build failure with a newly init`'d grammar's rust bindings on 0.26.3:
C:\Users\willl\source\repos\ts_test>cargo build
Updating crates.io index
Locking 24 packages to latest compatible versions
Compiling find-msvc-tools v0.1.8
Compiling tree-sitter-language v0.1.6
Compiling shlex v1.3.0
Compiling cc v1.2.54
Compiling tree-sitter-ts-test v0.1.0 (C:\Users\willl\source\repos\ts_test)
error: unknown character escape: `h`
--> bindings\rust\build.rs:41:18
|
41 | if !"queries\highlights.scm".is_empty() && std::path::Path::new("queries\highlights.scm").exists() {
| ^ unknown character escape
|
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
41 | if !r"queries\highlights.scm".is_empty() && std::path::Path::new("queries\highlights.scm").exists() {
| +
error: unknown character escape: `h`
--> bindings\rust\build.rs:41:78
|
41 | if !"queries\highlights.scm".is_empty() && std::path::Path::new("queries\highlights.scm").exists() {
| ^ unknown character escape
|
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
41 | if !"queries\highlights.scm".is_empty() && std::path::Path::new(r"queries\highlights.scm").exists() {
| +
error: unknown character escape: `i`
--> bindings\rust\build.rs:45:18
|
45 | if !"queries\injections.scm".is_empty() && std::path::Path::new("queries\injections.scm").exists() {
| ^ unknown character escape
|
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
45 | if !r"queries\injections.scm".is_empty() && std::path::Path::new("queries\injections.scm").exists() {
| +
error: unknown character escape: `i`
--> bindings\rust\build.rs:45:78
|
45 | if !"queries\injections.scm".is_empty() && std::path::Path::new("queries\injections.scm").exists() {
| ^ unknown character escape
|
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
45 | if !"queries\injections.scm".is_empty() && std::path::Path::new(r"queries\injections.scm").exists() {
| +
error: unknown character escape: `l`
--> bindings\rust\build.rs:49:18
|
49 | if !"queries\locals.scm".is_empty() && std::path::Path::new("queries\locals.scm").exists() {
| ^ unknown character escape
|
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
49 | if !r"queries\locals.scm".is_empty() && std::path::Path::new("queries\locals.scm").exists() {
| +
error: unknown character escape: `l`
--> bindings\rust\build.rs:49:74
|
49 | if !"queries\locals.scm".is_empty() && std::path::Path::new("queries\locals.scm").exists() {
| ^ unknown character escape
|
= help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals>
help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal
|
49 | if !"queries\locals.scm".is_empty() && std::path::Path::new(r"queries\locals.scm").exists() {
| +
error: could not compile `tree-sitter-ts-test` (build script) due to 6 previous errors
Address a new nightly lint
WillLillis
changed the title
fix(cli): warn user when library symbols can't be checked on Windows
misc Windows fixes
Jan 25, 2026
Also, I think these fixes should be separate PRs so we can backport them individually (and quickly; I'd like to get a 0.26.4 out with the array fixes asap).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three separate changes:
Since feat(loader): replace usagenmwithobjectcrate #5252 is a no-go, we should at least warn users when building on Windows that we can't verify the symbols of their built parsers. This warning will print every timetree-sitter bis run on Windows, but I think that's better than potentially silently failing.\, this gets treated as an escape slash when in a grammar's rust bindings files, causing a build failure. The unix/works for both platforms (at least where we're placing those paths inlib.rsandbuild.rs), so it's easiest to just go with that.Build failure with a newly init`'d grammar's rust bindings on 0.26.3: