about summary refs log tree commit diff
path: root/src/test/mir-opt
AgeCommit message (Collapse)AuthorLines
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
2018-10-14[mir-inlining] Don't inline virtual callsWesley Wiser-0/+31
Prior to this change, the test case would output `1` instead of `2` like it should.
2018-10-10Use the span of the user type for `AscribeUserType`Matthew Jasper-1/+1
Also change the order of the fake read for let and the AscribeUserType, so that we use the better span and message from the fake read in errors.
2018-10-05Stabilize `min_const_fn`Oliver Schneider-4/+0
2018-09-25Auto merge of #53438 - matthewjasper:permissive-match-access, r=pnkfelixbors-81/+210
[NLL] Be more permissive when checking access due to Match Partially addresses #53114. notably, we should now have parity with AST borrowck. Matching on uninitialized values is still forbidden. * ~~Give fake borrows for match their own `BorrowKind`~~ * ~~Allow borrows with this kind to happen on values that are already mutably borrowed.~~ * ~~Track borrows with this type even behind shared reference dereferences and consider all accesses to be deep when checking for conflicts with this borrow type. See [src/test/ui/issues/issue-27282-mutate-before-diverging-arm-3.rs](https://github.com/rust-lang/rust/commit/cb5c989598178af505fb215dd97afca8cc2b659f#diff-a2126cd3263a1f5342e2ecd5e699fbc6) for an example soundness issue this fixes (a case of #27282 that wasn't handled correctly).~~ * Create a new `BorrowKind`: `Shallow` (name can be bike-shed) * `Shallow` borrows differ from shared borrows in that * When we check for access we treat them as a `Shallow(Some(_))` read * When we check for conflicts with them, if the borrow place is a strict prefix of the access place then we don't consider that a conflict. * For example, a `Shallow` borrow of `x` does not conflict with any access or borrow of `x.0` or `*x` * Remove the current fake borrow in matches. * When building matches, we take a `Shallow` borrow of any `Place` that we switch on or bind in a match, and any prefix of those places. (There are some optimizations where we do fewer borrows, but this shouldn't change semantics) * `match x { &Some(1) => (), _ => (), }` would `Shallow` borrow `x`, `*x` and `(*x as Some).0` (the `*x` borrow is unnecessary, but I'm not sure how easy it would be to remove.) * Replace the fake discriminant read with a `ReadForMatch`. * Change ReadForMatch to only check for initializedness (to prevent `let x: !; match x {}`), but not conflicting borrows. It is still considered a use for liveness and `unsafe` checking. * Give special cased error messages for this kind of borrow. Table from the above issue after this PR | Thing | AST | MIR | Want | Example | | --- | --- | --- | --- |---| | `let _ = <unsafe-field>` | πŸ’š | πŸ’š | ❌ | [playground](https://play.rust-lang.org/?gist=bb7843e42fa5318c1043d04bd72abfe4&version=nightly&mode=debug&edition=2015) | | `match <unsafe_field> { _ => () }` | ❌ | ❌ | ❌ | [playground](https://play.rust-lang.org/?gist=3e3af05fbf1fae28fab2aaf9412fb2ea&version=nightly&mode=debug&edition=2015) | | `let _ = <moved>` | πŸ’š | πŸ’š | πŸ’š | [playground](https://play.rust-lang.org/?gist=91a6efde8288558e584aaeee0a50558b&version=nightly&mode=debug&edition=2015) | | `match <moved> { _ => () }` | ❌ | ❌ | πŸ’š | [playground](https://play.rust-lang.org/?gist=804f8185040b2fe131f2c4a64b3048ca&version=nightly&mode=debug&edition=2015) | | `let _ = <borrowed>` | πŸ’š | πŸ’š | πŸ’š | [playground](https://play.rust-lang.org/?gist=0e487c2893b89cb772ec2f2b7c5da876&version=nightly&mode=debug&edition=2015) | | `match <borrowed> { _ => () }` | πŸ’š | πŸ’š | πŸ’š | [playground](https://play.rust-lang.org/?gist=0e487c2893b89cb772ec2f2b7c5da876&version=nightly&mode=debug&edition=2015) | r? @nikomatsakis
2018-09-24Update mir opt testsMatthew Jasper-81/+88
2018-09-24Add a MIR transform to remove fake readsMatthew Jasper-0/+122
As we are now creating borrows of places that may not be valid for borrow checking matches, these have to be removed to avoid generating broken code.
2018-09-24Auto merge of #54416 - christianpoveda:master, r=wesleywiserbors-0/+39
Extend MIR inlining to all operand variants This fixes https://github.com/rust-lang/rust/issues/54193 r? @eddyb
2018-09-23Add test to check if inlining works for any operandChristian Poveda-0/+39
2018-09-18Update mir-opt test suiteRémy Rakic-13/+48
2018-09-14Auto merge of #54032 - oli-obk:layout_scalar_ranges, r=eddybbors-7/+7
Add forever unstable attribute to allow specifying arbitrary scalar ranges r? @eddyb for the first commit and @nikomatsakis for the second one
2018-09-11Change debug printing to print in the old concise styleOliver Schneider-7/+7
2018-09-10optimize `let x: T = ..` to avoid a temporaryNiko Matsakis-87/+32
For some weird reason this fixes `intrinsic-move-val`. It also affects various test heuristics. I removed one test (`reborrow_basic`) that didn't seem to really be testing anything in particular anymore, compared to all the other tests we've got.
2018-09-10add the `AscribeUserType` statement kindNiko Matsakis-1/+1
Make it have the semantics of subtype.
2018-09-08Auto merge of #53909 - mikhail-m1:53643, r=nikomatsakisbors-6/+6
Skip a shared borrow of a immutable local variables issue #53643 r? @nikomatsakis
2018-09-06Fix testsWesley Wiser-1/+1
2018-09-06Skip a shared borrow of a immutable local variablesMikhail Modin-6/+6
issue #53643
2018-08-31Restrict most uses of `const_fn` to `min_const_fn`Oliver Schneider-2/+2
2018-08-31Implement the `min_const_fn` feature gateOliver Schneider-95/+57
2018-08-27merge `PointIndexMap` and `RegionValueElements`Niko Matsakis-9/+9
2018-07-26patch up mir-opt testsNiko Matsakis-14/+14
2018-07-23Update mir-opt to promoted changesOliver Schneider-10/+4
2018-07-21delete testsdylan_DPC-110/+0
2018-07-21remove unwanted tests and a reference to it in commentsdylan_DPC-134/+0
2018-07-13Auto merge of #52046 - cramertj:fix-generator-mir, r=eddybbors-1/+149
Ensure StorageDead is created even if variable initialization fails Rebase and slight cleanup of https://github.com/rust-lang/rust/pull/51109 Fixes https://github.com/rust-lang/rust/issues/49232 r? @eddyb
2018-07-12Ensure StorageDead is created even if variable initialization failsTaylor Cramer-1/+149
2018-07-09bump minimum LLVM version to 5.0gnzlbg-3/+0
2018-07-05Auto merge of #51964 - matthewjasper:unused-mut-mir-generation, r=nikomatsakisbors-19/+8
[NLL] Fix various unused mut errors Closes #51801 Closes #50897 Closes #51830 Closes #51904 cc #51918 - keeping this one open in case there are any more issues This PR contains multiple changes. List of changes with examples of what they fix: * Change mir generation so that the parameter variable doesn't get a name when a `ref` pattern is used as an argument ```rust fn f(ref y: i32) {} // doesn't trigger lint ``` * Change mir generation so that by-move closure captures don't get first moved into a temporary. ```rust let mut x = 0; // doesn't trigger lint move || { x = 1; }; ``` * Treat generator upvars the same as closure upvars ```rust let mut x = 0; // This mut is now necessary and is not linted against. move || { x = 1; yield; }; ``` r? @nikomatsakis
2018-07-03Fix various nll unused mut errorsMatthew Jasper-19/+8
2018-07-01update mir-opt testsNiko Matsakis-5/+7
2018-06-27Update MIR opt testsMatthew Jasper-125/+83
2018-06-23Fix codegen testsvarkor-12/+12
2018-05-30rustc: use syntactic (instead of visibility) source info where appropriate.Eduard-Mihai Burtescu-26/+28
2018-05-29Test update: Fallout from ReadForMatch statements + changes to codegen under ↡Felix S. Klock II-112/+125
NLL.
2018-05-27Make &Slice a thin pointerJohn KΓ₯re Alsaker-1/+1
2018-05-19Auto merge of #50603 - eddyb:issue-49955, r=nikomatsakisbors-3/+8
rustc_mir: allow promotion of promotable temps indexed at runtime. Fixes #49955. r? @nikomatsakis
2018-05-16rustc_mir: allow promotion of promotable temps indexed at runtime.Eduard-Mihai Burtescu-1/+2
2018-05-16rustc_mir: generate an extra temporary during borrowed rvalue promotion.Eduard-Mihai Burtescu-2/+6
2018-05-10"fix" test region-liveness-two-disjoint-usesNiko Matsakis-2/+5
We no longer get two disjoint uses. =)
2018-05-04Update mir-opt test to reflect change to MIR code-generation.Felix S. Klock II-53/+61
2018-04-15remove -Znll -- borrowck=mir implies nll nowNiko Matsakis-13/+13