rust/tests/ui/rfcs
Esteban Küber d136b3108d Add more context to fall-through "const pattern of non-structural type" error
Point at types that need to be marked with `#[derive(PartialEq)]`.

We use a visitor to look at a type that isn't structural, looking for all ADTs that don't derive `PartialEq`. These can either be manual `impl PartialEq`s or no `impl` at all, so we differentiate between those two cases to provide more context to the user. We also only point at types and impls from the local crate, otherwise show only a note.

```
error: constant of non-structural type `&[B]` in a pattern
  --> $DIR/issue-61188-match-slice-forbidden-without-eq.rs:15:9
   |
LL | struct B(i32);
   | -------- must be annotated with `#[derive(PartialEq)]` to be usable in patterns
LL |
LL | const A: &[B] = &[];
   | ------------- constant defined here
...
LL |         A => (),
   |         ^ constant of non-structural type
   |
   = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
```
2024-12-04 20:29:36 +00:00
..
impl-trait
rfc-0000-never_patterns Never patterns constitute a read for unsafety 2024-09-18 19:17:38 -04:00
rfc-0107-bind-by-move-pattern-guards Suggest .clone() in some move errors 2024-04-11 16:41:41 +00:00
rfc-1014-stdout-existential-crisis Remove libc from more tests 2024-04-17 08:36:49 -04:00
rfc-1445-restrict-constants-in-patterns Add more context to fall-through "const pattern of non-structural type" error 2024-12-04 20:29:36 +00:00
rfc-1623-static properly fill a promoted's required_consts 2024-04-23 23:02:54 +02:00
rfc-1717-dllimport
rfc-1789-as-cell
rfc-1857-stabilize-drop-order
rfc-1937-termination-trait Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
rfc-2005-default-binding-mode
rfc-2008-non-exhaustive Update tests for new TRPL chapter order 2024-11-23 08:57:25 -07:00
rfc-2027-dyn-compatible-for-dispatch UI tests: Rename "object safe" to "dyn compatible" 2024-10-10 01:13:29 +02:00
rfc-2091-track-caller more asm! -> naked_asm! in tests 2024-10-06 18:12:25 +02:00
rfc-2093-infer-outlives
rfc-2126-crate-paths
rfc-2126-extern-absolute-paths Tweak output of import suggestions 2024-06-13 20:22:21 +00:00
rfc-2151-raw-identifiers
rfc-2175-or-if-while-let
rfc-2294-if-let-guard Also check if let chains with multiple lets in these two tests 2024-11-16 05:01:52 +01:00
rfc-2302-self-struct-ctor
rfc-2306-convert-id
rfc-2361-dbg-macro Remove detail from label/note that is already available in other note 2024-10-29 16:26:57 +00:00
rfc-2396-target_feature-11 Hide implicit target features from diagnostics when possible 2024-08-07 00:43:52 -04:00
rfc-2421-unreserve-pure-offsetof-sizeof-alignof
rfc-2457-non-ascii-idents
rfc-2497-if-let-chains fix ICE when promoted has layout size overflow 2024-12-01 19:52:27 +01:00
rfc-2528-type-changing-struct-update
rfc-2565-param-attrs Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
rfc-2627-raw-dylib Simplify cleaning foreign fns in rustdoc 2024-08-16 14:10:06 -04:00
rfc-3348-c-string-literals Update tests to use new proc-macro header 2024-11-27 07:18:25 -08:00
type-alias-impl-trait
rfc-3391-result-ffi-guarantees.rs lang: Strengthen RFC 3391 guarantees to match T-lang consensus 2024-10-21 00:43:36 -07:00