about summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
2019-03-31Fixes for shallow borrowsMatthew Jasper-2/+2
* Don't promote these borrows if we're going to remove them before codegen * Correctly mark unreachable code
2019-03-24Auto merge of #59382 - davidtwco:rfc-2008-refactoring, r=petrochenkovbors-2/+2
Separate `DefId`s for variants and their constructors Part of #44109. Split off from #59376. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov
2019-03-24Merge `DefPathData::VariantCtor` and `DefPathData::StructCtor`Vadim Petrochenkov-2/+2
2019-03-24Rollup merge of #59251 - matthewjasper:fix-graphviz, r=petrochenkovkennytm-0/+23
Use a valid name for graphviz graphs Hiridification has broken graphviz output because `HirId` has a more complex display implemetation than `NodeId`. Since the id was just used to generate a distinct identifier, we just pull out the various constituent indexed.
2019-03-24Separate variant id and variant constructor id.David Wood-2/+2
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-21Auto merge of #58902 - matthewjasper:generator-cleanup-blocks, r=davidtwcobors-20/+63
Fixes for the generator transform * Moves cleanup annotations in pretty printed MIR so that they can be tested * Correctly determines which drops are in cleanup blocks when elaborating generator drops * Use the correct state for poisoning a generator Closes #58892
2019-03-19Run branch cleanup after copy propOliver Scherer-0/+22
2019-03-17Use a valid name for graphviz graphsMatthew Jasper-0/+23
2019-03-16Rollup merge of #59036 - dlrobertson:fix_59021, r=estebankkennytm-0/+18
Fix ICE in MIR pretty printing A `Def::Variant` should be considered as a function in mir pretty printing. Each variant has a constructor that we must print. Given the following enum definition: ```rust pub enum TestMe { X(usize), } ``` We will need to generate a constructor for the variant `X` with a signature that looks something like the following: ``` fn TestMe::X(_1: usize) -> TestMe; ``` Fixes: #59021
2019-03-15rustc: provide DisambiguatedDefPathData in ty::print.Eduard-Mihai Burtescu-1/+1
2019-03-15rustc: rename item_path to def_path (except the module in ty).Eduard-Mihai Burtescu-1/+1
2019-03-15rustc: explicitly pass the namespace to PrintCx::parameterized.Eduard-Mihai Burtescu-5/+5
2019-03-10Fix ICE in MIR pretty printingDan Robertson-0/+18
A `Def::Variant` should be considered as a function in mir pretty printing. Each variant has a constructor that we must print. Given the following enum definition: ``` pub enum TestMe { X(usize), } ``` We will need to generate a constructor for the variant `X` with a signature that looks something like the following: ``` fn TestMe::X(_1: usize) -> TestMe; ```
2019-03-07HirIdification: replace NodeId method callsljedrz-3/+3
2019-03-03Don't incorrectly mark blocks in generator drop shims as cleanupMatthew Jasper-0/+43
This also ensure that dropping a generator won't leak upvars if dropping one of them panics
2019-03-03Check which blocks are cleanup in mir-opt testsMatthew Jasper-20/+20
2019-02-21Move the exit block of the match to the endMatthew Jasper-121/+121
2019-02-21Simplify the cleanup_post_borrowck passesMatthew Jasper-5/+5
2019-02-21Use normal mutable borrows in MIR match loweringMatthew Jasper-64/+60
2019-02-21Clean up MIR match loweringMatthew Jasper-270/+259
* Adjust fake borrows to only be live over guards. * Remove unused `slice_len_checked` field. * Split the methods on builder into those for matches and those for all kinds of pattern bindings.
2019-02-15Always emit an error for a query cycleJohn Kåre Alsaker-14/+14
2019-02-10Add test for MIR printing changesMatthew Jasper-0/+66
2019-01-19Don't ignore `_` in type casts and ascriptionsMatthew Jasper-7/+7
2019-01-19Rename UserTypeAnnotation -> UserTypeMatthew Jasper-1/+1
2018-12-30Refactor `UserTypeAnnotation`.David Wood-1/+1
This commit refactors the `UserTypeAnnotation` type to be referred to by an index within `UserTypeProjection`. `UserTypeAnnotation` is instead kept in an `IndexVec` within the `Mir` struct. Further, instead of `UserTypeAnnotation` containing canonicalized types, it now contains normal types and the entire `UserTypeAnnotation` is canonicalized. To support this, the type was moved from the `rustc::mir` module to `rustc::ty` module.
2018-12-25Remove licensesMark Rousskov-319/+0
2018-12-20Auto merge of #54125 - varkor:less-conservative-uninhabitedness-check, ↵bors-0/+37
r=nikomatsakis Less conservative uninhabitedness check Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays. Pulled out of #47291 and #50262. Fixes https://github.com/rust-lang/rust/issues/54586. r? @nikomatsakis
2018-12-18treat ref-to-raw cast like a reborrow: do a special kind of retagRalf Jung-1/+1
2018-12-17Auto merge of #56810 - sinkuu:build_match, r=oli-obkbors-0/+85
Improve MIR match generation for ranges Improves MIR match generation to rule out ranges/values distinct from the range that has been tested. e.g., for this code: ```rust match x { 0..=5 if b => 0, 6..=10 => 1, _ => 2, } ``` MIR (before): ```rust bb0: { ...; _4 = Le(const 0i32, _1); switchInt(move _4) -> [false: bb6, otherwise: bb5]; } bb1: { _3 = const 0i32; goto -> bb8; } bb2: { _6 = _2; switchInt(move _6) -> [false: bb6, otherwise: bb1]; } // If `!b`, jumps to test if `6 <= x <= 10`. bb3: { _3 = const 1i32; goto -> bb8; } bb4: { _3 = const 2i32; goto -> bb8; } bb5: { _5 = Le(_1, const 5i32); switchInt(move _5) -> [false: bb6, otherwise: bb2]; } bb6: { _7 = Le(const 6i32, _1); switchInt(move _7) -> [false: bb4, otherwise: bb7]; } bb7: { _8 = Le(_1, const 10i32); switchInt(move _8) -> [false: bb4, otherwise: bb3]; } ``` MIR (after): ```rust bb0: { ...; _4 = Le(const 0i32, _1); switchInt(move _4) -> [false: bb5, otherwise: bb6]; } bb1: { _3 = const 0i32; goto -> bb8; } bb2: { _6 = _2; switchInt(move _6) -> [false: bb4, otherwise: bb1]; } // If `!b`, jumps to `_ =>` arm. bb3: { _3 = const 1i32; goto -> bb8; } bb4: { _3 = const 2i32; goto -> bb8; } bb5: { _7 = Le(const 6i32, _1); switchInt(move _7) -> [false: bb4, otherwise: bb7]; } bb6: { _5 = Le(_1, const 5i32); switchInt(move _5) -> [false: bb5, otherwise: bb2]; } bb7: { _8 = Le(_1, const 10i32); switchInt(move _8) -> [false: bb4, otherwise: bb3]; } ``` cc #29623
2018-12-17tidyShotaro Yamada-1/+1
2018-12-17Add MIR testShotaro Yamada-0/+85
2018-12-13Make SimplifyCfg collapse goto chains from bb0Shotaro Yamada-0/+54
2018-12-11Add a mir-opt testvarkor-0/+37
2018-11-18Simplify MIR drop generationMatthew Jasper-34/+7
Now that EndRegion is gone, we don't need to create as many gotos.
2018-11-18Remove mir::StatementKind::EndRegionMatthew Jasper-1069/+1
Since lexical MIR borrow check is gone, and validation no longer uses these, they can be removed.
2018-11-15Auto merge of #55716 - RalfJung:escape-to-raw, r=oli-obkbors-4/+68
Add escape-to-raw MIR statement Add a new MIR "ghost state statement": Escaping a ptr to permit raw accesses. ~~This includes #55549, [click here](https://github.com/RalfJung/rust/compare/miri-visitor...RalfJung:escape-to-raw) for just the new commits.~~
2018-11-09Don't inline virtual calls (take 2)Wesley Wiser-0/+36
When I fixed the previous mis-optimizations, I didn't realize there were actually two different places where we mutate `callsites` and both of them should have the same behavior. As a result, if a function was inlined and that function contained virtual function calls, they were incorrectly being inlined. I also added a test case which covers this.
2018-11-07array index accesses are stable placesRalf Jung-0/+43
2018-11-07no more action on ref or cast, but add new MIR statement for escaping a ptr ↵Ralf Jung-4/+25
to raw
2018-11-02Auto merge of #55316 - RalfJung:retagging, r=oli-obkbors-349/+151
Add Retagging statements This adds a `Retag` statement kind to MIR, used to perform the retagging operation from [Stacked Borrows](https://www.ralfj.de/blog/2018/08/07/stacked-borrows.html). It also kills the old `Validate` statements that I added last year. NOTE: This includes https://github.com/rust-lang/rust/pull/55270. Only [these commits are new](https://github.com/RalfJung/rust/compare/stacked-borrows-ng...RalfJung:retagging).
2018-11-02Auto merge of #55305 - nikomatsakis:universes-refactor-3, r=scalexmbors-1/+1
universes refactor 3 Some more refactorings from my universe branch. These are getting a bit more "invasive" -- they start to plumb the universe information through the canonicalization process. As of yet though I don't **believe** this branch changes our behavior in any notable way, though I'm marking the branch as `WIP` to give myself a chance to verify this. r? @scalexm
2018-10-29make inliner remove the fn_entry flag on Retag statementsRalf Jung-0/+45
2018-10-29Remove validation test cases; add retagging test caseRalf Jung-349/+106
2018-10-28Rollup merge of #55199 - oli-obk:instance_printing, r=davidtwcokennytm-10/+10
Impl items have generics
2018-10-27allow canonicalized regions to carry universe and track max-universeNiko Matsakis-1/+1
But.. we don't really use it for anything right now.
2018-10-26Update mir-opt tests to reflect change to `AscribeUserType` to carry a ↵Felix S. Klock II-1/+1
`UserTypeProjection`.
2018-10-26Update testsOliver Scherer-10/+10
2018-10-26Fix tests and assertions; add some commentsNick Cameron-133/+133
2018-10-26Fix tests and rustdocNick Cameron-24/+24
2018-10-15fix mir-opt testNiko Matsakis-1/+1