rust/library/std/src
Ian Jackson 274e2993cb Stablize slice::strip_prefix and strip_suffix, with SlicePattern
We hope later to extend `core::str::Pattern` to slices too, perhaps as
part of stabilising that.  We want to minimise the amount of type
inference breakage when we do that, so we don't want to stabilise
strip_prefix and strip_suffix taking a simple `&[T]`.

@KodrAus suggested the approach of introducing a new perma-unstable
trait, which reduces this future inference break risk.

I found it necessary to make two impls of this trait, as the unsize
coercion don't apply when hunting for trait implementations.

Since SlicePattern's only method returns a reference, and the whole
trait is just a wrapper for slices, I made the trait type be the
non-reference type [T] or [T;N] rather than the reference.  Otherwise
the trait would have a lifetime parameter.

I marked both the no-op conversion functions `#[inline]`.  I'm not
sure if that is necessary but it seemed at the very least harmless.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-12-27 00:50:46 +00:00
..
backtrace Add column number support to Backtrace 2020-11-15 13:09:56 +01:00
collections Rollup merge of #78083 - ChaiTRex:master, r=m-ou-se 2020-12-19 15:15:57 +09:00
env std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
error std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
f32 std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
f64 std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
ffi Auto merge of #78833 - CDirkx:parse_prefix, r=dtolnay 2020-12-16 00:47:50 +00:00
fs std: Fix test got_symlink_permission on Windows 2020-11-16 21:09:26 +03:00
io Auto merge of #77801 - fusion-engineering-forks:pin-mutex, r=Mark-Simulacrum 2020-12-10 23:43:20 +00:00
lazy std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
memchr std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
net Auto merge of #79342 - CDirkx:ipaddr-const, r=oli-obk 2020-12-19 13:13:41 +00:00
num rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
os Take sys/vxworks/{fd,fs,io} from sys/unix instead. 2020-10-16 06:19:00 +02:00
panic review: fix nits and move panic safety tests to the correct place 2020-09-25 23:10:24 +02:00
path Refactor parse_prefix on Windows 2020-11-07 16:15:48 +01:00
prelude Edit formatting in Rust Prelude docs 2020-12-17 21:22:58 -08:00
process std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
sync Fix documentation typo 2020-12-22 12:19:46 +01:00
sys Update library/std/src/sys/windows/thread_parker.rs 2020-12-22 12:33:11 +01:00
sys_common Migrate standard library away from compare_and_swap 2020-12-22 12:19:46 +01:00
thread Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
time Duration::zero() -> Duration::ZERO 2020-10-21 20:44:03 -07:00
alloc.rs Add missing punctuation to std::alloc docs 2020-12-17 21:49:32 -08:00
ascii.rs Convert many files to intra-doc links 2020-09-02 17:37:40 -04:00
backtrace.rs Add column number support to Backtrace 2020-11-15 13:09:56 +01:00
env.rs Improve docs for std::env::args() 2020-09-04 14:00:09 -07:00
error.rs Rename LayoutErr to LayoutError outside of core 2020-10-08 00:40:10 -04:00
f32.rs Auto merge of #79473 - m-ou-se:clamp-in-core, r=m-ou-se 2020-12-19 21:57:38 +00:00
f64.rs Auto merge of #79473 - m-ou-se:clamp-in-core, r=m-ou-se 2020-12-19 21:57:38 +00:00
fs.rs Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
future.rs Fix stabilization marker for future_readiness_fns 2020-09-15 23:12:08 +02:00
keyword_docs.rs Rollup merge of #79211 - yoshuawuyts:future-doc-alias, r=Mark-Simulacrum 2020-12-19 15:16:01 +09:00
lazy.rs Add (internal-only) SyncOnceCell::get_or_init_pin. 2020-12-08 22:57:50 +01:00
lib.rs Stablize slice::strip_prefix and strip_suffix, with SlicePattern 2020-12-27 00:50:46 +00:00
macros.rs Use ? in core/std macros 2020-10-26 07:15:37 +09:00
memchr.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
num.rs std: move "mod tests/benches" to separate files 2020-08-31 02:56:59 +00:00
panic.rs Add tracking issue number for panic_any. 2020-10-28 21:23:45 +01:00
panicking.rs Merge set_panic and set_print into set_output_capture. 2020-11-10 21:58:13 +01:00
path.rs Clean up intra-doc links in std::path 2020-10-27 20:54:30 -07:00
primitive_docs.rs Rollup merge of #80159 - jyn514:array, r=m-ou-se 2020-12-21 02:47:33 +01:00
process.rs Auto merge of #78439 - lzutao:rm-clouldabi, r=Mark-Simulacrum 2020-11-23 19:01:19 +00:00
rt.rs Prevent __rust_begin_short_backtrace frames from being tail-call optimised away 2020-08-07 19:31:25 +01:00
time.rs Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00