about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs
AgeCommit message (Collapse)AuthorLines
2023-12-11Extract exhaustiveness into its own crateNadrieril-1648/+0
2023-12-09Don't warn an empty pattern unreachable if we're not sure the data is validNadrieril-21/+64
2023-12-09Track place validityNadrieril-16/+106
2023-12-09Correctly handle empty constructorsNadrieril-5/+1
- `ConstructorSet` knows about both empty and nonempty constructors; - If an empty constructor is present in the column, we output it in `split().present`.
2023-12-09Be precise about usefulness vs reachabilityNadrieril-67/+131
2023-12-02Anticipate allocation sizesNadrieril-15/+8
2023-11-22Separate `PatStack` and `MatrixRow`Nadrieril-42/+90
This disentangles the row-specific tracking of `parent_row` etc from the logical operation of specialization. This means `wildcard_row` doesn't need to provide dummy values for `parent_row` etc anymore.
2023-11-22Clarify the `Wildcard`/`Missing` situationNadrieril-35/+51
2023-11-22Cleanup span passingNadrieril-16/+15
2023-11-22Store wildcard row in the matrixNadrieril-39/+48
2023-11-22Fully rework the algorithm and its explanationNadrieril-479/+635
2023-11-22Keep rows with guards in the matrixNadrieril-46/+38
2023-11-22Abstract over the list of `WitnessStack`sNadrieril-69/+106
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-2/+2
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-04Suggest to set lint level on whole matchNadrieril-10/+17
2023-11-04Warn when lint level is set on a match armNadrieril-21/+41
2023-11-01Auto merge of #116692 - Nadrieril:half-open-ranges, r=cjgillotbors-11/+12
Match usize/isize exhaustively with half-open ranges The long-awaited finale to the saga of [exhaustiveness checking for integers](https://github.com/rust-lang/rust/pull/50912)! ```rust match 0usize { 0.. => {} // exhaustive! } match 0usize { 0..usize::MAX => {} // helpful error message! } ``` Features: - Half-open ranges behave as expected for `usize`/`isize`; - Trying to use `0..usize::MAX` will tell you that `usize::MAX..` is missing and explain why. No more unhelpful "`_` is missing"; - Everything else stays the same. This should unblock https://github.com/rust-lang/rust/issues/37854. Review-wise: - I recommend looking commit-by-commit; - This regresses perf because of the added complexity in `IntRange`; hopefully not too much; - I measured each `#[inline]`, they all help a bit with the perf regression (tho I don't get why); - I did not touch MIR building; I expect there's an easy PR there that would skip unnecessary comparisons when the range is half-open.
2023-10-30Correctly handle nested or-patterns in column-wise analysesNadrieril-1/+1
2023-10-27Make IntRange exclusiveNadrieril-1/+1
2023-10-27s/to_pat/to_diagnostic_pat/Nadrieril-1/+1
2023-10-27Propagate half-open ranges through exhaustiveness checkingNadrieril-3/+4
2023-10-27Inline `RangeInclusive` into `IntRange`Nadrieril-9/+9
2023-10-27Handle `ty::Opaque` correctlyNadrieril-1/+16
2023-10-27Lint overlapping ranges as a separate passNadrieril-19/+85
2023-10-27Abstract over per-column pattern traversalNadrieril-36/+77
2023-10-21Fix #117033Nadrieril-0/+3
2023-10-14Lint `non_exhaustive_omitted_patterns` per columnNadrieril-47/+106
2023-10-14Distinguish user patterns from reconstructed witnessesNadrieril-50/+57
2023-10-03Clarify handling of hidden variantsNadrieril-9/+6
2023-10-03Replace SplitWildcard with a cleaner ConstructorSet abstractionNadrieril-78/+52
2023-08-28Add note when matching on nested non-exhaustive enumsSebastian Toh-23/+26
2023-07-25inline format!() args from rustc_codegen_llvm to the end (4)Matthias Krüger-2/+2
r? @WaffleLapkin
2023-05-16Document how constants as opaque patterns behave differently.Oli Scherer-0/+16
2023-05-01fix doc test in mir_build for removing type ascriptionyukang-2/+1
2023-04-06Auto merge of #108504 - cjgillot:thir-pattern, r=compiler-errors,Nilstriebbors-11/+20
Check pattern refutability on THIR The current `check_match` query is based on HIR, but partially re-lowers HIR into THIR. This PR proposed to use the results of the `thir_body` query to check matches, instead of re-building THIR. Most of the diagnostic changes are spans getting shorter, or commas/semicolons not getting removed. This PR degrades the diagnostic for confusing constants in patterns (`let A = foo()` where `A` resolves to a `const A` somewhere): it does not point ot the definition of `const A` any more.
2023-04-03Rename hir_id to lint_root.Camille GILLOT-8/+16
2023-04-03Only emit lint on refutable patterns.Camille GILLOT-3/+4
2023-04-02Fix `non_exhaustive_omitted_patterns` lint spanclubby789-4/+4
2023-04-01Fix `non_exhaustive_omitted_patterns` on argumentsclubby789-0/+3
2023-01-11Migrate pattern matchingmejrs-45/+14
2023-01-11Migrate usefulness.rsmejrs-2/+19
2022-12-13Combine projection and opaque into aliasMichael Goulet-1/+1
2022-11-20Change to Ty::is_inhabited_fromCameron Steffen-1/+1
2022-10-14more dupe word typosRageking8-1/+1
2022-10-01Refactor rustc lint APIMaybe Waffle-3/+2
2022-09-27rustc_typeck to rustc_hir_analysislcnr-1/+1
2022-09-16Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, ↵Oli Scherer-1/+9
r=estebank"" This reverts commit 4a742a691e7dd2522bad68b86fe2fd5a199d5561.
2022-09-03Include enum path in variant suggestionMichael Goulet-1/+1
2022-09-01tracing::instrument cleanupOli Scherer-2/+1
2022-08-22Rollup merge of #98200 - ouz-a:issue-98177, r=oli-obkDylan DPC-4/+19
Expand potential inner `Or` pattern for THIR Code assumed there wouldn't be a deeper `Or` pattern inside expanded `PatStack` this fixes it by looking for the `Or` pattern inside expanded `PatStack`. A more ideal solution would be recursively doing this but I haven't found a good way to do that. _fixes #97898_