@@ -253,7 +253,7 @@ unsafe fn get_buffer(
253253 // We only create an immutable ref from this pointer.
254254 let metadata_ptr = unsafe { allocator. fixed_size_metadata_ptr ( ) } ;
255255 // SAFETY: Fixed-size allocators always have a valid `FixedSizeAllocatorMetadata`
256- // stored at the pointer returned by `Allocator::fixed_size_metadata_ptr`.
256+ // stored at the pointer returned by `Allocator::fixed_size_metadata_ptr`
257257 let metadata = unsafe { metadata_ptr. as_ref ( ) } ;
258258
259259 let buffer_id = metadata. id ;
@@ -270,12 +270,9 @@ unsafe fn get_buffer(
270270 // Buffer has not already been sent to JS. Send it.
271271
272272 // Get pointer to start of allocator chunk.
273- // Note: `Allocator::data_ptr` would not provide the right pointer, because source text
274- // gets written to start of the allocator chunk, and `data_ptr` gets moved to after it.
275- // SAFETY: Fixed-size allocators have their chunk aligned on `BLOCK_ALIGN`,
276- // and size less than `BLOCK_ALIGN`. So we can get pointer to start of `Allocator` chunk
277- // by rounding down to next multiple of `BLOCK_ALIGN`. That can't go out of bounds of
278- // the backing allocation.
273+ // SAFETY: Fixed-size allocators have their chunk aligned on `BLOCK_ALIGN`, and size less than `BLOCK_ALIGN`.
274+ // So we can get pointer to start of `Allocator` chunk by rounding down to next multiple of `BLOCK_ALIGN`.
275+ // That can't go out of bounds of the backing allocation.
279276 let chunk_ptr = unsafe {
280277 let ptr = metadata_ptr. cast :: < u8 > ( ) ;
281278 let offset = ptr. addr ( ) . get ( ) % BLOCK_ALIGN ;
@@ -288,13 +285,12 @@ unsafe fn get_buffer(
288285 //
289286 // We can't prove that no mutable references to data in the buffer exist,
290287 // but there shouldn't be any, because linter doesn't mutate the AST.
291- // Anyway, I (@overlookmotel) am not sure if the aliasing rules apply to code in another
292- // language. Probably not, as JS code is outside the domain of the "Rust abstract machine".
288+ // Anyway, I (@overlookmotel) am not sure if the aliasing rules apply to code in another language.
289+ // Probably not, as JS code is outside the domain of the "Rust abstract machine".
293290 // As long as we don't mutate data in the buffer on JS side, it should be fine.
294291 //
295- // On the other side, while many immutable references to data in the buffer exist
296- // (`AstKind`s for every AST node), JS side does not mutate the data in the buffer,
297- // so that shouldn't break the guarantees of `&` references.
292+ // On the other side, while many immutable references to data in the buffer exist (`AstKind`s for every AST node),
293+ // JS side does not mutate the data in the buffer, so that shouldn't break the guarantees of `&` references.
298294 //
299295 // This is all a bit wavy, but such is the way with sharing memory outside of Rust.
300296 //
0 commit comments