summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2022-08-04Rollup merge of #100095 - jackh726:early-binder, r=lcnrMatthias Krüger-0/+6
More EarlyBinder cleanups Each commit is independent r? types
2022-08-03Add bound_impl_subject and bound_return_tyJack Huey-0/+6
2022-08-02Avoid invalidating the CFG in MirPatch.Jakob Degen-35/+30
As a part of this change, we adjust MirPatch to not needlessly create unnecessary resume blocks.
2022-08-01Rollup merge of #100003 - nnethercote:improve-size-assertions, r=lqdMatthias Krüger-17/+12
Improve size assertions. - For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order. r? `@lqd`
2022-08-01Improve size assertions.Nicholas Nethercote-17/+12
- For any file with four or more size assertions, move them into a separate module (as is already done for `hir.rs`). - Add some more for AST nodes and THIR nodes. - Put the `hir.rs` ones in alphabetical order.
2022-07-30Use LocalDefId for closures moreCameron Steffen-47/+45
2022-07-28Use line numbers relative to function in mir opt testsNilstrieb-6/+12
This adds a new option, `-Zmir-pretty-relative-line-numbers`, that is then used in compiletest for the mir-opt tests.
2022-07-26Rollup merge of #97077 - ouz-a:Optimize-backend, r=oli-obkYuki Okushi-0/+14
Simplify some code that depend on Deref Now that we can assume #97025 works, it's safe to expect Deref is always in the first place of projections. With this, I was able to simplify some code that depended on Deref's place in projections. When we are able to move Derefer before `ElaborateDrops` successfully we will be able to optimize more places. r? `@oli-obk`
2022-07-24make sure has_deref is correctouz-a-0/+2
2022-07-23now we can make scalar_to_ptr a method on ScalarRalf Jung-0/+18
2022-07-22has_deref: simpler comparison, ty fixouz-a-10/+2
2022-07-22simplify more, ret_deref -> has_derefouz-a-6/+6
2022-07-22simplify some code that depend on Derefouz-a-0/+20
2022-07-22Rollup merge of #98868 - tmiasko:unreachable-coverage, r=wesleywiserDylan DPC-0/+16
Fix unreachable coverage generation for inlined functions To generate a function coverage we need at least one coverage counter, so a coverage from unreachable blocks is retained only when some live counters remain. The previous implementation incorrectly retained unreachable coverage, because it didn't account for the fact that those live counters can belong to another function due to inlining. Fixes #98833.
2022-07-22Auto merge of #99420 - RalfJung:vtable, r=oli-obkbors-27/+67
make vtable pointers entirely opaque This implements the scheme discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/338: vtable pointers should be considered entirely opaque and not even readable by Rust code, similar to function pointers. - We have a new kind of `GlobalAlloc` that symbolically refers to a vtable. - Miri uses that kind of allocation when generating a vtable. - The codegen backends, upon encountering such an allocation, call `vtable_allocation` to obtain an actually dataful allocation for this vtable. - We need new intrinsics to obtain the size and align from a vtable (for some `ptr::metadata` APIs), since direct accesses are UB now. I had to touch quite a bit of code that I am not very familiar with, so some of this might not make much sense... r? `@oli-obk`
2022-07-20Auto merge of #99058 - michaelwoerister:remove-stable-set-and-map, r=nagisabors-2/+2
Remove the unused StableSet and StableMap types from rustc_data_structures. The current implementation is not "stable" in the same sense that `HashStable` and `StableHasher` are stable, i.e. across compilation sessions. So, in my opinion, it's better to remove those types (which are basically unused anyway) than to give the wrong impression that these are safe for incr. comp. I plan to provide new "stable" collection types soon that can be used to replace `FxHashMap` and `FxHashSet` in query results (see [draft](https://github.com/michaelwoerister/rust/commit/69d03ac7a7d651a397ab793e9d78f8fce3edf7a6)). It's unsound that `HashMap` and `HashSet` implement `HashStable` (see https://github.com/rust-lang/rust/issues/98890 for a recent P-critical bug caused by this) -- so we should make some progress there.
2022-07-20various nits from reviewRalf Jung-1/+1
2022-07-20consistently use VTable over Vtable (matching stable stdlib API RawWakerVTable)Ralf Jung-18/+20
2022-07-20incorporate some review feedbackRalf Jung-1/+1
2022-07-20make use of symbolic vtables in interpreterRalf Jung-18/+9
2022-07-20rename get_global_alloc to try_get_global_allocRalf Jung-7/+16
2022-07-20add a Vtable kind of symbolic allocationsRalf Jung-4/+42
2022-07-20Auto merge of #99472 - RalfJung:provenance, r=oli-obkbors-106/+108
interpret: rename Tag/PointerTag to Prov/Provenance We were pretty inconsistent with calling this the "tag" vs the "provenance" of the pointer; I think we should consistently call it "provenance". r? `@oli-obk`
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-2/+2
2022-07-20Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"Oli Scherer-24/+3
This reverts commit 6f8fb911ad504b77549cf3256a09465621beab9d, reversing changes made to 7210e46dc69a4b197a313d093fe145722c248b7d.
2022-07-19interpret: rename Tag/PointerTag to Prov/ProvenanceRalf Jung-106/+108
Let's avoid using two different terms for the same thing -- let's just call it "provenance" everywhere. In Miri, provenance consists of an AllocId and an SbTag (Stacked Borrows tag), which made this even more confusing.
2022-07-19Use LocalDefId in OpaqueTypeKeyMichael Goulet-1/+1
2022-07-15Introduce opaque type to hidden type projectionOli Scherer-3/+24
2022-07-15Auto merge of #99013 - RalfJung:dont-poison-my-places, r=oli-obkbors-0/+2
interpret: get rid of MemPlaceMeta::Poison This is achieved by refactoring the projection code (`{mplace,place,operand}_{downcast,field,index,...}`) so that we no longer need to call `assert_mem_place` in the operand handling.
2022-07-14Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiserbors-14/+14
Rename `debugging_opts` to `unstable_opts` This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear. cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options r? `@Amanieu` cc `@nikic` `@joshtriplett`
2022-07-13Rename `debugging_opts` to `unstable_opts`Joshua Nelson-14/+14
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear.
2022-07-13assigning to a union field can never drop nowRalf Jung-6/+0
2022-07-13Auto merge of #98145 - ouz-a:some_branch, r=oli-obkbors-4/+39
Pull Derefer before ElaborateDrops _Follow up work to #97025 #96549 #96116 #95887 #95649_ This moves `Derefer` before `ElaborateDrops` and creates a new `Rvalue` called `VirtualRef` that allows us to bypass many constraints for `DerefTemp`. r? `@oli-obk`
2022-07-13get rid of MemPlaceMeta::PoisonRalf Jung-0/+2
MPlaceTy::dangling still exists, but now it is only called in places that actually conceptually allocate something new, so that's fine.
2022-07-12add new rval, pull deref earlyouz-a-4/+39
2022-07-11use PlaceRef::iter_projections to fix old FIXMERose Hudson-5/+3
I added this function in 53481a5a8fde83ed1a5d7e8302be028a4c7d8da5
2022-07-10Rollup merge of #99103 - TaKO8Ki:avoid-&str-to-string-conversions, r=oli-obkMatthias Krüger-5/+3
Avoid some `&str` to `String` conversions This patch removes some `&str` to `String` conversions.
2022-07-10avoid some `&str` to `String` conversionsTakayuki Maeda-5/+3
2022-07-09Auto merge of #98957 - RalfJung:zst-are-different, r=lcnr,oli-obkbors-10/+18
don't allow ZST in ScalarInt There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So I propose we stop using ScalarInt to represent ZST (which are clearly not integers). Instead, we can add new ZST variants to those types that did not have other variants which could be used for this purpose. Based on https://github.com/rust-lang/rust/pull/98831. Only the commits starting from "don't allow ZST in ScalarInt" are new. r? `@oli-obk`
2022-07-09tweak names and output and blessRalf Jung-7/+15
2022-07-09review feedbackRalf Jung-7/+7
2022-07-09don't allow ZST in ScalarIntRalf Jung-10/+10
There are several indications that we should not ZST as a ScalarInt: - We had two ways to have ZST valtrees, either an empty `Branch` or a `Leaf` with a ZST in it. `ValTree::zst()` used the former, but the latter could possibly arise as well. - Likewise, the interpreter had `Immediate::Uninit` and `Immediate::Scalar(Scalar::ZST)`. - LLVM codegen already had to special-case ZST ScalarInt. So instead add new ZST variants to those types that did not have other variants which could be used for this purpose.
2022-07-09Rollup merge of #99050 - JakobDegen:storage-docs, r=tmiaskoMatthias Krüger-13/+13
Clarify MIR semantics of storage statements Seems worthwhile to start closing out some of the less controversial open questions about MIR semantics. Hopefully this is fairly non-controversial - it's what we implement already, and I see no reason to do anything more restrictive. cc ``@tmiasko`` who commented on this when it was discussed in the original PR that added these docs.
2022-07-08Clarify MIR semantics of storage statementsJakob Degen-13/+13
2022-07-08Add `SourceScope::inlined_instance`Tomasz Miąsko-0/+16
2022-07-08Rollup merge of #99019 - pierwill:doc-mir-statement, r=cjgillotMatthias Krüger-1/+4
Add doc comments in `rustc_middle::mir`
2022-07-07Rollup merge of #98979 - RalfJung:more-alloc-range, r=oli-obkMatthias Krüger-60/+51
interpret: use AllocRange in UninitByteAccess also use nice new format string syntax in `interpret/error.rs`, and use the `#` flag to add `0x` prefixes where applicable. r? ``@oli-obk``
2022-07-07Add doc comments in `rustc_middle::mir`pierwill-1/+4
2022-07-07Move `dominators` from Body to BasicBlocksTomasz Miąsko-6/+7
2022-07-07Move `switch_sources` from Body to BasicBlocksTomasz Miąsko-8/+0