Skip to content

Commit bd45872

Browse files
committed
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
2 parents b66b795 + 271143a commit bd45872

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

library/core/src/mem/mod.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1132,10 +1132,12 @@ impl<T> fmt::Debug for Discriminant<T> {
11321132
///
11331133
/// [Reference]: ../../reference/items/enumerations.html#custom-discriminant-values-for-fieldless-enumerations
11341134
///
1135-
/// The value of a [`Discriminant<T>`] is independent of any *lifetimes* in `T`. As such, reading
1136-
/// or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via [`transmute`] or
1137-
/// otherwise) is always sound. Note that this is **not** true for other kinds of generic
1138-
/// parameters; `Discriminant<Foo<A>>` and `Discriminant<Foo<B>>` might be incompatible.
1135+
/// The value of a [`Discriminant<T>`] is independent of any *free lifetimes* in `T`. As such,
1136+
/// reading or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via
1137+
/// [`transmute`] or otherwise) is always sound. Note that this is **not** true for other kinds
1138+
/// of generic parameters and for higher-ranked lifetimes; `Discriminant<Foo<A>>` and
1139+
/// `Discriminant<Foo<B>>` as well as `Discriminant<Bar<dyn for<'a> Trait<'a>>>` and
1140+
/// `Discriminant<Bar<dyn Trait<'static>>>` may be incompatible.
11391141
///
11401142
/// # Examples
11411143
///

library/core/src/str/pattern.rs

+4
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,8 @@ unsafe impl<'a, const N: usize> ReverseSearcher<'a> for CharArraySearcher<'a, N>
806806
searcher_methods!(reverse);
807807
}
808808

809+
impl<'a, const N: usize> DoubleEndedSearcher<'a> for CharArraySearcher<'a, N> {}
810+
809811
/// Searches for chars that are equal to any of the [`char`]s in the array.
810812
///
811813
/// # Examples
@@ -826,6 +828,8 @@ unsafe impl<'a, 'b, const N: usize> ReverseSearcher<'a> for CharArrayRefSearcher
826828
searcher_methods!(reverse);
827829
}
828830

831+
impl<'a, 'b, const N: usize> DoubleEndedSearcher<'a> for CharArrayRefSearcher<'a, 'b, N> {}
832+
829833
/////////////////////////////////////////////////////////////////////////////
830834
// Impl for &[char]
831835
/////////////////////////////////////////////////////////////////////////////

src/llvm-project

Submodule llvm-project updated 55 files

0 commit comments

Comments
 (0)