-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We're not warning against fn ptr and wide raw ptr nested inside ADTs #116929
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-patterns
Relating to patterns and pattern matching
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Oct 19, 2023
That would warn on |
It would? That's surprising, since valtree construction will succeed for |
workingjubilee
added
A-diagnostics
Area: Messages for errors, warnings, and lints
A-patterns
Relating to patterns and pattern matching
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
C-bug
Category: This is a bug.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Oct 19, 2023
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 28, 2023
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. Also fixes rust-lang#116929. Cc `@oli-obk` `@lcnr`
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this issue
Nov 15, 2023
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](rust-lang/rust#116930 (comment)) for some more explanation and context. Also fixes rust-lang/rust#116929. Cc `@oli-obk` `@lcnr`
lnicola
pushed a commit
to lnicola/rust-analyzer
that referenced
this issue
Apr 7, 2024
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](rust-lang/rust#116930 (comment)) for some more explanation and context. Also fixes rust-lang/rust#116929. Cc `@oli-obk` `@lcnr`
RalfJung
pushed a commit
to RalfJung/rust-analyzer
that referenced
this issue
Apr 27, 2024
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](rust-lang/rust#116930 (comment)) for some more explanation and context. Also fixes rust-lang/rust#116929. Cc `@oli-obk` `@lcnr`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-patterns
Relating to patterns and pattern matching
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I found a gap in our match forward-compatibility warnings:
This should warn but doesn't.
The reason is that here we are only checking the top-level type to be a wide raw ptr or fn ptr, we are not recursing.
The fix IMO is to reject those types in
compiler/rustc_trait_selection/src/traits/structural_match.rs
, which already recurses the type.Cc @oli-obk @lcnr
The text was updated successfully, but these errors were encountered: