Skip to content

Fix regression in implicit casting from integer -> string#304

Merged
IsaacWoods merged 1 commit into
rust-osdev:mainfrom
IsaacWoods:main
May 29, 2026
Merged

Fix regression in implicit casting from integer -> string#304
IsaacWoods merged 1 commit into
rust-osdev:mainfrom
IsaacWoods:main

Conversation

@IsaacWoods
Copy link
Copy Markdown
Member

Looks like the recent work with implicit conversions / object comparison introduced a regression in the uACPI implicit_case_semantics test.

Modelling AML strings in Rust is tricky; conversion from byte slices with String::from_utf8_lossy keeps trailing null bytes - this is likely fine in C because of how string comparisons would work, but trips up comparison in Rust's String (and CString cannot have multiple trailing null bytes).

This fixes that by stripping trailing nul bytes entirely when converting integers/buffers to strings. It may be that the correct place to fix this holistically is rather in the object comparsion, but this seems like a reasonable step given the current failing case.

Modelling AML strings in Rust is tricky; conversion from integers with
`String::from_utf8_lossy` keeps trailing null bytes - this is likely fine
in C because of how string comparisons would work, but trips up comparison
in Rust's `String` (and `CString` cannot have multiple trailing null bytes).
This fixes a regression in uACPI's implicit_case_semantics by removing
trailing null bytes when doing an integer -> string conversion.

It may be that the correct place to fix this holistically is rather in the
object comparsion, but this seems like a reasonable step given the current
failing case.
@IsaacWoods IsaacWoods merged commit 86f4561 into rust-osdev:main May 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant