-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
str api should offer a method to convert a &u8
slice into an &str
with same lifetime
#5422
Labels
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
Comments
Isn't this an unsafe operation? Not all &u8 are valid &str. |
I presumed there'd be an assertion as well as an unsafe variant, as we have for |
@nikomatsakis Could you confirm the PR request did add what was wanted in this issue? I remembered that there where some difficulties to make it work because a &str slice has to cover one byte more than a &[]. |
Looks good, thanks. |
oli-obk
pushed a commit
to oli-obk/rust
that referenced
this issue
May 2, 2020
…lip1995 CONTRIBUTING.md: fix broken triage link Fixes rust-lang#5421
oli-obk
pushed a commit
to oli-obk/rust
that referenced
this issue
May 2, 2020
Rollup of 11 pull requests Successful merges: - rust-lang#5406 (Fix update_lints) - rust-lang#5409 (Downgrade let_unit_value to pedantic) - rust-lang#5410 (Downgrade trivially_copy_pass_by_ref to pedantic) - rust-lang#5412 (Downgrade inefficient_to_string to pedantic) - rust-lang#5415 (Add new lint for `Result<T, E>.map_or(None, Some(T))`) - rust-lang#5417 (Update doc links and mentioned names in docs) - rust-lang#5419 (Downgrade unreadable_literal to pedantic) - rust-lang#5420 (Downgrade new_ret_no_self to pedantic) - rust-lang#5422 (CONTRIBUTING.md: fix broken triage link) - rust-lang#5424 (Incorrect suspicious_op_assign_impl) - rust-lang#5425 (Ehance opt_as_ref_deref lint.) Failed merges: - rust-lang#5345 (Add lint for float in array comparison) - rust-lang#5411 (Downgrade implicit_hasher to pedantic) - rust-lang#5428 (Move cognitive_complexity to nursery) r? @ghost changelog: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since strs and vecs share the same representation, there should be a way to "cast" a
&u8
slice into an&str
with the same lifetime.There are a few FIXMEs in tydecode where this could save a copy.
The text was updated successfully, but these errors were encountered: