about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/thir
AgeCommit message (Collapse)AuthorLines
2023-12-09Auto merge of #116170 - matthewjasper:remove-thir-destruction-scopes, r=cjgillotbors-43/+4
Don't include destruction scopes in THIR They are not used by anyone, and add memory/performance overhead.
2023-12-09Some types cannot show up as the type of a patternNadrieril-4/+3
2023-12-09Don't warn an empty pattern unreachable if we're not sure the data is validNadrieril-39/+90
2023-12-09Track place validityNadrieril-30/+216
2023-12-09Correctly handle empty constructorsNadrieril-158/+212
- `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-94/+159
2023-12-05Rollup merge of #118598 - Nadrieril:remove_precise_pointer_size_matching, ↵Matthias Krüger-19/+6
r=davidtwco Remove the `precise_pointer_size_matching` feature gate `usize` and `isize` are special for pattern matching because their range might depend on the platform. To make code portable across platforms, the following is never considered exhaustive: ```rust let x: usize = ...; match x { 0..=18446744073709551615 => {} } ``` Because of how rust handles constants, this also unfortunately counts `0..=usize::MAX` as non-exhaustive. The [`precise_pointer_size_matching`](https://github.com/rust-lang/rust/issues/56354) feature gate was introduced both for this convenience and for the possibility that the lang team could decide to allow the above. Since then, [half-open range patterns](https://github.com/rust-lang/rust/issues/67264) have been implemented, and since #116692 they correctly support `usize`/`isize`: ```rust match 0usize { // exhaustive! 0..5 => {} 5.. => {} } ``` I believe this subsumes all the use cases of the feature gate. Moreover no attempt has been made to stabilize it in the 5 years of its existence. I therefore propose we retire this feature gate. Closes https://github.com/rust-lang/rust/issues/56354
2023-12-04Don't include destruction scopes in THIRMatthew Jasper-43/+4
They are not used by anyone, and add memory/performance overhead.
2023-12-04Remove the `precise_pointer_size_matching` feature gateNadrieril-19/+6
2023-12-04Auto merge of #118490 - Nadrieril:arena-alloc-matrix, r=nnethercotebors-15/+8
Exhaustiveness: allocate memory better Exhaustiveness is a recursive algorithm that allocates a bunch of slices at every step. Let's see if I can improve performance by improving allocations. Already just using `Vec::with_capacity` is showing impressive improvements on my local measurements. r? `@ghost`
2023-12-02Anticipate allocation sizesNadrieril-15/+8
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-5/+5
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-30Auto merge of #118379 - compiler-errors:const-params-for-partialeq, r=fee1-deadbors-2/+10
Fix `PartialEq` args when `#[const_trait]` is enabled This is based off of your PR that enforces effects on all methods, so just see the last commits. r? fee1-dead
2023-11-29Rollup merge of #118157 - Nadrieril:never_pat-feature-gate, r=compiler-errorsMatthias Krüger-0/+11
Add `never_patterns` feature gate This PR adds the feature gate and most basic parsing for the experimental `never_patterns` feature. See the tracking issue (https://github.com/rust-lang/rust/issues/118155) for details on the experiment. `@scottmcm` has agreed to be my lang-team liaison for this experiment.
2023-11-29Add `never_patterns` feature gateNadrieril-0/+11
2023-11-28Add with_opt_const_effect_param helper, simplifyMichael Goulet-10/+9
2023-11-28Fix PartialEq args when #[const_trait] is enabledMichael Goulet-2/+11
2023-11-28Auto merge of #118405 - matthiaskrgr:rollup-3a2eevc, r=matthiaskrgrbors-2/+8
Rollup of 7 pull requests Successful merges: - #115331 (optimize str::iter::Chars::advance_by) - #118236 (Update mod comment) - #118299 (Update `OnceLock` documentation to give a concrete 'lazy static' example, and expand on the existing example.) - #118314 (Rename `{collections=>alloc}{tests,benches}`) - #118341 (Simplify indenting in THIR printing) - #118366 (Detect and reject malformed `repr(Rust)` hints) - #118397 (Fix comments for unsigned non-zero `checked_add`, `saturating_add`) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-28Auto merge of #118282 - fee1-dead-contrib:enforce-more, r=compiler-errorsbors-4/+4
effects: Run `enforce_context_effects` for all method calls So that we also perform checks when overloaded `PartialEq`s are called. r? `@compiler-errors`
2023-11-26Simplify indenting in THIR printingMark Rousskov-2/+8
This cuts >100kb from a local librustc_driver.so build, and seems just obviously simpler.
2023-11-26Rollup merge of #118311 - bvanjoi:merge_coroutinue_into_closure, r=petrochenkovGuillaume Gomez-12/+12
merge `DefKind::Coroutine` into `Defkind::Closure` Related to #118188 We no longer need to be concerned about the precise type whether it's `DefKind::Closure` or `DefKind::Coroutine`. Furthermore, thanks for the great work done by `@petrochenkov` on investigating https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Why.20does.20it.20hang.20when.20querying.20.EF.BB.BF.60opt_def_kind.60.3F r? `@petrochenkov`
2023-11-26Rollup merge of #118302 - mu001999:dead_code/clean, r=cjgillotGuillaume Gomez-149/+3
Clean dead codes Clean dead codes detected by #118257
2023-11-26merge `DefKind::Coroutine` into `DefKind::Closure`bohan-12/+12
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-4/+4
cleanup
2023-11-26Clean dead codesr0cky-149/+3
2023-11-26Auto merge of #117611 - Nadrieril:linear-pass-take-4, r=cjgillotbors-764/+1013
Rewrite exhaustiveness in one pass This is at least my 4th attempt at this in as many years x) Previous attempts were all too complicated or too slow. But we're finally here! The previous version of the exhaustiveness algorithm computed reachability for each arm then exhaustiveness of the whole match. Since each of these steps does roughly the same things, this rewrites the algorithm to do them all in one go. I also think this makes things much simpler. I also rewrote the documentation of the algorithm in depth. Hopefully it's up-to-date and easier to follow now. Plz comment if anything's unclear. r? `@oli-obk` I think you're one of the rare other people to understand the exhaustiveness algorithm? cc `@varkor` I know you're not active anymore, but if you feel like having a look you might enjoy this :D Fixes https://github.com/rust-lang/rust/issues/79307
2023-11-25Review commentMichael Goulet-20/+8
2023-11-25make sure we still eagerly emit errorsMichael Goulet-2/+4
2023-11-25Remove mir::Const::from_anon_constMichael Goulet-4/+22
2023-11-25effects: Run `enforce_context_effects` for all method callsDeadbeef-4/+4
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-43/+59
2023-11-22Cleanup span passingNadrieril-30/+31
2023-11-22Store wildcard row in the matrixNadrieril-39/+48
2023-11-22Fully rework the algorithm and its explanationNadrieril-638/+748
2023-11-22Keep rows with guards in the matrixNadrieril-46/+38
2023-11-22Respect `split` invariants for `Opaque`sNadrieril-25/+59
2023-11-22Abstract over the list of `WitnessStack`sNadrieril-69/+106
2023-11-22Tweak `lower_pattern`Nadrieril-2/+4
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-66/+59
`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-17rename bound region instantiationlcnr-1/+1
- `erase_late_bound_regions` -> `instantiate_bound_regions_with_erased` - `replace_late_bound_regions_X` -> `instantiate_bound_regions_X`
2023-11-15Re-format code with new rustfmtMark Rousskov-5/+7
2023-11-13rename `ReLateBound` to `ReBound`lcnr-1/+1
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-11-08Auto merge of #116930 - RalfJung:raw-ptr-match, r=davidtwcobors-30/+31
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-08avoid unnecessary nested conditionalsRalf Jung-11/+9
2023-11-04Suggest to set lint level on whole matchNadrieril-13/+25
2023-11-04Warn when lint level is set on a match armNadrieril-21/+41
2023-11-03Tweak spans for "adt defined here" noteNadrieril-6/+1
2023-11-03Accumulate let chains alongside the visitNadrieril-76/+78
2023-11-02Cleanup check_match code pathsNadrieril-110/+104