summary refs log tree commit diff
path: root/src/test/ui/borrowck
AgeCommit message (Collapse)AuthorLines
2019-10-24Increase spacing for suggestions in diagnosticsEsteban Küber-0/+2
Make the spacing between the code snippet and verbose structured suggestions consistent with note and help messages.
2019-10-11Print lifetimes with backticksYuki Okushi-2/+2
2019-10-04Rollup merge of #64749 - matthewjasper:liveness-opt, r=nikomatsakisMazdak Farrokhzad-239/+0
Fix most remaining Polonius test differences This fixes most of the Polonius test differences and also avoids overflow in issue-38591.rs. r? @nikomatsakis
2019-10-02Calculate liveness for the same locals with and without -ZpoloniusMatthew Jasper-239/+0
This fixes some test differences and also avoids overflow in issue-38591.rs.
2019-10-01regression test for 64453 borrow check error.Felix S. Klock II-0/+58
2019-09-26add test for #53432.Mazdak Farrokhzad-0/+22
2019-09-26Adjust & --bless tests due to no longer downgrading NLL errors on 2015.Mazdak Farrokhzad-509/+20
2019-09-25Rollup merge of #64428 - GuillaumeGomez:error-explanation-E0524, r=CentrilMazdak Farrokhzad-9/+8
Error explanation e0524 Part of https://github.com/rust-lang/rust/issues/61137
2019-09-21update ui testsGuillaume Gomez-9/+8
2019-09-19Rollup merge of #64601 - grovesNL:two-backticks, r=jonas-schievinkMazdak Farrokhzad-1/+1
Fix backticks in documentation Fix a few typos in comments/documentation where backticks were doubled-up on one side.
2019-09-18Fix backticks in documentationJoshua Groves-1/+1
2019-09-17Bless output of test borrowck/return-local-binding-from-desugaring.rs for ↵lqd-0/+16
Polonius
2019-09-09Auto merge of #63118 - Centril:stabilize-bind-by-move, r=matthewjasperbors-29/+5
Stabilize `bind_by_move_pattern_guards` in Rust 1.39.0 Closes https://github.com/rust-lang/rust/issues/15287. After stabilizing `#![feature(bind_by_move_pattern_guards)]`, you can now use bind-by-move bindings in patterns and take references to those bindings in `if` guards of `match` expressions. For example, the following now becomes legal: ```rust fn main() { let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]); match array { nums // ---- `nums` is bound by move. if nums.iter().sum::<u8>() == 10 // ^------ `.iter()` implicitly takes a reference to `nums`. => { drop(nums); // --------- Legal as `nums` was bound by move and so we have ownership. } _ => unreachable!(), } } ``` r? @matthewjasper
2019-09-08Update test stderr with results of enabling unused lintsMark Rousskov-4/+4
2019-09-08Update tests wrt. bind_by_by_move_pattern_guards stabilization.Mazdak Farrokhzad-29/+5
2019-09-06Rollup merge of #64202 - alexreg:rush-pr-1, r=CentrilMazdak Farrokhzad-181/+181
Fixed grammar/style in some error messages Factored out from hacking on rustc for work on the REPL. r? @Centril
2019-09-06Refuse to downgrade NLL errors on Rust >= 2018.Mazdak Farrokhzad-10/+11
2019-09-06Fixed grammar/style in error messages and reblessed tests.Alexander Regueiro-181/+181
2019-08-24Don't unwrap the result of `span_to_snippet`Matthew Jasper-0/+45
It can return `Err` due to macros being expanded across crates or files.
2019-08-06Rollup merge of #63230 - tmandry:disallow-possibly-uninitialized, r=CentrilMazdak Farrokhzad-0/+49
Make use of possibly uninitialized data [E0381] a hard error This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see #60889, discussion at #63035), so tests are included for that. cc #54987 --- I'm not sure if bypassing the buffer is a good way of doing this. We could also make a `force_errors_buffer` or similar that gets recombined with all the errors as they are emitted. But this is simpler and seems fine to me. r? @Centril cc @cramertj @nikomatsakis @pnkfelix @RalfJung
2019-08-05Make use of possibly uninitialized data a hard errorTyler Mandry-0/+49
This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see discussion at #63035), so tests are included for that.
2019-07-30Add tests for #27282, #31287 as hard errors.Mazdak Farrokhzad-0/+50
2019-07-30borrowck-migrate-to-nll: use #38899 for testing.Mazdak Farrokhzad-30/+32
2019-07-30borrowck-mutate-in-guard: update test.Mazdak Farrokhzad-61/+8
2019-07-28Rollup merge of #63051 - estebank:borrow-ice, r=matthewjasperMazdak Farrokhzad-0/+45
Avoid ICE when referencing desugared local binding in borrow error To avoid leaking the names of local bindings from expressions like for loops, #60984 explicitly ignored them, but an assertion that `LocalKind::Var` *must* have a name would trigger an ICE. Before this change, the binding generated by desugaring the for loop would leak into the diagnostic (#63027): ``` error[E0515]: cannot return value referencing local variable `__next` --> return-local-binding-from-desugaring.rs:LL:CC | LL | for ref x in xs { | ----- `__next` is borrowed here ... LL | result | ^^^^^^ returns a value referencing data owned by the current function ``` Ideally `LocalKind` would carry more information to more accurately explain the problem, but for now, in order to avoid the ICE (fix #63026), we accept `LocalKind::Var` without a name and produce the following output: ``` error[E0515]: cannot return value referencing local binding --> $DIR/return-local-binding-from-desugaring.rs:30:5 | LL | for ref x in xs { | -- local binding introduced here ... LL | result | ^^^^^^ returns a value referencing data owned by the current function ```
2019-07-28borrowck-describe-lvalue: --bless --compare-mode=nll.Mazdak Farrokhzad-8/+8
2019-07-28--bless tests due to new subslice syntax.Mazdak Farrokhzad-22/+22
2019-07-28Use new 'p @ ..' syntax in tests.Mazdak Farrokhzad-20/+20
2019-07-27review commentsEsteban Küber-19/+34
2019-07-27Avoid ICE when referencing desugared local binding in borrow errorEsteban Küber-0/+30
2019-07-27tests: Move run-pass tests with naming conflicts to uiVadim Petrochenkov-0/+341
2019-07-27tests: Move run-pass tests without naming conflicts to uiVadim Petrochenkov-0/+709
2019-07-22Bless output of test borrowck/promote-ref-mut-in-let-issue-46557.rs for ↵lqd-0/+59
Polonius
2019-07-22Bless output of test borrowck/two-phase-surprise-no-conflict.rs for Poloniuslqd-0/+148
2019-07-22Bless output of test borrowck/borrowck-escaping-closure-error-2.rs for Poloniuslqd-0/+16
2019-07-22Ignore two-phase-reservation-sharing-interference-2.rs in Polonius compare modelqd-12/+13
This is just a difference from the test construction, it's ignore-compare-mode-nll and manually checks migrate/nll over edition2015/2018. This failure is because the `migrate2015` and `migrate2018` revisions are ran with `-Zpolonius`. There is no actual difference in the errors output by NLLs and Polonius.
2019-07-22Ignore test issue-45983 in the polonius compare modelqd-3/+4
There is no difference between the NLL and Polonius outputs, and it manually tests NLLs.
2019-07-22Ignore NLL migrate mode test in the Polonius compare-modelqd-2/+3
This is test specific to the NLL migrate mode which is irrelevant to -Z polonius. It can't currently be encoded depending on migrate-mode and NLL/Polonius mode, so the NLL compare-mode also ignores it.
2019-07-17normalize use of backticks in compiler messages for librustc/lintSamy Kacimi-3/+3
https://github.com/rust-lang/rust/issues/60532
2019-07-13Auto merge of #62468 - rust-lang:mutable-overloaded-operators, r=estebankbors-73/+95
Improve diagnostics for invalid mutation through overloaded operators Closes #58864 Closes #52941 Closes #57839
2019-07-10Rollup merge of #62465 - matthewjasper:never-type-storage, r=pnkfelixMazdak Farrokhzad-0/+14
Sometimes generate storage statements for temporaries with type `!` Closes #62165 cc #42371
2019-07-09Auto merge of #62233 - matthewjasper:exit-arm-scopes, r=pnkfelixbors-0/+21
Exit arm scopes Due to a bug in the HIR CFG construction, borrows for arm scopes were incorrectly leaking into other arms. This PR also includes some drive-by improvements to `-Zunpretty=hir,identified` that would have been helpful while investigating this. Closes #62107
2019-07-07Add help message for mutation though overloaded place operatorsMatthew Jasper-73/+95
2019-07-07Only omit StorageLive/Dead for variable that are never initializedMatthew Jasper-0/+14
With `feature(never_type)`, it's not guaranteed that any variable with type `!` isn't ever assigned to.
2019-07-06Exit arm scopes correctly in the HIR CFGMatthew Jasper-0/+21
When a match evaluates to false we jump to the next arm, when we do so we need to make sure that we exit the scope for that arm.
2019-07-06normalize use of backticks/lowercase in compiler messages for librustc_mirSamy Kacimi-2/+2
https://github.com/rust-lang/rust/issues/60532 r? @alexreg
2019-07-06Make WhileTrue into an EarlyLintPass lint.Mazdak Farrokhzad-1/+9
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-1/+1
2019-06-13Create fewer basic blocks in match MIR loweringMatthew Jasper-7/+7
2019-06-04Remove asterisk suggestion for move errors in borrowckKenny Goodin-5/+5
As per issue #54985 removes the not useful suggestion to remove asterisk in move errors. Includes minor changes to tests in the `ui` suite to account for the removed suggestion.