rust/tests/ui/pattern/usefulness
bors fdaaaf9f92 Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwco
patterns: reject raw pointers that are not just integers

Matching against `0 as *const i32` is fine, matching against `&42 as *const i32` is not.

This extends the existing check against function pointers and wide pointers: we now uniformly reject all these pointer types during valtree construction, and then later lint because of that. See [here](https://github.com/rust-lang/rust/pull/116930#issuecomment-1784654073) for some more explanation and context.

Also fixes https://github.com/rust-lang/rust/issues/116929.

Cc `@oli-obk` `@lcnr`
2023-11-08 20:42:32 +00:00
..
auxiliary Add note when matching on nested non-exhaustive enums 2023-08-28 14:50:32 +08:00
integer-ranges Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
always-inhabited-union-ref.rs
always-inhabited-union-ref.stderr
conflicting_bindings.rs Always do all the pattern checks 2023-11-02 03:19:19 +01:00
conflicting_bindings.stderr Always do all the pattern checks 2023-11-02 03:19:19 +01:00
const-partial_eq-fallback-ice.rs
const-partial_eq-fallback-ice.stderr Add notes to non-structural const in pattern error message 2023-03-27 11:08:11 -04:00
const-pat-ice.rs
const-private-fields.rs
consts-opaque.rs make pointer_structural_match warn-by-default 2023-10-28 17:02:18 +02:00
consts-opaque.stderr make pointer_structural_match warn-by-default 2023-10-28 17:02:18 +02:00
deny-irrefutable-let-patterns.rs
deny-irrefutable-let-patterns.stderr
doc-hidden-fields.rs
doc-hidden-fields.stderr
doc-hidden-non-exhaustive.rs
doc-hidden-non-exhaustive.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
empty-match.exhaustive_patterns.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
empty-match.normal.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
empty-match.rs Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
floats.rs Evaluate float consts eagerly 2023-10-01 00:00:37 +02:00
floats.stderr Evaluate float consts eagerly 2023-10-01 00:00:37 +02:00
guards.rs
guards.stderr Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
irrefutable-let-patterns.rs
irrefutable-unit.rs
issue-2111.rs
issue-2111.stderr Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
issue-3096-1.rs
issue-3096-1.stderr
issue-3096-2.rs
issue-3096-2.stderr
issue-3601.rs add comment back 2023-06-28 01:51:53 -04:00
issue-3601.stderr add comment back 2023-06-28 01:51:53 -04:00
issue-4321.rs
issue-4321.stderr
issue-12116.rs
issue-12116.stderr
issue-12369.rs
issue-12369.stderr
issue-13727.rs
issue-13727.stderr
issue-15129.rs
issue-15129.stderr
issue-30240-b.rs
issue-30240-b.stderr
issue-30240-rpass.rs
issue-30240.rs
issue-30240.stderr Improve clarity of diagnostic message on non-exhaustive matches 2023-09-03 19:55:11 +08:00
issue-31221.rs
issue-31221.stderr
issue-31561.rs Migrate pattern matching 2023-01-11 14:40:02 -08:00
issue-31561.stderr Don't recommend if let if let else works 2023-01-11 14:40:07 -08:00
issue-35609.rs
issue-35609.stderr Tweak diagnostic for consistency 2023-11-02 03:19:19 +01:00
issue-39362.rs
issue-39362.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
issue-40221.rs
issue-40221.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
issue-50900.rs
issue-50900.stderr Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
issue-53820-slice-pattern-large-array.rs
issue-56379.rs
issue-56379.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
issue-57472.rs
issue-57472.stderr
issue-65413-constants-and-slices-exhaustiveness.rs
issue-66501.rs
issue-71930-type-of-match-scrutinee.rs
issue-72377.rs
issue-72377.stderr
issue-72476-and-89393-associated-type.rs
issue-78123-non-exhaustive-reference.rs
issue-78123-non-exhaustive-reference.stderr
issue-78549-ref-pat-and-str.rs
issue-80501-or-pat-and-macro.rs
issue-82772-match-box-as-struct.rs
issue-82772-match-box-as-struct.stderr
issue-85222-types-containing-non-exhaustive-types.rs Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
issue-85222-types-containing-non-exhaustive-types.stderr Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
issue-88747.rs
issue-105479-str-non-exhaustiveness.rs Improve clarity of diagnostic message on non-exhaustive matches 2023-09-03 19:55:11 +08:00
issue-105479-str-non-exhaustiveness.stderr Improve clarity of diagnostic message on non-exhaustive matches 2023-09-03 19:55:11 +08:00
match-arm-statics-2.rs
match-arm-statics-2.stderr
match-arm-statics.rs
match-arm-statics.stderr
match-byte-array-patterns-2.rs
match-byte-array-patterns-2.stderr Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
match-byte-array-patterns.rs
match-byte-array-patterns.stderr
match-non-exhaustive.rs add note for non-exhaustive matches with guards 2023-06-28 01:51:53 -04:00
match-non-exhaustive.stderr add note for non-exhaustive matches with guards 2023-06-28 01:51:53 -04:00
match-privately-empty.rs
match-privately-empty.stderr Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
match-ref-ice.rs
match-ref-ice.stderr
match-slice-patterns.rs
match-slice-patterns.stderr Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
match-vec-fixed.rs
match-vec-fixed.stderr
match-vec-unreachable.rs
match-vec-unreachable.stderr
nested-exhaustive-match.rs
nested-non-exhaustive-enums.rs Add note when matching on nested non-exhaustive enums 2023-08-28 14:50:32 +08:00
nested-non-exhaustive-enums.stderr Improve clarity of diagnostic message on non-exhaustive matches 2023-09-03 19:55:11 +08:00
non-exhaustive-defined-here.rs Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
non-exhaustive-defined-here.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
non-exhaustive-match-nested.rs
non-exhaustive-match-nested.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
non-exhaustive-match.rs
non-exhaustive-match.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
non-exhaustive-pattern-witness.rs Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
non-exhaustive-pattern-witness.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
refutable-pattern-errors.rs Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
refutable-pattern-errors.stderr Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
refutable-pattern-in-fn-arg.rs Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
refutable-pattern-in-fn-arg.stderr Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
slice_of_empty.rs Fix handling slices of empty types 2023-10-05 00:58:14 +02:00
slice_of_empty.stderr Fix handling slices of empty types 2023-10-05 00:58:14 +02:00
slice-pattern-const-2.rs
slice-pattern-const-2.stderr
slice-pattern-const-3.rs
slice-pattern-const-3.stderr
slice-pattern-const.rs
slice-pattern-const.stderr
slice-patterns-exhaustiveness.rs
slice-patterns-exhaustiveness.stderr Perform match checking on THIR. 2023-04-03 15:59:21 +00:00
slice-patterns-irrefutable.rs
slice-patterns-reachability.rs
slice-patterns-reachability.stderr
stable-gated-fields.rs
stable-gated-fields.stderr
stable-gated-patterns.rs
stable-gated-patterns.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
struct-like-enum-nonexhaustive.rs
struct-like-enum-nonexhaustive.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
struct-pattern-match-useless.rs
struct-pattern-match-useless.stderr
top-level-alternation.rs
top-level-alternation.stderr
tuple-struct-nonexhaustive.rs
tuple-struct-nonexhaustive.stderr Match usize/isize exhaustively 2023-10-27 19:56:12 +02:00
type_polymorphic_byte_str_literals.rs
type_polymorphic_byte_str_literals.stderr
uninhabited.rs
unstable-gated-fields.rs
unstable-gated-fields.stderr
unstable-gated-patterns.rs
unstable-gated-patterns.stderr Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00