refactor(parser): mark ByteHandlers unsafe (#2212)

All the ASCII `ByteHandler`s are unsafe to call. I forgot to mark them
as unsafe when making that change.

This PR fixes that, and will make it harder for someone to accidentally
call one of them without considering the safety invariants.
This commit is contained in:
overlookmotel 2024-01-30 04:23:35 +00:00 committed by GitHub
parent 20679d1e1e
commit 51ac392ae4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1292,7 +1292,7 @@ unsafe fn handle_byte(byte: u8, lexer: &mut Lexer) -> Kind {
BYTE_HANDLERS[byte as usize](lexer) BYTE_HANDLERS[byte as usize](lexer)
} }
type ByteHandler = fn(&mut Lexer<'_>) -> Kind; type ByteHandler = unsafe fn(&mut Lexer<'_>) -> Kind;
/// Lookup table mapping any incoming byte to a handler function defined below. /// Lookup table mapping any incoming byte to a handler function defined below.
/// <https://github.com/ratel-rust/ratel-core/blob/master/ratel/src/lexer/mod.rs> /// <https://github.com/ratel-rust/ratel-core/blob/master/ratel/src/lexer/mod.rs>