summary refs log tree commit diff
path: root/src/test/ui/borrowck
AgeCommit message (Collapse)AuthorLines
2020-03-09test(patterns): add borrowck tests for combination of pattern featuresMatthew Kuo-0/+432
Adds borrowck tests for the following features: - bindings_after_at - or_patterns - slice_patterns - box_patterns
2020-02-24parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`Vadim Petrochenkov-9/+11
2020-02-14Fix tests after rebaseMatthew Jasper-49/+68
2020-02-11Rollup merge of #68816 - estebank:fn-mut-closure, r=varkorDylan DPC-130/+170
Tweak borrow error on `FnMut` when `Fn` is expected Fix #31701, fix #66097.
2020-02-11Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPCbors-1/+1
Make issue references consistent Fixes https://github.com/rust-lang/rust/issues/62976 cc https://github.com/rust-lang/rust/pull/63008 r? @varkor because you reviewed the original pr
2020-02-09--bless --compare-mode=nllMatthias Prechtl-1/+1
2020-02-09Improve reporting errors and suggestions for trait boundsPatryk Wychowaniec-3/+7
2020-02-08review commentsEsteban Küber-6/+2
2020-02-06rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros.Eduard-Mihai Burtescu-2/+4
2020-02-06rustc: rename -Zexternal-macro-backtrace to -Zmacro-backtrace.Eduard-Mihai Burtescu-2/+2
2020-02-03Tweak borrow error on `FnMut` when `Fn` is expectedEsteban Küber-130/+174
2020-02-03Auto merge of #67668 - matthewjasper:or-patterns, r=pnkfelixbors-0/+205
Implement MIR lowering for or-patterns This is the last thing needed to get meaningful run-pass tests for or-patterns. There probably need to be more tests before stabilizing this, but the most important cases should have been covered. Note: we can generate exponentially large MIR CFGs when using or-patterns containing bindings, type ascriptions, or that are for a match arm with a guard. `src/test/mir-opt/exponential-or.rs` shows the best case for what we currently do. cc #54883 closes #60350 closes #67514 cc @Centril r? @pnkfelix
2020-02-03Add more tests for or-patternsMatthew Jasper-0/+205
2020-02-02compiletest: error if `compile-fail` header in ui test.Tyler Lanphear-14/+7
2020-01-31Auto merge of #68080 - varkor:declared-here, r=petrochenkovbors-7/+7
Address inconsistency in using "is" with "declared here" "is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout. r? @Centril
2020-01-29Fix revision annotations in borrowck-feature-nll-overrides-migrateTomasz Miąsko-2/+2
2020-01-24Update new testsvarkor-4/+4
2020-01-24Normalise notes with the/isvarkor-2/+2
2020-01-24Normalise diagnostics with respect to "the X is declared/defined here"varkor-1/+1
2020-01-18slice_patterns: address review commentsMazdak Farrokhzad-1/+0
2020-01-18slice_patterns: remove gates in testsMazdak Farrokhzad-185/+141
2020-01-09Update testsVadim Petrochenkov-3/+23
2020-01-08slice patterns: harden match-based borrowck testsMazdak Farrokhzad-0/+978
2019-12-21Rollup merge of #67467 - matthewjasper:test-slice-patterns, r=oli-obkMazdak Farrokhzad-0/+316
Test slice patterns more Adds tests for const evaluation and some more borrow checking tests. Fixes some bugs in const eval for subslice patterns. closes #66934 r? @oli-obk cc @Centril
2019-12-21Add more tests for slice patternsMatthew Jasper-0/+316
2019-12-20Rollup merge of #67314 - matthewjasper:union-move-errors, r=nikomatsakisMazdak Farrokhzad-0/+57
Don't suppress move errors for union fields closes #66500
2019-12-19Don't suppress move errors for union fieldsMatthew Jasper-0/+57
2019-12-18Add more tests for raw_ref_opMatthew Jasper-0/+268
2019-12-14Revert "Remove `#![feature(never_type)]` from tests."Niko Matsakis-0/+2
This reverts commit 8f6197f39f7d468dfc5b2bd41dae4769992a2f83.
2019-12-09Add more tests for borrowck and dropck slice pattern handlingMatthew Jasper-75/+817
2019-11-28Deduplicate type param constraint suggestion codeEsteban Küber-1/+1
2019-11-28Use structured suggestion when requiring `Copy` constraint in type paramEsteban Küber-2/+2
2019-11-26Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPCTyler Mandry-29/+5
Various tweaks to diagnostic output
2019-11-25Tweak move error due to non-CopyEsteban Küber-29/+5
2019-11-25Auto merge of #66682 - estebank:fn-type-err, r=davidtwcobors-2/+2
Highlight parts of fn in type errors When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each. Examples: <img width="699" alt="" src="https://user-images.githubusercontent.com/1606434/69487597-ab561600-0e11-11ea-9b4e-d4fd9e91d5dc.png"> <img width="528" alt="" src="https://user-images.githubusercontent.com/1606434/69487207-9033d800-0e0a-11ea-93e3-8c4d002411a5.png"> <img width="468" alt="" src="https://user-images.githubusercontent.com/1606434/69487208-9033d800-0e0a-11ea-92e3-2b2cee120335.png"> <img width="775" alt="" src="https://user-images.githubusercontent.com/1606434/69487209-9033d800-0e0a-11ea-9e68-7f6ed5c8cb08.png">
2019-11-23Highlight parts of fn in type errorsEsteban Küber-2/+2
When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each.
2019-11-21Reorganize, bless and add tests for const control flowDylan MacKenzie-2/+4
This creates a new test directory, `ui/consts/control-flow` to hold tests related to control flow in a const context. It also blesses all existing tests with the new error messages, and adds new tests for the `const_if_match` feature.
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-2/+2
Specific labels when referring to "expected" and "found" types
2019-11-21Remove `#![feature(never_type)]` from tests.Mazdak Farrokhzad-2/+0
Also remove `never_type` the feature-gate test.
2019-11-19Rollup merge of #66155 - GuillaumeGomez:long-err-explanation-E0594, r=Dylan-DPCMazdak Farrokhzad-14/+29
Add long error explanation for E0594 Part of #61137. r? @Dylan-DPC
2019-11-18Auto merge of #58281 - mark-i-m:synthesis, r=estebankbors-0/+2
Add outlives suggestions for some lifetime errors This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound: - If a and b are normal named regions, suggest to add the bound `'a: 'b` - If b is static, suggest to replace a with static - If b also needs to outlive a, they must be the same, so suggest unifying them We start with a simpler implementation that avoids diagnostic regression or implementation complexity: - We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions) - For now, we only emit a help note, not an actually suggestion because it is significantly easier. Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name. For more info, see this internals thread: https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3 TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above. r? @estebank TODO - [x] Clean up code - [x] Only make idiomatic suggestions - [x] don't suggest naming `&'a self` - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static` - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa - [x] Performance (maybe need a perf run when this is closer to the finish line?) - perf run was clean... - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress? - [x] Needs ui tests - [x] Integrate the `help` message into the main lifetime `error`
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-2/+2
2019-11-18Update ui testsGuillaume Gomez-14/+29
2019-11-13Bless const tests with improved diagnosticsDylan MacKenzie-30/+4
2019-11-13Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPCYuki Okushi-0/+1
Add long error explanation for E0623 Part of #61137. r? @Dylan-DPC
2019-11-11Evaluate borrow and struct expressions in `into`Matthew Jasper-2/+2
This fixes some ordering problems around assignment expressions.
2019-11-11Fix soundness issue with index bounds checksMatthew Jasper-0/+117
An expression like `x[1][{ x = y; 2}]` would perform the bounds check for the inner index operation before evaluating the outer index. This would allow out of bounds memory accesses.
2019-11-07Update ui testsGuillaume Gomez-0/+1
2019-11-04Use check-pass in ui tests where appropriateTomasz Miąsko-1/+1
2019-10-27update testsMark Mansi-0/+2