Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert Buf::as_str safety change from PR 2319 #2329

Merged
merged 3 commits into from Nov 28, 2022
Merged

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Nov 28, 2022

Per #2319 (review), the API enforces that the caller only wrote UTF-8 into the buffer.

This PR includes the 2 commits from #2319.

erickt and others added 3 commits November 9, 2022 22:40
serde::de::format::Buf is a private type, so this makes it explicit by
declaring the type `pub(super)`. In addition, it marks the function
`Buf::as_str` as unsafe, which lets us document the callsites with
`// Safety: ...` comments to explain why it is safe to use.
This changes a comment to be explicit on how it's safe we can avoid
validating UTF-8.
@dtolnay dtolnay merged commit fabbd2b into serde-rs:master Nov 28, 2022
@dtolnay dtolnay deleted the safety branch November 28, 2022 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants