about summary refs log tree commit diff
path: root/tests/codegen/patchable-function-entry/patchable-function-entry-one-flag.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-09-23 06:45:32 +0200
committerGitHub <noreply@github.com>2024-09-23 06:45:32 +0200
commit510fc3432eb3e61f0bae766ddca720052a99aa6a (patch)
tree4a69aeebfd71151657a7d322f77d0f685c6a0f89 /tests/codegen/patchable-function-entry/patchable-function-entry-one-flag.rs
parent66b0b29e65c77e5801c308e725a233c0728df300 (diff)
parent3dcb5a39622fe705647ea0764a355a10b6913832 (diff)
downloadrust-510fc3432eb3e61f0bae766ddca720052a99aa6a.tar.gz
rust-510fc3432eb3e61f0bae766ddca720052a99aa6a.zip
Rollup merge of #129550 - kornelski:boxasstr, r=joshtriplett,dtolnay
Add str.as_str() for easy Deref to string slices

Working with `Box<str>` is cumbersome, because in places like `iter.filter()` it can end up being `&Box<str>` or even `&&Box<str>`, and such type doesn't always get auto-dereferenced as expected.

Dereferencing such box to `&str` requires ugly syntax like `&**boxed_str` or `&***boxed_str`, with the exact amount of `*`s.

`Box<str>` is [not easily comparable with other string types](https://github.com/rust-lang/rust/pull/129852) via `PartialEq`. `Box<str>` won't work for lookups in types like `HashSet<String>`, because `Borrow<String>` won't take types like `&Box<str>`. OTOH `set.contains(s.as_str())` works nicely regardless of levels of indirection.

`String` has a simple solution for this: the `as_str()` method, and `Box<str>` should too.
Diffstat (limited to 'tests/codegen/patchable-function-entry/patchable-function-entry-one-flag.rs')
0 files changed, 0 insertions, 0 deletions