10 Commits

Author SHA1 Message Date
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
Nadrieril
746197c08a Tweak spans for "adt defined here" note 2023-11-03 18:26:16 +01:00
Ralf Jung
70a8e157ab make pointer_structural_match warn-by-default 2023-10-28 17:02:18 +02:00
Matthew Jasper
d4ffb3b08a Capture scrutinee of if let guards correctly
Previously we were always capturing by value.
2023-09-22 13:04:44 +00:00
Sebastian Toh
d87b87d10e Improve clarity of diagnostic message on non-exhaustive matches 2023-09-03 19:55:11 +08:00
Sebastian Toh
43dd8613a3 Add note when matching on nested non-exhaustive enums 2023-08-28 14:50:32 +08:00
clubby789
e72618a897 Don't capture &[T; N] when contents isn't read 2023-06-15 11:42:20 +00:00
clubby789
ace794c6d7 Always capture slice when pattern requires checking the length 2023-05-25 17:08:49 +00:00
Oli Scherer
334423263a Run check_match and check_liveness when MIR is built instead of having an explicit phase for them 2023-04-21 22:32:38 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00