about summary refs log tree commit diff
path: root/src/test/ui/borrowck
AgeCommit message (Collapse)AuthorLines
2018-07-04write code to extract region names and emit new style messageNiko Matsakis-14/+36
2018-06-30Auto merge of #51862 - estebank:lifetime-spans, r=nikomatsakisbors-18/+32
Point to lifetime spans on lifetime errors
2018-06-28Also point to free named region on lifetime errorsEsteban Küber-28/+8
2018-06-28Extend support to `get_generics` for all `NodeItem`sEsteban Küber-2/+2
2018-06-28Point to lifetime in fn definition on lifetime error noteEsteban Küber-1/+21
2018-06-28Point at lifetimes instead of def span for E0195Esteban Küber-13/+27
2018-06-27Update tests for grouped nll move errorsMatthew Jasper-55/+80
2018-06-22Fix erroneous error note when using field after moveSantiago Pastorino-8/+8
2018-06-21use `pat_ty_adjusted` from `expr_use_visitor` to type of argumentsNiko Matsakis-0/+42
2018-06-19Update the existing UI tests to reflect diagnostic changes in NLL.Felix S. Klock II-1/+1
2018-06-19NLL: Updates to diagnostic output in `test/ui`.Felix S. Klock II-3/+5
2018-06-06Update the expected error output to reflect changes in this PR.Felix S. Klock II-38/+63
2018-06-06Drive-by: Make assignment conflict tests in borrowck-vec-pattern-nesting.rs ↵Felix S. Klock II-0/+5
robust for NLL.
2018-06-05Auto merge of #51242 - ytausky:mut-ref, r=estebankbors-0/+43
Suggest not mutably borrowing a mutable reference This PR would (hopefully) solve #45392. I deviated a bit from @estebank's instructions since the error span only included the borrowed expression (e.g. the `b` in `&mut b`). I also didn't check the mutability of the local binding, since this whole case is concerned with an immutable local. I can see two outstanding questions: 1. `note_immutability_blame` is called in two places, but I only have one test case. I think it covers the call in `report_bckerror`, but I'm not sure how to trigger the call from `report_aliasability_violation`. 2. There is one failing test, where the local binding is `self: &mut Self`. I'm not entirely sure what the correct output should be, but I think the new message should also apply. Unfortunately, since this parameter is parsed differently, its `let_span` covers both the pattern and the type, leading to a wrong suggestion text. I'm not sure how to correctly identify this case.
2018-06-01Suggest not mutably borrowing a mutable referenceYaron Tausky-0/+43
This commit is concerned with the case where the user tries to mutably borrow a mutable reference, thereby triggering an error. Instead of the existing suggestion to make the binding mutable, the compiler will now suggest to avoid borrowing altogether.
2018-06-01also check `let` arms and nested patterns for mutable borrowsNiko Matsakis-0/+161
2018-05-31change `PointerKind::Implicit` to a noteNiko Matsakis-0/+52
`PointerKind` is included in `LoanPath` and hence forms part of the equality check; this led to having two unequal paths that both represent `*x`, depending on whether the `*` was inserted automatically or explicitly. Bad mojo. The `note` field, in contrast, is intended more-or-less primarily for this purpose of adding extra data.
2018-05-29rust-lang/rust#41962 has a new error with my new code. Incorporate that into ↵Felix S. Klock II-8/+16
my code. In particular, I am adding an implicit injected borrow on the pattern matches, and when we go around the loop, the compiler is reporting that this injected borrow is conflicting with the move of the original value when the match succeeds.
2018-05-25rust-lang/rust#51025: improve test robustness so that they work under NLL too.Felix S. Klock II-28/+80
2018-05-09rework causal tracking to explore outlives relationshipsNiko Matsakis-3/+12
Instead of tracking the "cause" of each bit that gets added, try to recover that by walking outlives relationships. This is currently imprecise, since it ignores the "point" where the outlives relationship is incurred -- but that's ok, since we're about to stop considering that overall in a later commit. This does seem to affect one error message negatively, I didn't dig *too* hard to find out why.
2018-04-18Removed `.nll.stderr` files that currently match their corresponding ↵Felix S. Klock II-78/+0
`.stderr` files.
2018-04-18Trivial updates to `.nll.stderr` files post-rebase, reflecting s/-Znll/nll/ ↵Felix S. Klock II-5/+5
in messages.
2018-04-18Update the previously checkpointed (but unused by bors) tests to reflect ↵Felix S. Klock II-1/+1
current reality.
2018-04-15remove -Znll -- borrowck=mir implies nll nowNiko Matsakis-27/+28
2018-04-11Checkpoint the current status of NLL on `ui` tests via compare-mode=nll.Felix S. Klock II-0/+394
2018-04-11Workaround rust-lang/rust#49855 by forcing rustc_error in any mode, ↵Felix S. Klock II-4/+4
including NLL. NOTE: I was careful to make each change in a manner that preserves the existing diagnostic output (usually by ensuring that no lines were added or removed). This means that the resulting source files are not as nice to read as they were at the start. But we will have to review these cases by hand anyway as follow-up work, so cleanup could reasonably happen then (or not at all).
2018-04-06Add test from #49736bobtwinkles-0/+49
Fixes #49736
2018-04-04two-phase borrows: support multiple activations in one statementbobtwinkles-0/+35
The need for this has arisen since the introduction of two-phase borrows on method autorefs. Fixes 49635 Fixes 49662
2018-04-03Auto merge of #49348 - bobtwinkles:extend_2pb, r=nikomatsakisbors-0/+29
Extend two-phase borrows to apply to method receiver autorefs Fixes #48598 by permitting two-phase borrows on the autorefs created when functions and methods.
2018-03-24Extend two-phase borrows to apply to method receiver autorefsbobtwinkles-0/+29
This is required to compile things like src/test/ui/borrowck/two-phase-method-receivers.rs
2018-03-20Stabilize slice patterns without `..`Vadim Petrochenkov-9/+8
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
2018-03-14update testsGuillaume Gomez-21/+21
2018-02-26Update UI testsVadim Petrochenkov-37/+37
2018-02-26Update UI testsVadim Petrochenkov-211/+211
2018-02-25Update ui testsGuillaume Gomez-0/+21
2018-02-09rustc_mir: insert a dummy access to places being matched on, when building MIR.Eduard-Mihai Burtescu-1/+19
2018-01-28Point only at method signatures and point at traitEsteban Küber-16/+12
- On mismatch between impl and trait method, point at the trait signature. - Point only at the method signature instead of the whole body on trait/impl mismatch errors.
2018-01-28For named lifetimes point only at method signatureEsteban Küber-0/+110
When refering to named lifetime conflict, point only at the method's signature span instead of the entire method. When the expected and found sup and sub traces are the same, avoid redundant text.
2018-01-19Tweak wording and spans of closure lifetime errorsEsteban Küber-15/+18
2018-01-15Move diagnostic logic to its own moduleEsteban Küber-4/+165
- Move specialized borrow checker diagnostic for bindings escaping its closure to its own module. - Move affected tests to `ui`.
2018-01-15Reword diagnosticEsteban Küber-3/+3
2018-01-15Custom error when moving arg outside of its closureEsteban Küber-0/+31
When given the following code: ```rust fn give_any<F: for<'r> FnOnce(&'r ())>(f: F) { f(&()); } fn main() { let mut x = None; give_any(|y| x = Some(y)); } ``` provide a custom error: ``` error: borrowed data cannot be moved outside of its closure --> file.rs:7:27 | 6 | let mut x = None; | ----- binding declared outside of closure 7 | give_any(|y| x = Some(y)); | --- ^ cannot be assigned to binding outside of its closure | | | closure you can't escape ``` instead of the generic lifetime error: ``` error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> file.rs:7:27 | 7 | give_any(|y| x = Some(y)); | ^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:14... --> file.rs:7:14 | 7 | give_any(|y| x = Some(y)); | ^^^^^^^^^^^^^^^ note: ...so that expression is assignable (expected &(), found &()) --> file.rs:7:27 | 7 | give_any(|y| x = Some(y)); | ^ note: but, the lifetime must be valid for the block suffix following statement 0 at 6:5... --> file.rs:6:5 | 6 | / let mut x = None; 7 | | give_any(|y| x = Some(y)); 8 | | } | |_^ note: ...so that variable is valid at time of its declaration --> file.rs:6:9 | 6 | let mut x = None; | ^^^^^ ```
2018-01-10Modify message to match labelEsteban Küber-2/+2
2018-01-07Assignment to immutable argument: diagnostic tweakEsteban Küber-0/+38
2018-01-03Tweak to mir borrow in a loop diagnosticEsteban Küber-4/+1
2018-01-03Add mir test, review commentsEsteban Küber-10/+36
2018-01-02Be ambiguous when type cannot be properly mentionedEsteban Küber-26/+34
2018-01-01Address review comments: make label shorterEsteban Küber-1/+2
2018-01-01Move reason for move to labelEsteban Küber-27/+58
2017-12-22Updated existing tests.David Wood-0/+2