304 Commits
Author SHA1 Message Date
Boxy Uwu 6722805cdc Make ValTree recurse through ty::Const 2025-12-23 13:54:59 +00:00
Marijn Schouten 5d8a096afe change non-canonical clone impl to {*self}, fix some doc comments 2025-12-20 13:46:22 +00:00
Shoyu Vanilla dae003b04b fix: Do not ICE when missing match arm with ill-formed subty is met 2025-11-13 01:36:35 +09:00
Frank King 5ef48ed448 Implement &pin patterns and ref pin bindings 2025-11-10 09:57:08 +08:00
lcnr ad20e5c468 split definition and use site hidden tys 2025-10-31 14:48:43 +01:00
Boxy Uwu 4d41177513 Rename various "concrete opaque type" terminology to say "hidden type" 2025-09-27 22:58:02 +01:00
León Orell Valerian Liehr 26f3337d4e Remove DynKind 2025-09-17 04:46:46 +02:00
Nicholas Nethercote 301655eafe Revert introduction of [workspace.dependencies].
This was done in #145740 and #145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-02 19:12:54 +10:00
Nicholas Nethercote 2b26476ccd Add rustc-hash to [workspace.dependencies]. 2025-08-28 20:11:43 +10:00
Nicholas Nethercote ce02d34b2f Add rustc_apfloat to [workspace.dependencies]. 2025-08-28 20:10:55 +10:00
Nicholas Nethercote c50d2cc807 Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
Samuel Tardieu 5a14685a63 Rollup merge of #145234 - dianne:1-tuple-witnesses, r=jackh726
match exhaustiveness diagnostics: show a trailing comma on singleton tuple consructors in witness patterns (and clean up a little)

Constructor patterns of type `(T,)` are written `(pat,)`, not `(pat)`. However, exhaustiveness/usefulness diagnostics would print them as `(pat)` when e.g. providing a witness of non-exhaustiveness and suggesting adding arms to make matches exhaustive; this would result in an error when applied.
rust-analyzer already prints the trailing comma, so it doesn't need changing.

This also includes some cleanup in the second commit, with justification in the commit message.
2025-08-23 22:22:15 +02:00
Ralf Jung e2cc7757e1 avoid unnecessary type sanity checks 2025-08-14 09:44:22 +02:00
Ralf Jung dbc030e034 shrink TestBranch::Constant and PatRangeBoundary::Finite 2025-08-14 09:44:22 +02:00
Ralf Jung a1acbfb050 change StrLit type to ty::Value as well 2025-08-14 09:44:22 +02:00
Ralf Jung a171eaab42 use ty::Value instead of manual pairs of types and valtrees 2025-08-14 09:44:22 +02:00
Ralf Jung d61fdbf266 pattern testing: store constants as valtrees 2025-08-14 09:44:19 +02:00
Ralf Jung 3f1e99dca4 PatKind: store constants as valtrees 2025-08-14 09:39:39 +02:00
dianne 8f649a7e58 clean up witness printing for tuple-like constructors
By construction, `subpatterns` contains all fields in order. Witness
patterns are constructed with all fields in order by
`WitnessPat::wild_from_ctor` and `WitnessStack::apply_constructor`, and
the order is preserved at `write_struct_like`'s call-site in
`print_witness_pat`. It's thus no longer necessary to go looking for
fields or handle missing fields.
2025-08-10 16:34:11 -07:00
dianne 9449b78621 show a trailing comma on singleton tuple constructors in witness pats 2025-08-10 15:32:14 -07:00
Trevor Gross 18abf3aa44 Rollup merge of #144545 - ChayimFriedman2:bool-witness-order, r=Nadrieril
In rustc_pattern_analysis, put `true` witnesses before `false` witnesses

In rustc it doesn't really matter what the order of the witnesses is, but I'm planning to use the witnesses for implementing the "add missing match arms" assist in rust-analyzer, and there `true` before `false` is the natural order (like `Some` before `None`), and also what the current assist does.

The current order doesn't seem to be intentional; the code was created when bool ctors became their own thing, not just int ctors, but for integer, 0 before 1 is indeed the natural order.

r? `@Nadrieril`
2025-08-08 14:22:44 -05:00
Nicholas Nethercote 704f2ca172 Tidy up Cargo.toml files.
- Add some missing `tidy-alphabetical-*` markers.
- Remove some unnecessary blank lines.
2025-07-31 19:58:04 +10:00
Chayim Refael Friedman 6bf3cbe39e In rustc_pattern_analysis, put true witnesses before false witnesses
In rustc it doesn't really matter what the order of the witnesses is, but I'm planning to use the witnesses for implementing the "add missing match arms" assist in rust-analyzer, and there `true` before `false` is the natural order (like `Some` before `None`), and also what the current assist does.

The current order doesn't seem to be intentional; the code was created when bool ctors became their own thing, not just int ctors, but for integer, 0 before 1 is indeed the natural order.
2025-07-28 02:01:39 +03:00
Trevor Gross 3f7d497c8a Rollup merge of #144171 - Nadrieril:exhaustive-witnesses, r=davidtwco
pattern_analysis: add option to get a full set of witnesses

This adds an option to the rustc_pattern_analysis machinery to have it report a complete set of patterns when a match is non-exhaustive (by default we only guarantee to report _some_ missing patterns). This is for use in rust-analyzer.

Leaving as draft until I'm sure this is what r-a needs.

r? ghost
2025-07-26 01:15:04 -05:00
Nadrieril af07c08c60 Silence a warning 2025-07-20 18:27:30 +02:00