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

write_string_fragment should take &str instead of &[u8] #268

Closed
dtolnay opened this issue Feb 28, 2017 · 3 comments
Closed

write_string_fragment should take &str instead of &[u8] #268

dtolnay opened this issue Feb 28, 2017 · 3 comments
Milestone

Comments

@dtolnay
Copy link
Member

dtolnay commented Feb 28, 2017

https://docs.serde.rs/serde_json/ser/trait.Formatter.html#method.write_string_fragment

rq is using unsafe to get a &str: https://github.com/dflemstr/rq/blob/v0.9.2/src/value/json.rs#L224

let s = unsafe { str::from_utf8_unchecked(fragment) };

It should be our responsibility to guarantee that the fragment is UTF-8.

cc @dflemstr

@dtolnay
Copy link
Member Author

dtolnay commented Feb 28, 2017

Frustratingly, it is such an easy fix: #269.

@dflemstr
Copy link
Contributor

I approve of this 👍

@dtolnay dtolnay added this to the v1.0 milestone Apr 11, 2017
@dtolnay
Copy link
Member Author

dtolnay commented Apr 11, 2017

Fixed in #297.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants