about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/mir
AgeCommit message (Collapse)AuthorLines
2022-06-03Replace `&Vec<_>`s with `&[_]`sMaybe Waffle-3/+3
2022-06-02add cast kind of from_exposed_addr (int-to-ptr casts)Ralf Jung-1/+7
2022-06-01rename PointerAddress → PointerExposeAddressRalf Jung-4/+5
2022-05-31Add a pointer to address cast kindTomasz Miąsko-17/+10
A pointer to address cast are often special-cased. Introduce a dedicated cast kind to make them easy distinguishable.
2022-05-30Auto merge of #97025 - ouz-a:mini-derefer-generator, r=davidtwcobors-3/+5
Add validation layer for Derefer _Follow up work to #96549 #96116 #95857 #95649_ This adds validation for Derefer making sure it is always the first projection. r? rust-lang/mir-opt
2022-05-30validate derefer, run derefer inside generatorouz-a-3/+5
2022-05-29Auto merge of #97214 - Mark-Simulacrum:stage0-bump, r=pietroalbinibors-3/+3
Finish bumping stage0 It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though. This now brings us to cfg-clean, with the exception of check-cfg-features in bootstrap; I'd prefer to leave that for a separate PR at this time since it's likely to be more tricky. cc https://github.com/rust-lang/rust/pull/97147#issuecomment-1132845061 r? `@pietroalbini`
2022-05-28Make TyCtxt implement Interner, make HashStable generic and move to ↵Michael Goulet-7/+7
rustc_type_ir
2022-05-28Move things to rustc_type_irWilco Kusee-9/+9
2022-05-28Auto merge of #97158 - JakobDegen:dse, r=tmiasko,cjgillotbors-0/+17
Split dead store elimination off dest prop This splits off a part of #96451 . I've added this in as its own pass for now, so that it actually runs, can be tested, etc. In the dest prop PR, I'll stop invoking this as its own pass, so that it doesn't get invoked twice. r? `@tmiasko`
2022-05-28Auto merge of #97284 - b-naber:constraint-dyn-impl-suggestion, r=estebankbors-4/+7
Add suggestion for relaxing static lifetime bounds on dyn trait impls in NLL This PR introduces suggestions for relaxing static lifetime bounds on impls of dyn trait items for NLL similar to what is already available in lexical region diagnostics. Fixes https://github.com/rust-lang/rust/issues/95701 r? `@estebank`
2022-05-27Finish bumping stage0Mark Rousskov-3/+3
It looks like the last time had left some remaining cfg's -- which made me think that the stage0 bump was actually successful. This brings us to a released 1.62 beta though.
2022-05-27Auto merge of #96046 - oli-obk:const_typeck, r=cjgillotbors-7/+0
Move various checks to typeck so them failing causes the typeck result to get tainted Fixes #69487 fixes #79047 cc `@RalfJung` this gets rid of the `Transmute` invalid program error variant
2022-05-26clippy::complexity fixesMatthias Krüger-2/+1
clone_on_copy useless_format bind_instead_of_map filter_map_identity useless_conversion map_flatten unnecessary_unwrap
2022-05-26rebase, use Ty in CallArgument and re-insert static_assert_size on ↵b-naber-2/+8
ConstraintCategory
2022-05-25add def_id and substs to ConstraintCategory::CallArgumentb-naber-7/+4
2022-05-24Add dead store elimination passJakob Degen-0/+17
2022-05-24Add the transmute and asm checks to typeck as deferred checksOli Scherer-7/+0
2022-05-23Refactor call terminator to always hold a destination placeJakob Degen-41/+33
2022-05-22Lifetime variance fixes for rustcMichael Goulet-21/+24
2022-05-22Rollup merge of #97259 - jyn514:fix-typo, r=JohnTitorYuki Okushi-1/+1
Fix typo in Mir phase docs
2022-05-21Auto merge of #96515 - lcnr:user-types-in-pat, r=nikomatsakisbors-2/+3
correctly deal with user type ascriptions in pat supersedes #93856 `thir::PatKind::AscribeUserType` previously resulted in `CanonicalUserTypeAnnotations` where the inferred type already had a subtyping relation according to `variance` to the `user_ty`. The bug can pretty much be summarized as follows: - during mir building - `user_ty -> inferred_ty`: considers variance - `StatementKind::AscribeUserType`: `inferred_ty` is the type of the place, so no variance needed - during mir borrowck - `user_ty -> inferred_ty`: does not consider variance - `StatementKind::AscribeUserType`: applies variance This mostly worked fine. The lifetimes in `inferred_ty` were only bound by its relation to `user_ty` and to the `place` of `StatementKind::AscribeUserType`, so it doesn't matter where exactly the subtyping happens. It does however matter when having higher ranked subtying. At this point the place where the subtyping happens is forced, causing this mismatch between building and borrowck to result in unintended errors. cc #96514 which is pretty much the same issue r? `@nikomatsakis`
2022-05-21Fix typo in Mir phase docsJoshua Nelson-1/+1
2022-05-21update mir user type printing and apparently fix an ICElcnr-2/+3
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-2/+2
2022-05-20Rollup merge of #97185 - RalfJung:number-validity, r=oli-obkGuillaume Gomez-4/+7
interpret/validity: separately control checking numbers for being init and non-ptr This lets Miri control this in a more fine-grained way. r? `@oli-obk`
2022-05-19interpret/validity: separately control checking numbers for being init and ↵Ralf Jung-4/+7
non-ptr
2022-05-18Auto merge of #97019 - b-naber:transition-to-valtrees-pt1, r=oli-obkbors-8/+79
Transition to valtrees pt1 Compartmentalising https://github.com/rust-lang/rust/pull/96591 as much as possible. r? `@oli-obk`
2022-05-17Change `Successors` to `impl Iterator<Item = BasicBlock>`SparrowLii-35/+34
2022-05-16use GlobalId in eval_to_valtree query and introduce query for ↵b-naber-8/+79
valtree_to_const_val
2022-05-14Auto merge of #96883 - jackh726:early-binder-2, r=oli-obkbors-2/+4
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-5/+8
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_type_ofJack Huey-4/+4
2022-05-13Rustc changes for permissive provenancecarbotaniuman-5/+8
2022-05-12Auto merge of #96889 - Aaron1011:place-ref-remove, r=compiler-errorsbors-1/+7
Remove `PartialOrd`/`Ord` impl for `PlaceRef` This is a new attempt at #93315. It removes one usage of the `Ord` impl for `DefId`, which should make it easier to eventually remove that impl.
2022-05-12Auto merge of #96150 - est31:unused_macro_rules, r=petrochenkovbors-0/+3
Implement a lint to warn about unused macro rules This implements a new lint to warn about unused macro rules (arms/matchers), similar to the `unused_macros` lint added by #41907 that warns about entire macros. ```rust macro_rules! unused_empty { (hello) => { println!("Hello, world!") }; () => { println!("empty") }; //~ ERROR: 1st rule of macro `unused_empty` is never used } fn main() { unused_empty!(hello); } ``` Builds upon #96149 and #96156. Fixes #73576
2022-05-11Remove `PartialOrd`/`Ord` impl for `PlaceRef`Aaron Hill-1/+7
This is a new attempt at #93315. It removes one usage of the `Ord` impl for `DefId`, which should make it easier to eventually remove that impl.
2022-05-10Introduce EarlyBinderJack Huey-4/+6
2022-05-08Use sparse representation of switch sourcesTomasz Miąsko-9/+7
to avoid quadratic space overhead
2022-05-08Avoid constructing switch sources unless necessaryTomasz Miąsko-0/+2
Switch sources are used by backward analysis with a custom switch int edge effects, but are otherwise unnecessarily computed. Delay the computation until we know that switch sources are indeed required and avoid the computation otherwise.
2022-05-07Rollup merge of #96581 - RalfJung:debug-size-align, r=oli-obkGuillaume Gomez-2/+8
make Size and Align debug-printing a bit more compact In particular in `{:#?}`-mode, these take up a lot of space, so I think this is the better alternative (even though it is a bit longer in `{:?}` mode, I think it is still more readable). We could make it even smaller by deviating further from what the actual code looks like, e.g. via something like `Size(4 bytes)`. Not sure what people would think about that? Cc `````@oli-obk`````
2022-05-07Auto merge of #96094 - Elliot-Roberts:fix_doctests, r=compiler-errorsbors-47/+50
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-06don't debug-print ConstValue in MIR pretty-printerRalf Jung-2/+8
2022-05-05Allow unused rules in some places in the compiler, library and toolsest31-0/+3
2022-05-03Update `ProjectionElem::Downcast` documentationTomasz Miąsko-4/+2
`ProjectionElem:::Downcast` is used when downcasting to a variant of an enum or a generator, regardless of the number of variants.
2022-05-03Rollup merge of #96599 - tmiasko:discriminant-docs, r=estebankYuki Okushi-5/+1
Update `RValue::Discriminant` documentation `RValue::Discriminant` returns zero for types without discriminant. This guarantee is already documented for `discriminant_value` intrinsics which is implemented in terms of `RValue::Discriminant`.
2022-05-02fix most compiler/ doctestsElliot Roberts-47/+50
2022-05-01Auto merge of #96549 - ouz-a:mir-opt, r=oli-obkbors-2/+15
Move Derefer before Retag _Follow up work to #96116 #95857 #95649_ This moves `Derefer` before `Retag` and creates a new `LocalInfo` called `Temp` to avoid retagging created temp values. Zulip discussion [link](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/deref.20as.20first.20and.20only.20projection) r? `@oli-obk`
2022-05-01re-name stuffouz-a-7/+9
2022-05-01Update `RValue::Discriminant` documentationTomasz Miąsko-5/+1
`RValue::Discriminant` returns zero for types without discriminant. This guarantee is already documented for `discriminant_value` intrinsics which is implemented in terms of `RValue::Discriminant`.