about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir/mod.rs
AgeCommit message (Collapse)AuthorLines
2023-11-22Replace `no_ord_impl` with `orderable`.Nicholas Nethercote-0/+3
Similar to the previous commit, this replaces `newtype_index`'s opt-out `no_ord_impl` attribute with the opt-in `orderable` attribute.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-0/+4
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`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-14Fix def-use check for call terminatorsTomasz Miąsko-2/+17
2023-10-28share the track_caller handling within a mir::BodyRalf Jung-0/+34
2023-10-20s/generator/coroutine/Oli Scherer-20/+20
2023-10-20s/Generator/Coroutine/Oli Scherer-10/+10
2023-10-18coverage: Attach an optional `FunctionCoverageInfo` to `mir::Body`Zalathar-0/+10
This allows coverage information to be attached to the function as a whole when appropriate, instead of being smuggled through coverage statements in the function's basic blocks. As an example, this patch moves the `function_source_hash` value out of individual `CoverageKind::Counter` statements and into the per-function info. When synthesizing unused functions for coverage purposes, the absence of this info is taken to indicate that a function was not eligible for coverage and should not be synthesized.
2023-10-08Auto merge of #116454 - tmiasko:small-dominators, r=cjgillotbors-0/+17
Generalize small dominators optimization * Use small dominators optimization from 640ede7b0a1840415cb6ec881c2210302bfeba18 more generally. * Merge `DefLocation` and `LocationExtended` since they serve the same purpose.
2023-10-06Rollup merge of #116277 - RalfJung:post-mono, r=oli-obkJubilee-29/+1
dont call mir.post_mono_checks in codegen It seems like all tests are still passing when I remove this... let's see what CI says.
2023-10-05Move DefLocation from rustc_codegen_ssa to rustc_middleTomasz Miąsko-0/+17
2023-10-04Remove mir::LocalDecl::internal.Camille GILLOT-25/+1
2023-09-30dont call mir.post_mono_checks in codegenRalf Jung-29/+1
2023-09-21rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::ConstRalf Jung-4/+4
2023-09-19move ConstValue into mirRalf Jung-1/+1
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19organize mir pretty.rs and move more things into it; move statement-related ↵Ralf Jung-919/+4
things out of mir/mod.rs
2023-09-19use pretty_print_const_value from MIR constant 'extra' printingRalf Jung-1/+1
2023-09-19move some MIR const pretty-printing into pretty.rsRalf Jung-175/+6
2023-09-19more MIR const types to separate fileRalf Jung-409/+8
2023-09-18Auto merge of #115748 - RalfJung:post-mono, r=oli-obkbors-2/+30
move required_consts check to general post-mono-check function This factors some code that is common between the interpreter and the codegen backends into shared helper functions. Also as a side-effect the interpreter now uses the same `eval` functions as everyone else to get the evaluated MIR constants. Also this is in preparation for another post-mono check that will be needed for (the current hackfix for) https://github.com/rust-lang/rust/issues/115709: ensuring that all locals are dynamically sized. I didn't expect this to change diagnostics, but it's just cycle errors that change. r? `@oli-obk`
2023-09-18Remove more unused `Lift` impls.Nicholas Nethercote-1/+1
2023-09-18Remove unused `Lift` derives.Nicholas Nethercote-2/+2
I found these by commenting out all `Lift` derives and then adding back the ones that were necessary to successfully compile.
2023-09-14don't point at const usage site for resolution-time errorsRalf Jung-4/+1
also share the code that emits the actual error
2023-09-14move required_consts check to general post-mono-check functionRalf Jung-2/+33
2023-09-14Auto merge of #115804 - RalfJung:valtree-to-const-val, r=oli-obkbors-17/+17
consistently pass ty::Const through valtrees Some drive-by things extracted from https://github.com/rust-lang/rust/pull/115748.
2023-09-14fix clippy (and MIR printing) handling of ConstValue::Indirect slicesRalf Jung-25/+10
2023-09-14found another place where we can eval() a const, and go through valtreesRalf Jung-1/+5
2023-09-14always evaluate ConstantKind::Ty through valtreesRalf Jung-16/+12
2023-09-14cleanup op_to_const a bit; rename ConstValue::ByRef → IndirectRalf Jung-1/+1
2023-09-14use AllocId instead of Allocation in ConstValue::ByRefRalf Jung-1/+2
2023-09-13Rollup merge of #115736 - Zoxc:time-cleanup, r=wesleywiserMatthias Krüger-0/+37
Remove `verbose_generic_activity_with_arg` This removes `verbose_generic_activity_with_arg` and changes users to `generic_activity_with_arg`. This keeps the output of `-Z time` readable while these repeated events are still available with the self profiling mechanism.
2023-09-13Generate MIR pass names for profiling on the fly and pass the body DefId as ↵John Kåre Alsaker-0/+37
argument
2023-09-13restore the old logic adjusting ty::UnevaluatedConst before evaluationRalf Jung-4/+5
2023-09-13make the set of methods between our two Const types more consistentRalf Jung-53/+31
2023-09-13make the eval() functions on our const types return the resulting valueRalf Jung-41/+56
2023-09-11Disentangle `Debug` and `Display` for `Ty`.Nicholas Nethercote-8/+12
The `Debug` impl for `Ty` just calls the `Display` impl for `Ty`. This is surprising and annoying. In particular, it means `Debug` doesn't show as much information as `Debug` for `TyKind` does. And `Debug` is used in some user-facing error messages, which seems bad. This commit changes the `Debug` impl for `Ty` to call the `Debug` impl for `TyKind`. It also does a number of follow-up changes to preserve existing output, many of which involve inserting `with_no_trimmed_paths!` calls. It also adds `Display` impls for `UserType` and `Canonical`. Some tests have changes to expected output: - Those that use the `rustc_abi(debug)` attribute. - Those that use the `EMIT_MIR` annotation. In each case the output is slightly uglier than before. This isn't ideal, but it's pretty weird (particularly for the attribute) that the output is using `Debug` in the first place. They're fairly obscure attributes (I hadn't heard of them) so I'm not worried by this. For `async-is-unwindsafe.stderr`, there is one line that now lacks a full path. This is a consistency improvement, because all the other mentions of `Context` in this test lack a path.
2023-09-08Auto merge of #115612 - cjgillot:const-prop-int, r=oli-obkbors-1/+8
Improvements to dataflow const-prop Partially cherry-picked from https://github.com/rust-lang/rust/pull/110719 r? `@oli-obk` cc `@jachris`
2023-09-06Support array length.Camille GILLOT-0/+7
2023-09-05Do not assert in try_to_int.Camille GILLOT-1/+1
2023-09-05Refactor how MIR represents composite debuginfo.Camille GILLOT-42/+28
2023-09-05Refactor projection debug.Camille GILLOT-55/+69
2023-08-24document more things as needing to stay in syncRalf Jung-3/+16
2023-08-17Revert "Implement references VarDebugInfo."Camille GILLOT-4/+0
This reverts commit 2ec007191348ef7cc13eb55e44e007b02cf75cf3.
2023-08-06cleanup misinformation regarding has_derefouz-a-11/+17
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-68/+60
2023-07-25Make everything builtin!Michael Goulet-3/+1
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-29/+28
2023-07-07Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`Nilstrieb-1/+1
It makes it sound like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a some enum variants. Make it clear there these are only coercion to make it clear why only some pointer related "casts" are in the enum.
2023-07-06Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errorsbors-1/+1
Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Part of rust-lang/compiler-team#616 turns out there's a lot of places we construct `Ty` this is a ridiculously huge PR :S r? `@oli-obk`
2023-07-06Auto merge of #113291 - oli-obk:pretty_print_mir_const, r=RalfJungbors-29/+17
Specialize `try_destructure_mir_constant` for its sole user (pretty printing) We can't remove the query, as we need to invoke it from rustc_middle, but can only implement it in mir interpretation/const eval. r? `@RalfJung` for a first round. While we could move all the logic into pretty printing, that would end up duplicating a bit of code with const eval, which doesn't seem great either.