rust/library
Matthias Krüger 510fc3432e
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.
2024-09-23 06:45:32 +02:00
..
alloc Rollup merge of #129550 - kornelski:boxasstr, r=joshtriplett,dtolnay 2024-09-23 06:45:32 +02:00
backtrace@230570f2da Try latest backtrace 2024-08-29 12:13:19 -07:00
core Rollup merge of #129550 - kornelski:boxasstr, r=joshtriplett,dtolnay 2024-09-23 06:45:32 +02:00
panic_abort step cfg(bootstrap) 2024-07-28 14:46:29 -04:00
panic_unwind Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
portable-simd simd_shuffle: require index argument to be a vector 2024-09-14 14:43:24 +02:00
proc_macro Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
profiler_builtins Don't skip nonexistent source files 2024-08-27 17:30:42 +10:00
rtstartup Let InstCombine remove Clone shims inside Clone shims 2024-07-25 15:14:42 -04:00
rustc-std-workspace-alloc Replace libstd, libcore, liballoc in line comments. 2022-12-30 14:00:42 +01:00
rustc-std-workspace-core
rustc-std-workspace-std
std Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
stdarch@ace72223a0 update stdarch 2024-09-11 08:35:32 +02:00
sysroot Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35 2024-07-29 07:41:33 +00:00
test Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
unwind Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
windows_targets Win: Add dbghelp to the list of import libraries 2024-09-06 21:21:49 +00:00
Cargo.lock Update compiler-builtins to 0.1.125 2024-09-05 09:31:17 -07:00
Cargo.toml Auto merge of #129063 - the8472:cold-opt-size, r=Amanieu 2024-09-02 00:58:50 +00:00