mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #118390 - cuviper:beta-next, r=cuviper
[beta] backports - feat: implement `DoubleEndedSearcher` for `CharArray[Ref]Searcher` #111922 - Update to LLVM 17.0.5 #117907 - clarify `fn discriminant` guarantees: only free lifetimes may get erased #118006 r? ghost
This commit is contained in:
@@ -1132,10 +1132,12 @@ fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
///
|
||||
/// [Reference]: ../../reference/items/enumerations.html#custom-discriminant-values-for-fieldless-enumerations
|
||||
///
|
||||
/// The value of a [`Discriminant<T>`] is independent of any *lifetimes* in `T`. As such, reading
|
||||
/// or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via [`transmute`] or
|
||||
/// otherwise) is always sound. Note that this is **not** true for other kinds of generic
|
||||
/// parameters; `Discriminant<Foo<A>>` and `Discriminant<Foo<B>>` might be incompatible.
|
||||
/// The value of a [`Discriminant<T>`] is independent of any *free lifetimes* in `T`. As such,
|
||||
/// reading or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via
|
||||
/// [`transmute`] or otherwise) is always sound. Note that this is **not** true for other kinds
|
||||
/// of generic parameters and for higher-ranked lifetimes; `Discriminant<Foo<A>>` and
|
||||
/// `Discriminant<Foo<B>>` as well as `Discriminant<Bar<dyn for<'a> Trait<'a>>>` and
|
||||
/// `Discriminant<Bar<dyn Trait<'static>>>` may be incompatible.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
||||
@@ -806,6 +806,8 @@ unsafe impl<'a, const N: usize> ReverseSearcher<'a> for CharArraySearcher<'a, N>
|
||||
searcher_methods!(reverse);
|
||||
}
|
||||
|
||||
impl<'a, const N: usize> DoubleEndedSearcher<'a> for CharArraySearcher<'a, N> {}
|
||||
|
||||
/// Searches for chars that are equal to any of the [`char`]s in the array.
|
||||
///
|
||||
/// # Examples
|
||||
@@ -826,6 +828,8 @@ unsafe impl<'a, 'b, const N: usize> ReverseSearcher<'a> for CharArrayRefSearcher
|
||||
searcher_methods!(reverse);
|
||||
}
|
||||
|
||||
impl<'a, 'b, const N: usize> DoubleEndedSearcher<'a> for CharArrayRefSearcher<'a, 'b, N> {}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Impl for &[char]
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+1
-1
Submodule src/llvm-project updated: fef3d7b14e...7738295178
Reference in New Issue
Block a user