summary refs log tree commit diff
path: root/src/test/ui/borrowck
AgeCommit message (Collapse)AuthorLines
2018-12-04Update testsOliver Scherer-25/+52
2018-11-18Remove mir::StatementKind::EndRegionMatthew Jasper-1/+1
Since lexical MIR borrow check is gone, and validation no longer uses these, they can be removed.
2018-11-11Auto merge of #55657 - davidtwco:issue-55651, r=pnkfelixbors-25/+13
NLL Diagnostic Review 3: Unions not reinitialized after assignment into field Fixes #55651, #55652. This PR makes two changes: First, it updates the dataflow builder to add an init for the place containing a union if there is an assignment into the field of that union. Second, it stops a "use of uninitialized" error occuring when there is an assignment into the field of an uninitialized union that was previously initialized. Making this assignment would re-initialize the union, as tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`. The check for previous initialization ensures that we do not start supporting partial initialization yet (cc #21232, #54499, #54986). This PR also fixes #55652 which was marked as requiring investigation as the changes in this PR add an error that was previously missing (and mentioned in the review comments) and confirms that the error that was present is correct and a result of earlier partial initialization changes in NLL. r? @pnkfelix (due to earlier work with partial initialization) cc @nikomatsakis
2018-11-11Rollup merge of #55801 - pnkfelix:update-box-insensitivity-test-for-nll, ↵Pietro Albini-86/+103
r=davidtwco NLL: Update box insensitivity test This is just keeping one of our tests honest with respect to NLL, in two ways: 1. Adds uses of borrows that would otherwise be too short to observe the error that we would have expected to see... 2. ... I say "would have expected" because all of the errors in this file are part of the reversion of rust-lang/rfcs#130 that is attached to NLL (you can see more discussion of this here https://github.com/rust-lang/rust/issues/43234#issuecomment-411017768 )
2018-11-10Auto merge of #55637 - ↵bors-0/+31
pnkfelix:issue-55552-dont-attempt-to-ascribe-projections-out-of-a-ty-var, r=nikomatsakis Do not attempt to ascribe projections out of a ty var If we encounter `_` ascribed to structural pattern like `(a, b)`, just skip relate_types. Fix #55552
2018-11-09Fix the expected error annotations.Felix S. Klock II-65/+65
(The commit prior to this actual passes our test suite, "thanks" to #55695. But since I am aware of that bug, I took advantage of it in choosing how to order my commit series...)
2018-11-09Switch to using `// revisions` to explicit encode NLL's change to `Box` ↵Felix S. Klock II-8/+22
treatment.
2018-11-09Make test robust to NLL, in sense of ensuring borrows extend to something ↵Felix S. Klock II-14/+17
approximating lexical scope.
2018-11-05Make `ui/borrowck/borrowck-overloaded-call.rs` robust w.r.t. NLL.Felix S. Klock II-3/+16
2018-11-05Update `ui/borrowck/borrowck-closures-mut-of-imm.rs` robust w.r.t. NLL.Felix S. Klock II-25/+43
2018-11-05Add `ui/borrowck/borrowck-closures-mut-of-mut.rs`.Felix S. Klock II-0/+56
This is a variant of `ui/borrowck/borrowck-closures-mut-of-imm.rs` that I used to help identify what changes I needed to make to the latter file in order to recover its instances of E0524 under NLL. (Basically this test includes the changes you'd need to make to `ui/borrowck/borrowck-closures-mut-of-imm.rs` in order to get rid of occurrences of E0596. And then I realized that one needs to add invocations of the closures in order to properly extend the mutable reborrows in a manner such that NLL will roughly match AST-borrowck.)
2018-11-05Make `ui/borrowck/borrowck-unboxed-closures.rs` robust w.r.t. NLL.Felix S. Klock II-3/+16
2018-11-05Make `ui/borrowck/borrowck-reborrow-from-mut.rs` robust w.r.t. NLL.Felix S. Klock II-19/+135
2018-11-05Make `ui/borrowck/borrowck-overloaded-index-move-index.rs` robust w.r.t. NLL.Felix S. Klock II-2/+31
2018-11-05Switch to using revisions in borrowck-lend-flow-loop.rsFelix S. Klock II-41/+41
Most of the time we want to robustify tests, but in this case this test is deliberately encoding artifacts of AST-borrowck. So instead of adding artificial uses that would obscure the aspects of AST-borrowck that are being tests, we instead use revisions and then mark the cases that apply to NLL as well as AST-borrowck.
2018-11-03Unions reinitialized after assignment into field.David Wood-25/+13
This commit makes two changes: First, it updates the dataflow builder to add an init for the place containing a union if there is an assignment into the field of that union. Second, it stops a "use of uninitialized" error occuring when there is an assignment into the field of an uninitialized union that was previously initialized. Making this assignment would re-initialize the union, as tested in `src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr`. The check for previous initialization ensures that we do not start supporting partial initialization yet (cc #21232, #54499, #54986).
2018-11-03Regression test for issue 55552.Felix S. Klock II-0/+31
2018-10-30Rollup merge of #55494 - ↵kennytm-32/+233
pnkfelix:issue-55492-borrowck-migrate-must-look-at-parents-of-closures, r=davidtwco borrowck=migrate must look at parents of closures This fixes the NLL migration mode (which is the default with edition=2018) to inspect all parents of a closure in addition to the closure itself when looking to see if AST-borrowck issues an error for the given code. This should be a candidate for beta backport. Fix #55492
2018-10-30Update compare-mode=nll stderr files to reflect the fix to #55492.Felix S. Klock II-32/+9
2018-10-30Regression test for issue 55492.Felix S. Klock II-0/+224
2018-10-29Don't emit cannot move errors twice in migrate modeMatthew Jasper-334/+13
2018-10-27Auto merge of #55150 - ↵bors-2/+46
pnkfelix:issues-47215-54797-fix-ice-from-moving-out-of-thread-local-under-ast-borrowck, r=nikomatsakis Do not allow moving out of thread local under ast borrowck AST borrowck failed to prevent moving out of a thread-local static. This was broken. And it also (sometimes?) caused an ICE during drop elaboration. Fix #47215 Fix #54797
2018-10-21Use new region infer errors for explaining borrowsMatthew Jasper-200/+149
This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable.
2018-10-20Give an error number for "borrowed data escapes outside of closure"Matthew Jasper-2/+3
2018-10-18Rollup merge of #55090 - pnkfelix:issue-54597-regression-test, r=estebankkennytm-0/+34
regression test for move out of borrow via pattern regression test for issue #54597. (We may have other tests that cover this, but I couldn't immediately find them associated with the PR that originally fixed the ICE here.)
2018-10-17Auto merge of #55134 - davidtwco:issue-55118, r=pnkfelixbors-86/+348
NLL: change compare-mode=nll to use borrowck=migrate Fixes #55118. This PR is split into two parts: The first commit is a minor change that fixes a flaw in the existing `borrowck=migrate` implementation whereby a lint that was promoted to an error in the AST borrow checker would result in the same lint from the NLL borrow checker being downgraded to a warning in migrate mode. This PR fixes this by ensuring lints are exempt from buffering in the NLL borrow checker. The second commit updates `compiletest` to make the NLL compare mode use `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The third commit shows all the test output changes that result from this. r? @pnkfelix
2018-10-17Add regression test for issue 47215.Felix S. Klock II-0/+44
2018-10-17Update existing tests and .stderr files to reflect introduction of ↵Felix S. Klock II-2/+2
thread-local mem category.
2018-10-17Some new tests I added.Felix S. Klock II-0/+697
2018-10-17Update output for borrowck=migrate compare mode.David Wood-86/+348
This commit updates the test output for the updated NLL compare mode that uses `-Z borrowck=migrate` rather than `-Z borrowck=mir`. The previous commit changes `compiletest` and this commit only updates `.nll.stderr` files.
2018-10-16updates to existing ui/borrowck tests.Felix S. Klock II-142/+137
2018-10-15regression test for issue #54597Felix S. Klock II-0/+34
2018-10-13Auto merge of #54945 - estebank:asm-span, r=petrochenkovbors-24/+24
Point to variable in `asm!` macro when failing borrowck Fix #34940.
2018-10-12Rollup merge of #54825 - davidtwco:issue-52663-deref-raw-pointer, r=pnkfelixkennytm-2/+2
NLL says "borrowed content" instead of more precise "dereference of raw pointer" Part of #52663. Previously, move errors involving the dereference of a raw pointer would say "borrowed content". This commit changes it to say "dereference of raw pointer". r? @nikomatsakis cc @pnkfelix
2018-10-09Point to variable in `asm!` macro when failing borrowckEsteban Küber-24/+24
2018-10-09Improve message for closure returning a closure.David Wood-2/+2
Now when a `FnMut` closure is returning a closure that contains a reference to a captured variable, we provide an error that makes it more clear what is happening.
2018-10-09Improve errors for `FnMut` closures.David Wood-17/+13
This commit improves the errors for `FnMut` closures where a reference to a captured variable is escaping.
2018-10-08Move errors specify "dereference of raw pointer".David Wood-2/+2
Previously, move errors involving the dereference of a raw pointer would say "borrowed content". This commit changes it to say "dereference of raw pointer".
2018-10-07Auto merge of #54835 - ↵bors-6/+4
oli-obk:mögen_konstante_funktionen_doch_bitte_endlich_stabil_sein, r=Centril Stabilize `min_const_fn` tracking issue: #53555 r? @Centril
2018-10-05Stabilize `min_const_fn`Oliver Schneider-6/+4
2018-10-05Auto merge of #54703 - davidtwco:issue-52086, r=nikomatsakisbors-4/+13
error message when trying to move from an Rc or Arc is ungreat Fixes #52086. r? @nikomatsakis
2018-10-03Clearer later use messages for callsMatthew Jasper-420/+354
Give a special message when the later use is from a call. Use the span of the callee instead of the whole expression. For conflicting borrow messages say that the later use is of the first borrow.
2018-10-02Auto merge of #54343 - blitzerr:master, r=nikomatsakisbors-10/+10
First shot at #54015 Closes #54015
2018-10-01Add special cases for move from `Rc`/`Arc` errors.David Wood-4/+13
This commit special cases the move out of borrowed content error, previously: ``` error[E0507]: cannot move out of borrowed content --> src/main.rs:7:10 | 7 | drop(x.field); | ^ cannot move out of borrowed content ``` to instead mention that it is a move out of a `Rc`/`Arc` which is more helpful: ``` error[E0507]: cannot move out of an `Rc` --> src/main.rs:7:10 | 7 | drop(x.field); | ^ cannot move out of an `Rc` ```
2018-09-28Test fixes for the change of error message for issue #54015Rusty Blitzerr-10/+10
2018-09-27Enable NLL compare mode for more testsMatthew Jasper-8/+44
These tests were disabled due to NLL bugs that have since been fixed.
2018-09-25Change the diagnostic number from 714 to 716.Felix S. Klock II-12/+12
2018-09-25add "temporary value dropped while borrowed" errorMikhail Modin-24/+42
Issue #54131
2018-09-24Update ui testsMatthew Jasper-518/+55
2018-09-23Auto merge of #54310 - pnkfelix:issue-52059-report-borrow-drop-conflict, ↵bors-4/+4
r=nikomatsakis Report when borrow could cause `&mut` aliasing during Drop We were already issuing an error for the cases where this cropped up, so this is not fixing any soundness holes. The previous diagnostic just wasn't accurately describing the problem in the user's code. Fix #52059