summary refs log tree commit diff
path: root/src/test/ui/borrowck
AgeCommit message (Collapse)AuthorLines
2018-11-10Regression test for issue 55552.Felix S. Klock II-0/+31
2018-10-31Update compare-mode=nll stderr files to reflect the fix to #55492.Felix S. Klock II-32/+9
2018-10-31Regression test for issue 55492.Felix S. Klock II-0/+224
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-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
2018-09-19Auto merge of #53995 - davidtwco:issue-53807, r=nikomatsakisbors-35/+1
NLL: Deduplicate errors for incorrect move in loop Fixes #53807. r? @nikomatsakis
2018-09-18Switched from FxHashMap to BTreeMap to preserve ordering when iterating.David Wood-8/+8
2018-09-18De-duplicate moved variable errors.David Wood-43/+9
By introducing a new map that tracks the errors reported and the `Place`s that spawned those errors against the move out that the error was referring to, we are able to silence duplicate errors by emitting only the error which corresponds to the most specific `Place` (that which other `Place`s which reported errors are prefixes of). This generally is an improvement, however there is a case - `liveness-move-in-while` - where the output regresses.
2018-09-18Updates to tests reflecting the diangostic changes in previous commit.Felix S. Klock II-4/+4
It is worth pointing out that the reason that so few diagnostics are effected is because of the filter I put in where it only goes down the new path if the borrowed place is *not* a prefix of the dropped place. (Without that filter, a *lot* of the tests would need this change, and it would probably be a net loss for the UX, since you'd see it even in cases like borrows of generic types where there is no explicit mention of `Drop`.)
2018-09-17On nightly with NLL, suggest `#![feature(bind_by_move_pattern_guards)]` when ↵Felix S. Klock II-0/+24
it might fix the code.
2018-09-16Auto merge of #54157 - euclio:structured-suggestion, r=estebankbors-43/+43
use structured suggestion for "missing mut" label Fixes #54133 for both NLL and non-NLL. r? @estebank I'm not super happy with the existing wording here, since it's now a suggestion. I wonder if the message would work better as something like "help: make binding mutable: `mut foo`"? Also, are the `HELP` and `SUGGESTION` comments necessary?
2018-09-12use structured suggestion for "missing mut" labelAndy Russell-43/+43
Fixes #54133.
2018-09-09Suggest a let binding to extend temporary lifetimes with NLLMatthew Jasper-0/+3
2018-09-08Rollup merge of #53932 - matthewjasper:remove-base-path, r=nikomatsakiskennytm-24/+14
[NLL] Remove base_place This function was supposed to make `Box` less special. But * I think that the consensus is that MIR borrowck is going to fully special case `Box` * It wasn't implemented correctly, it's looking at the type of the wrong `Place`, resulting in weird behaviour: ```rust #![feature(nll)] type A = Box<i32>; // If this is changed to another type then this will compile. pub fn foo(x: Box<(String, A)>) { let a = x.0; // This will compile if these lines are swapped let b = x.1; } ``` r? @nikomatsakis
2018-09-07Auto merge of #54021 - kennytm:rollup, r=kennytmbors-0/+692
Rollup of 17 pull requests Successful merges: - #53299 (Updated core/macros.rs to note it works in a no_std environment.) - #53376 (Cross reference io::copy and fs::copy in docs.) - #53455 (Individual docs for {from,to}_*_bytes) - #53550 (librustc_lint: In recursion warning, change 'recurring' to 'recursing') - #53860 (Migrate (some) of run-pass/ to ui) - #53874 (Implement Unpin for Box, Rc, and Arc) - #53895 (tidy: Cleanups and clippy warning fixes) - #53946 (Clarify `ManuallyDrop` docs) - #53948 (Minimized clippy test from when NLL disabled two-phase borrows) - #53959 (Add .git extension to submodule paths missing it) - #53966 (A few cleanups and minor improvements to mir/dataflow) - #53967 (propagate build.python into cmake) - #53979 (Remove `#[repr(transparent)]` from atomics) - #53991 (Add unchecked_shl/shr check for intrinsics to fix miri's test suit) - #53992 (migrate run-pass/borrowck to ui/run-pass) - #53994 (migrate run-pass/*/ to ui/run-pass) - #54023 (update clippy submodule)
2018-09-07Auto merge of #53830 - davidtwco:issue-53228, r=nikomatsakisbors-0/+44
Add help message for missing IndexMut impl with NLL Fixes #53228. r? @nikomatsakis
2018-09-04Minimized (and then greatly expanded) test of failure cases from ↵Felix S. Klock II-0/+692
rust-lang/rust#52934.
2018-09-03remove base_placeMatthew Jasper-24/+14
2018-09-03Auto merge of #53865 - zilbuz:issue-52768, r=pnkfelixbors-38/+1
Remove 'not reporting regions error due to nll' warning Fix #52768
2018-09-01Update testsBasile Desloges-38/+1
2018-08-31Restrict most uses of `const_fn` to `min_const_fn`Oliver Schneider-1/+1
2018-08-31Omit 'missing IndexMut impl' suggestion when IndexMut is implemented.David Wood-0/+40
2018-08-30Added help message for missing IndexMut impl.David Wood-0/+4
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-1/+1
Fix typos found by codespell.
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1
2018-08-19move tests to borrowck directory, remove feature(nll)Niko Matsakis-0/+361
now compare-mode can show us the differences