build(rust): bump the lib's MSRV to 1.76

This commit is contained in:
Amaan Qureshi 2025-01-12 04:06:59 -05:00
parent 52ef2992aa
commit 26d4b19006
3 changed files with 7 additions and 5 deletions

View file

@ -4,7 +4,7 @@ version.workspace = true
description = "Rust bindings to the Tree-sitter parsing library"
authors.workspace = true
edition.workspace = true
rust-version = "1.65"
rust-version = "1.76"
readme = "binding_rust/README.md"
homepage.workspace = true
repository.workspace = true

View file

@ -121,7 +121,7 @@ pub struct ParseState(NonNull<ffi::TSParseState>);
impl ParseState {
#[must_use]
pub fn current_byte_offset(&self) -> usize {
pub const fn current_byte_offset(&self) -> usize {
unsafe { self.0.as_ref() }.current_byte_offset as usize
}
}
@ -132,7 +132,7 @@ pub struct QueryCursorState(NonNull<ffi::TSQueryCursorState>);
impl QueryCursorState {
#[must_use]
pub fn current_byte_offset(&self) -> usize {
pub const fn current_byte_offset(&self) -> usize {
unsafe { self.0.as_ref() }.current_byte_offset as usize
}
}
@ -1371,7 +1371,7 @@ impl Parser {
if let Some(flag) = flag {
ffi::ts_parser_set_cancellation_flag(
self.0.as_ptr(),
(flag as *const AtomicUsize).cast::<usize>(),
std::ptr::from_ref::<AtomicUsize>(flag).cast::<usize>(),
);
} else {
ffi::ts_parser_set_cancellation_flag(self.0.as_ptr(), ptr::null());

View file

@ -45,7 +45,9 @@ impl WasmStore {
unsafe {
let mut error = MaybeUninit::<ffi::TSWasmError>::uninit();
let store = ffi::ts_wasm_store_new(
(engine as *const wasmtime::Engine).cast_mut().cast(),
std::ptr::from_ref::<wasmtime::Engine>(engine)
.cast_mut()
.cast(),
error.as_mut_ptr(),
);
if store.is_null() {