-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Fix dead code warning when inline const is used in pattern #88036
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
I'd never guess that |
📌 Commit 17d18e3822d5e5876fbf9d2ddd6d2b4a6783e117 has been approved by |
Actually this approach doesn't catch |
Added a test case for using inline const in range pattern |
It's surprising to me as well, but I guess that's probably the easiest way to implement it since it'll need to have a |
Yeah, it's a better approach, it should also fix cases like const fn one() -> i32 {
1
}
struct S<const C: i32>;
fn main() {
match S::<1> {
S::<{one()}> => {}
}
} Could you actually add this case too? @bors r- |
Added and merged |
Thanks! |
📌 Commit e62ecdc has been approved by |
Fix dead code warning when inline const is used in pattern Fixes rust-lang#78171
…laumeGomez Rollup of 10 pull requests Successful merges: - rust-lang#87818 (Fix anchors display in rustdoc) - rust-lang#87983 (Use more accurate spans when proposing adding lifetime to item) - rust-lang#88012 (Change WASI's `RawFd` from `u32` to `c_int` (`i32`).) - rust-lang#88031 (Make `BuildHasher` object safe) - rust-lang#88036 (Fix dead code warning when inline const is used in pattern) - rust-lang#88082 (Take into account jobs number for rustdoc GUI tests) - rust-lang#88109 (Fix environment variable getter docs) - rust-lang#88111 (Add background-color on clickable definitions in source code) - rust-lang#88129 (Fix dataflow graphviz bug, make dataflow graphviz modules public) - rust-lang#88136 (Move private_unused.rs test to impl-trait) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #78171