about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src
AgeCommit message (Collapse)AuthorLines
2023-05-02update and add a few testsDeadbeef-0/+6
2023-05-01Box AssertKindBen Kimock-1/+1
2023-05-01fix doc test in mir_build for removing type ascriptionyukang-2/+1
2023-05-01Rollup merge of #111015 - cjgillot:chained-let-and, r=compiler-errorsMatthias Krüger-3/+0
Remove wrong assertion in match checking. This assertions is completely misguided, introduced by https://github.com/rust-lang/rust/pull/108504. The responsible PR is on beta, nominating for backport. Instead of checking that this is not a `&&`, it would make sense to check that neither arms of that `&&` is a `let`. This seems like a lot of code for unclear benefit. r? `@saethlin`
2023-04-30Bail out of MIR construction if `check_match` failsclubby789-12/+17
2023-04-30Remove wrong assertion.Camille GILLOT-3/+0
2023-04-25Replace `tcx.mk_trait_ref` with `ty::TraitRef::new`Maybe Waffle-1/+1
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-10/+10
2023-04-23Auto merge of #108118 - oli-obk:lazy_typeck, r=cjgillotbors-0/+7
Run various queries from other queries instead of explicitly in phases These are just legacy leftovers from when rustc didn't have a query system. While there are more cleanups of this sort that can be done here, I want to land them in smaller steps. This phased order of query invocations was already a lie, as any query that looks at types (e.g. the wf checks run before) can invoke e.g. const eval which invokes borrowck, which invokes typeck, ...
2023-04-22Auto merge of #106934 - DrMeepster:offset_of, r=WaffleLapkinbors-2/+31
Add offset_of! macro (RFC 3308) Implements https://github.com/rust-lang/rfcs/pull/3308 (tracking issue #106655) by adding the built in macro `core::mem::offset_of`. Two of the future possibilities are also implemented: * Nested field accesses (without array indexing) * DST support (for `Sized` fields) I wrote this a few months ago, before the RFC merged. Now that it's merged, I decided to rebase and finish it. cc `@thomcc` (RFC author)
2023-04-21Run `check_match` and `check_liveness` when MIR is built instead of having ↵Oli Scherer-0/+7
an explicit phase for them
2023-04-21minor tweaksDrMeepster-3/+3
2023-04-21intern offsetof fieldsDrMeepster-3/+3
2023-04-21offset_ofDrMeepster-4/+33
2023-04-20Remove WithOptconstParam.Camille GILLOT-97/+53
2023-04-19Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwcobors-1/+1
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros` Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+1
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-17Spelling - compilerJosh Soref-9/+9
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-16use matches! macro in more placesMatthias Krüger-11/+4
2023-04-13Auto merge of #109466 - davidlattimore:inline-arg-via-var-debug-info, ↵bors-1/+5
r=wesleywiser Preserve argument indexes when inlining MIR We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining. We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index. Fixes #83217 I considered using `Option<NonZeroU16>` instead of `Option<u16>` to store the index. I didn't because `TypeFoldable` isn't implemented for `NonZeroU16` and because it looks like due to padding, it currently wouldn't make any difference. But I indexed from 1 anyway because (a) it'll make it easier if later it becomes worthwhile to use a `NonZeroU16` and because the arguments were previously indexed from 1, so it made for a smaller change. This is my first PR on rust-lang/rust, so apologies if I've gotten anything not quite right.
2023-04-12Auto merge of #110249 - matthiaskrgr:rollup-7iig04q, r=matthiaskrgrbors-12/+12
Rollup of 8 pull requests Successful merges: - #110153 (Fix typos in compiler) - #110165 (rustdoc: use CSS `overscroll-behavior` instead of JavaScript) - #110175 (Symbol cleanups) - #110203 (Remove `..` from return type notation) - #110205 (rustdoc: make settings radio and checks thicker, less contrast) - #110222 (Improve the error message when forwarding a matched fragment to another macro) - #110237 (Split out a separate feature gate for impl trait in associated types) - #110241 (tidy: Issue an error when UI test limits are too high) Failed merges: - #110218 (Remove `ToRegionVid`) r? `@ghost` `@rustbot` modify labels: rollup
2023-04-11Add Offset binary op to custom mirAndy Wang-0/+5
2023-04-11Preserve argument indexes when inlining MIRDavid Lattimore-1/+5
We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining. We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index.
2023-04-10Fix typos in compilerDaniPopes-12/+12
2023-04-07Auto merge of #102906 - nbdd0121:mir, r=wesleywiser,tmiaskobors-23/+50
Refactor unwind in MIR This makes unwinding from current `Option<BasicBlock>` into ```rust enum UnwindAction { Continue, Cleanup(BasicBlock), Unreachable, Terminate, } ``` cc `@JakobDegen` `@RalfJung` `@Amanieu`
2023-04-06Auto merge of #108504 - cjgillot:thir-pattern, r=compiler-errors,Nilstriebbors-478/+397
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-06Fix new usage of old apiGary Guo-4/+4
2023-04-06Rename `Abort` terminator to `Terminate`Gary Guo-2/+2
Unify terminology used in unwind action and terminator, and reflect the fact that a nounwind panic is triggered instead of an immediate abort is triggered for this terminator.
2023-04-06Add `UnwindAction::Terminate`Gary Guo-2/+6
2023-04-06Refactor unwind from Option to a new enumGary Guo-17/+40
2023-04-04Rollup merge of #109838 - clubby789:non-exhaustive-span, r=NilstriebMichael Goulet-20/+23
Fix `non_exhaustive_omitted_patterns` lint span Fixes #109837 `DUMMY_SP` was being passed as the span in many cases where we have a span available to use. This meant that the location of the violating pattern wasn't shown, or the list of un-covered variants r? `@Nilstrieb`
2023-04-03Rename hir_id to lint_root.Camille GILLOT-10/+18
2023-04-03Only emit lint on refutable patterns.Camille GILLOT-8/+10
2023-04-03Expand parameters.Camille GILLOT-6/+10
2023-04-03Remove redundant field.Camille GILLOT-10/+4
2023-04-03Reinstate confusion note.Camille GILLOT-30/+25
2023-04-03Cleanup PatCtxt.Camille GILLOT-73/+23
2023-04-03Perform match checking on THIR.Camille GILLOT-397/+349
2023-04-03Add Span to StmtKind::Let.Camille GILLOT-0/+9
2023-04-03Shrink binding span.Camille GILLOT-8/+17
2023-04-03Make check_match take a LocalDefId.Camille GILLOT-7/+3
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-9/+9
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-04-02Auto merge of #109849 - scottmcm:more-fieldidx-rebase, r=oli-obkbors-15/+11
Use `FieldIdx` in various things related to aggregates Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`. Part 3/? of https://github.com/rust-lang/compiler-team/issues/606 [`IndexSlice`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_index/vec/struct.IndexVec.html#deref-methods-IndexSlice%3CI,+T%3E) was added in https://github.com/rust-lang/rust/pull/109787
2023-04-02Fix `non_exhaustive_omitted_patterns` lint spanclubby789-20/+23
2023-04-02Rollup merge of #109846 - matthiaskrgr:clippy2023_04_III, r=NilstriebNilstrieb-3/+3
more clippy::complexity fixes (iter_kv_map, map_flatten, nonminimal_bool)
2023-04-01Use `FieldIdx` in various things related to aggregatesScott McMurray-15/+11
Shrank `AggregateKind` by 8 bytes on x64, since the active field of a union is tracked as an `Option<FieldIdx>` instead of `Option<usize>`.
2023-04-01use and_then/flat_map for map().flatten()Matthias Krüger-3/+3
2023-04-01Fix `non_exhaustive_omitted_patterns` on argumentsclubby789-0/+3
2023-03-31Auto merge of #109762 - scottmcm:variantdef-indexvec, r=WaffleLapkinbors-5/+5
Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>` And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-5/+5
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606