about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2022-09-07Auto merge of #101522 - oli-obk:miriup, r=oli-obkbors-1/+3
Update miri submodule fixes #101344 cc `@rust-lang/miri` r? `@ghost`
2022-09-07Update miri submoduleOli Scherer-1/+3
2022-09-07Auto merge of #98332 - oli-obk:assume, r=wesleywiserbors-19/+50
Lower the assume intrinsic to a MIR statement This makes https://github.com/rust-lang/rust/pull/96862#issuecomment-1153739068 easier and will generally allow us to cheaply insert assume intrinsic calls in mir building. r? rust-lang/wg-mir-opt
2022-09-06Update docsOli Scherer-2/+2
2022-09-06Generalize the Assume intrinsic statement to a general Intrinsic statementOli Scherer-32/+50
2022-09-06Lower the assume intrinsic to a MIR statementOli Scherer-0/+13
2022-09-06Add more size assertions for MIR types.Nicholas Nethercote-8/+14
And move them into a module, as has been done previously for AST, HIR, etc.
2022-09-01tracing::instrument cleanupOli Scherer-14/+8
2022-08-31Fix a bunch of typoDezhi Wu-4/+4
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-30Auto merge of #99102 - JakobDegen:reorder-generators, r=oli-obkbors-55/+102
Rework definition of MIR phases to more closely reflect semantic concerns Implements most of rust-lang/compiler-team#522 . I tried my best to restrict this PR to the "core" parts of the MCP. In other words, this includes just enough changes to make the new definition of `MirPhase` make sense. That means there are a couple of FIXMEs lying around. Depending on what reviewers prefer, I can either fix them in this PR or send follow up PRs. There are also a couple other refactorings of the `rustc_mir_transform/src/lib.rs` file that I want to do in follow ups that I didn't leave explicit FIXMEs for.
2022-08-30Refactor MIR phasesJakob Degen-55/+102
2022-08-30Rollup merge of #101101 - RalfJung:read-pointer-as-bytes, r=oli-obkDylan DPC-191/+180
interpret: make read-pointer-as-bytes a CTFE-only error with extra information Next step in the reaction to https://github.com/rust-lang/rust/issues/99923. Also teaches Miri to implicitly strip provenance in more situations when transmuting pointers to integers, which fixes https://github.com/rust-lang/miri/issues/2456. Pointer-to-int transmutation during CTFE now produces a message like this: ``` = help: this code performed an operation that depends on the underlying bytes representing a pointer = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported ``` r? ``@oli-obk``
2022-08-29Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obkMatthias Krüger-19/+14
Replace `Body::basic_blocks()` with field access Since the refactoring in #98930, it is possible to borrow the basic blocks independently from other parts of MIR by accessing the `basic_blocks` field directly. Replace unnecessary `Body::basic_blocks()` method with a direct field access, which has an additional benefit of borrowing the basic blocks only.
2022-08-28improve OFFSET_IS_ADDR docsRalf Jung-2/+6
2022-08-27interpret: make read-pointer-as-bytes *always* work in MiriRalf Jung-96/+84
and show some extra information when it happens in CTFE
2022-08-27interpret: rename relocation → provenanceRalf Jung-114/+111
2022-08-26remove now-unused ScalarMaybeUninitRalf Jung-134/+1
2022-08-26make read_immediate error immediately on uninit, so ImmTy can carry ↵Ralf Jung-17/+8
initialized Scalar
2022-08-26remove some now-unnecessary parameters from check_bytesRalf Jung-19/+4
2022-08-26Replace `Body::basic_blocks()` with field accessTomasz Miąsko-19/+14
2022-08-25Inline trivial `From<Local> for Place<'_>` implTomasz Miąsko-0/+1
2022-08-23Remove support for adding statement to all successorsTomasz Miąsko-17/+0
This feature of MIR patch system is no longer used.
2022-08-23Elide storage markers when elaborating deref projectionsTomasz Miąsko-3/+6
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-9/+1
2022-08-19Rollup merge of #100081 - RalfJung:unused-unsafe-in-unsafe-fn, r=jackh726Dylan DPC-20/+2
never consider unsafe blocks unused if they would be required with deny(unsafe_op_in_unsafe_fn) Judging from https://github.com/rust-lang/rust/issues/71668#issuecomment-1200317370 the consensus nowadays seems to be that we should never consider an unsafe block unused if it was required with `deny(unsafe_op_in_unsafe_fn)`, no matter whether that lint is actually enabled or not. So let's adjust rustc accordingly. The first commit does the change, the 2nd does some cleanup.
2022-08-18Rollup merge of #99966 - RalfJung:try-dont-panic, r=lcnrMatthias Krüger-1/+3
avoid assertion failures in try_to_scalar_int Given that this is called `try_to_scalar_int`, we probably shouldn't `assert_int` here. Similarly `try_to_bits` also doesn't `assert!` that the size is correct. Also add some `track_caller` for debugging, while we are at it. r? ```@oli-obk```
2022-08-09Add option to `mir::MutVisitor` to not invalidate CFG.Jakob Degen-63/+92
This also applies that option to some uses of the visitor
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-02remove some unused code and typesRalf Jung-20/+2
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-30avoid assertion failures in try_to_scalar_intRalf Jung-1/+3
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