about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/write.rs
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2020-10-12 15:52:46 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2020-12-27 00:50:46 +0000
commit274e2993cbbfe7182ff6b79064addf171cf5a5aa (patch)
treef042c71f96fa3b3f8f337642b08c437cd04265bd /compiler/rustc_codegen_llvm/src/back/write.rs
parent0b644e419681835bd0f5871c3bfbd648aa04f157 (diff)
downloadrust-274e2993cbbfe7182ff6b79064addf171cf5a5aa.tar.gz
rust-274e2993cbbfe7182ff6b79064addf171cf5a5aa.zip
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>
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
0 files changed, 0 insertions, 0 deletions