diff options
| author | Ralf Jung <post@ralfj.de> | 2024-07-13 18:03:05 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-07-18 11:58:16 +0200 |
| commit | 86ce911f90d9498b33738655c8cfed2f637c335a (patch) | |
| tree | 6bff3cc5cda91533e2f7641c5de56291842432ba /compiler/rustc_middle | |
| parent | e613bc92a12c176d0e206b2f83b1bae8011e90c1 (diff) | |
| download | rust-86ce911f90d9498b33738655c8cfed2f637c335a.tar.gz rust-86ce911f90d9498b33738655c8cfed2f637c335a.zip | |
pattern lowering: make sure we never call user-defined PartialEq instances
Diffstat (limited to 'compiler/rustc_middle')
| -rw-r--r-- | compiler/rustc_middle/src/thir.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs index c97af68c29e..b80d00719ee 100644 --- a/compiler/rustc_middle/src/thir.rs +++ b/compiler/rustc_middle/src/thir.rs @@ -783,16 +783,13 @@ pub enum PatKind<'tcx> { }, /// One of the following: - /// * `&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. + /// * `&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. /// * 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. - /// * Opaque constants (represented as `mir::ConstValue`), that must not be matched - /// structurally. So anything that does not derive `PartialEq` and `Eq`. - /// - /// These are always compared with the matched place using (the semantics of) `PartialEq`. + /// * `String`, if `string_deref_patterns` is enabled. Constant { value: mir::Const<'tcx>, }, |
