1
Fork 0

Rollup merge of #138821 - dianne:cleanup-non-scalar-compare, r=oli-obk

match lowering cleanup: remove unused unsizing logic from `non_scalar_compare`

Since array and slice constants are now translated to array and slice patterns, `non_scalar_compare` is only used for string comparisons. This specializes it to strings, renames it, and removes the unused array-unsizing logic.

This also updates the doc comments for  `thir::PatKind::Constant` and `TestKind::Eq`, which referred to them being used for slice references.

r? ````@oli-obk````
This commit is contained in:
Matthias Krüger 2025-03-24 20:40:08 +01:00 committed by GitHub
commit dfd83be4da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 94 deletions

View file

@ -800,9 +800,9 @@ pub enum PatKind<'tcx> {
},
/// One of the following:
/// * `&str`/`&[u8]` (represented as a valtree), which will be handled as a string/slice pattern
/// and thus exhaustiveness checking will detect if you use the same string/slice twice in
/// different patterns.
/// * `&str` (represented as a valtree), which will be handled as a string pattern and thus
/// exhaustiveness checking will detect if you use the same string twice in different
/// patterns.
/// * integer, bool, char or float (represented as a valtree), which will be handled by
/// exhaustiveness to cover exactly its own value, similar to `&str`, but these values are
/// much simpler.