summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
AgeCommit message (Collapse)AuthorLines
2022-05-14Auto merge of #96883 - jackh726:early-binder-2, r=oli-obkbors-13/+15
Add EarlyBinder Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk. Either way, tracking when we have or haven't already substituted out these in rustc can be helpful. As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted. r? `@nikomatsakis`
2022-05-14Auto merge of #95826 - carbotaniuman:miri-permissive-provenance, r=RalfJungbors-3/+20
Initial work on Miri permissive-exposed-provenance Rustc portion of the changes for portions of a permissive ptr-to-int model for Miri. The main changes here are changing `ptr_get_alloc` and `get_alloc_id` to return an Option, and also making ptr-to-int casts have an expose side effect.
2022-05-13Add bound_fn_sigJack Huey-4/+4
2022-05-13Add bound_type_ofJack Huey-2/+4
2022-05-13Rustc changes for permissive provenancecarbotaniuman-3/+20
2022-05-12Use IndexSet for deterministic orderOli Scherer-3/+2
2022-05-12Gracefully handle normalization failures in the prospective inliner cycle ↵Oli Scherer-1/+4
detector
2022-05-10Introduce EarlyBinderJack Huey-17/+17
2022-05-10simplify length countMatthias Krüger-1/+1
2022-05-09reviewlcnr-6/+2
2022-05-09only compute `codegen_fn_attrs` where neededlcnr-1/+6
2022-05-09move `panic-in-drop=abort` check for `drop_in_place`lcnr-9/+7
Whether `drop_in_place` can abort does depend on the `panic-in-drop` option while compiling the current crate, not `core`
2022-05-07Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errorsbors-12/+14
Begin fixing all the broken doctests in `compiler/` Begins to fix #95994. All of them pass now but 24 of them I've marked with `ignore HELP (<explanation>)` (asking for help) as I'm unsure how to get them to work / if we should leave them as they are. There are also a few that I marked `ignore` that could maybe be made to work but seem less important. Each `ignore` has a rough "reason" for ignoring after it parentheses, with - `(pseudo-rust)` meaning "mostly rust-like but contains foreign syntax" - `(illustrative)` a somewhat catchall for either a fragment of rust that doesn't stand on its own (like a lone type), or abbreviated rust with ellipses and undeclared types that would get too cluttered if made compile-worthy. - `(not-rust)` stuff that isn't rust but benefits from the syntax highlighting, like MIR. - `(internal)` uses `rustc_*` code which would be difficult to make work with the testing setup. Those reason notes are a bit inconsistently applied and messy though. If that's important I can go through them again and try a more principled approach. When I run `rg '```ignore \(' .` on the repo, there look to be lots of different conventions other people have used for this sort of thing. I could try unifying them all if that would be helpful. I'm not sure if there was a better existing way to do this but I wrote my own script to help me run all the doctests and wade through the output. If that would be useful to anyone else, I put it here: https://github.com/Elliot-Roberts/rust_doctest_fixing_tool
2022-05-05Rollup merge of #96714 - RalfJung:scalar-pair-debug, r=oli-obkMatthias Krüger-4/+4
interpret/validity: debug-check ScalarPair layout information This would have caught https://github.com/rust-lang/rust/issues/96158. I ran the Miri test suite and it still passes. r? `@oli-obk`
2022-05-05give it a scary nameRalf Jung-4/+4
2022-05-04interpret: debug-check ScalarPair layout informationRalf Jung-3/+3
2022-05-02fix most compiler/ doctestsElliot Roberts-12/+14
2022-05-01re-name stuffouz-a-3/+6
2022-04-29remove and blessouz-a-2/+2
2022-04-29exp-stuff-dirtyouz-a-5/+18
2022-04-28Rollup merge of #96471 - BoxyUwU:let_else_considered_harmful, r=lcnrDylan DPC-3/+1
replace let else with `?` r? `@oli-obk`
2022-04-27tut tut tutEllen-3/+1
2022-04-26Revert "add `DefId` to unsafety violations and display function path in E0133"Oli Scherer-5/+4
This reverts commit 8b8f6653cfd54525714f02efe7af0a0f830e185c.
2022-04-25Auto merge of #96294 - Emilgardis:def_id-in-unsafetyviolationdetails, r=oli-obkbors-5/+8
Display function path in unsafety violations - E0133 adds `DefId` to `UnsafetyViolationDetails` this enables consumers to access the function definition that was reported to be unsafe and also changes the output for some E0133 diagnostics
2022-04-25Auto merge of #96116 - ouz-a:mir-opt, r=oli-obkbors-55/+76
Make derefer work everwhere Follow up work on previous PR's #95649 and #95857. r? rust-lang/mir-opt _Co-Authored-By: `@oli-obk_`
2022-04-25Rollup merge of #96090 - JakobDegen:mir-tests, r=nagisaMatthias Krüger-4/+17
Implement MIR opt unit tests This implements rust-lang/compiler-team#502 . There's not much to say here, this implementation does everything as proposed. I also added the flag to a bunch of existing tests (mostly those to which I could add it without causing huge diffs due to changes in line numbers). Summarizing the changes to test outputs: - Every time an `MirPatch` is created, it adds a cleanup block to the body if it did not exist already. If this block is unused (as is usually the case), it usually gets removed soon after by some pass calling `SimplifyCFG` for unrelated reasons (in many cases this cycle happens quite a few times for a single body). We now run `SimplifyCFG` less often, so those blocks end up in some of our outputs. I looked at changing `MirPatch` to not do this, but that seemed too complicated for this PR. I may still do that in a follow-up. - The `InstCombine` test had set `-C opt-level=0` in its flags and so there were no storage markers. I don't really see a good motivation for doing this, so bringing it back in line with what everything else does seems correct. - One of the `EarlyOtherwiseBranch` tests had `UnreachableProp` running on it. Preventing that kind of thing is the goal of this feature, so this seems fine. For the remaining tests for which this feature might be useful, we can gradually migrate them as opportunities present themselves. In terms of documentation, I plan on submitting a PR to the rustc dev guide in the near future documenting this and other recent changes to MIR. If there's any other places to update, do let me know r? `@nagisa`
2022-04-24only show a simple description in E0133 span labelEmil Gardström-1/+1
2022-04-24add `DefId` to unsafety violations and display function path in E0133Emil Gardström-4/+7
this enables consumers to access the function definition that was reported to be unsafe
2022-04-22use references to avoid function callsSparrowLii-12/+29
2022-04-21access `local_decls` through `ecx`SparrowLii-49/+14
2022-04-17little changesouz-a-4/+4
2022-04-16Address nitsJakob Degen-3/+3
2022-04-16Add support for MIR opt unit testsJakob Degen-4/+17
2022-04-16Make derefer work everwhereouz-a-55/+76
Co-Authored-By: Oli Scherer <332036+oli-obk@users.noreply.github.com>
2022-04-13couple of clippy::complexity fixesMatthias Krüger-2/+2
2022-04-11Remove inlining cost of `Deinit` statementsJakob Degen-0/+1
2022-04-11Add new `MutatatingUseContext`s for deinit and `SetDiscriminant`Jakob Degen-1/+5
2022-04-11Add new `Deinit` statement kindJakob Degen-5/+14
2022-04-10Auto merge of #95889 - Dylan-DPC:rollup-1cmywu4, r=Dylan-DPCbors-8/+8
Rollup of 7 pull requests Successful merges: - #95566 (Avoid duplication of doc comments in `std::char` constants and functions) - #95784 (Suggest replacing `typeof(...)` with an actual type) - #95807 (Suggest adding a local for vector to fix borrowck errors) - #95849 (Check for git submodules in non-git source tree.) - #95852 (Fix missing space in lossy provenance cast lint) - #95857 (Allow multiple derefs to be splitted in deref_separator) - #95868 (rustdoc: Reduce allocations in a `html::markdown` function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-04-10Rollup merge of #95857 - ouz-a:mir-opt, r=oli-obkDylan DPC-8/+8
Allow multiple derefs to be splitted in deref_separator Previously in #95649 only a single deref within projection was supported and multiple derefs caused a bunch of issues, this PR fixes those issues. ```@oli-obk``` helped a ton again ❤️
2022-04-10Avoid accessing HIR from MIR queries.Camille GILLOT-7/+7
2022-04-09remove the if blockouz-a-22/+9
2022-04-09support multiple derefsouz-a-13/+26
2022-04-06Rollup merge of #95649 - ouz-a:mir-opt, r=oli-obkDylan DPC-0/+74
New mir-opt deref_separator This adds a new mir-opt that split certain derefs into this form: `let x = (*a.b).c;` to => `tmp = a.b; let x = (*tmp).c;` Huge thanks to ``@oli-obk`` for his patient mentoring.
2022-04-06Auto merge of #95723 - SparrowLii:const_goto, r=fee1-deadbors-9/+16
enhance `ConstGoto` mir-opt by moving up `StorageDead` statements From the `FIXME` in the implementation of `ConstGoto` miropt. We can move `StorageDead` statements up to the predecessor. This can expand the scope of application of this opt.
2022-04-06enhance `ConstGoto` mir-opt by moving up `StorageDead` statementsSparrowLii-9/+16
2022-04-05kill temp earlyouz-a-2/+1
2022-04-05interp: pass TyCtxt to Machine methods that do not take InterpCxRalf Jung-0/+2
2022-04-05remove region checkouz-a-9/+11
2022-04-05Rollup merge of #95620 - RalfJung:memory-no-extras, r=oli-obkDylan DPC-8/+2
interpret: remove MemoryExtra in favor of giving access to the Machine The Miri PR for this is upcoming. r? ``@oli-obk``