summary refs log tree commit diff
path: root/src/test/ui/borrowck
AgeCommit message (Collapse)AuthorLines
2022-08-03fix trailing whitespace in error messageklensy-1/+1
2022-07-31Improve `cannot move out of` error messageObei Sideg-2/+2
2022-07-19Mention first and last macro in backtraceMichael Goulet-12/+12
2022-07-15Move tests to fit in limitEsteban Küber-0/+89
2022-07-15Provide structured suggestion for dropped temp valueEsteban Küber-6/+22
2022-07-13remove untagged_union feature gateRalf Jung-25/+23
2022-07-08Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebankbors-199/+152
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
2022-07-07Wording tweakEsteban Küber-9/+11
2022-07-07Fix label on uninit binding field assignmentEsteban Küber-2/+2
2022-07-07Add test for `for` loop maybe initializing bindingEsteban Küber-0/+20
2022-07-07Review comments: wordingEsteban Küber-17/+18
2022-07-07Tweak wording and spansEsteban Küber-173/+173
2022-07-07On partial uninit error point at where we need initEsteban Küber-187/+391
When a binding is declared without a value, borrowck verifies that all codepaths have *one* assignment to them to initialize them fully. If there are any cases where a condition can be met that leaves the binding uninitialized or we attempt to initialize a field of an unitialized binding, we emit E0381. We now look at all the statements that initialize the binding, and use them to explore branching code paths that *don't* and point at them. If we find *no* potential places where an assignment to the binding might be missing, we display the spans of all the existing initializers to provide some context.
2022-07-07Fix borrowck closure span.Camille GILLOT-22/+48
2022-07-07Shorten span for closures.Camille GILLOT-187/+114
2022-07-01Shorten def_span for more items.Camille GILLOT-26/+14
2022-06-29Make RPIT and TAIT work exactly the sameOli Scherer-4/+15
2022-06-28Do not use a suggestion to change a binding's name to a typeMichael Goulet-12/+13
2022-06-28Remove redundant logic to suggest `as_ref`Michael Goulet-0/+47
2022-06-25bless after rebaseRalf Jung-0/+39
2022-06-24Auto merge of #98109 - nikomatsakis:issue-98095, r=jackh726bors-68/+5
fix universes in the NLL type tests In the NLL code, we were not accommodating universes in the `type_test` logic. Fixes #98095. r? `@compiler-errors` This breaks some tests, however, so the purpose of this branch is more explanatory and perhaps to do a crater run.
2022-06-21Move some tests to more reasonable directoriesCaio-147/+0
2022-06-16 fix one more case of trailing spaceklensy-23/+23
2022-06-16diagnostics: fix trailing spaceklensy-3/+3
2022-06-15generalize the outlives obligation codeNiko Matsakis-68/+5
The code now accepts `Binder<OutlivesPredicate>` instead of just `OutlivesPredicate` and thus exercises the new, generalized `IfEqBound` codepaths. Note though that we never *produce* Binder<OutlivesPredicate>, so we are only testing a subset of those codepaths that excludes actual higher-ranked outlives bounds.
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-9/+51
2022-06-03Fully stabilize NLLJack Huey-448/+99
2022-06-01Add regression test for #71546Yuki Okushi-0/+39
2022-05-28Add regression test for #81899Yuki Okushi-0/+30
2022-05-22Use revisions for NLL in borrowckJack Huey-26/+121
2022-05-08Move some tests to more reasonable placesCaio-0/+25
2022-05-06Resolve vars in note_type_errJack Huey-22/+0
2022-04-20Remove mutable_borrow_reservation_conflict lintJack Huey-241/+72
2022-04-08suggest adding a local for vector to fix borrowck errorsTakayuki Maeda-0/+78
2022-03-09Auto merge of #94515 - estebank:tweak-move-error, r=davidtwcobors-15/+26
Tweak move error Point at method definition that causes type to be consumed. Fix #94056.
2022-03-07Update tests after feature stabilizationEric Holk-10/+8
2022-03-06Erase regions when checking for missing Copy predicatesMichael Goulet-0/+31
2022-03-03Tweak move errorEsteban Kuber-15/+26
Point at method definition that causes type to be consumed. Fix #94056.
2022-02-12bless youDeadbeef-2/+3
2022-01-22[borrowck] Fix help on mutating &self in async fnsAlyssa Verkade-0/+26
Previously, when rustc was provided an async function that tried to mutate through a shared reference to an implicit self (as shown in the ui test), rustc would suggest modifying the parameter signature to `&mut` + the fully qualified name of the ty (in the case of the repro `S`). If a user modified their code to match the suggestion, the compiler would not accept it. This commit modifies the suggestion so that when rustc is provided the ui test that is also attached in this commit, it suggests (correctly) `&mut self`. We try to be careful about distinguishing between implicit and explicit self annotations, since the latter seem to be handled correctly already. Fixes rust-lang/rust#93093
2022-01-12Remove ui tests for LLVM-style inline assemblyTomasz Miąsko-164/+0
2021-12-28Added regression test for issue 92015chordtoll-0/+18
2021-12-10Suggest using a temporary variable to fix borrowck errorsNoah Lev-0/+170
In Rust, nesting method calls with both require `&mut` access to `self` produces a borrow-check error: error[E0499]: cannot borrow `*self` as mutable more than once at a time --> src/lib.rs:7:14 | 7 | self.foo(self.bar()); | ---------^^^^^^^^^^- | | | | | | | second mutable borrow occurs here | | first borrow later used by call | first mutable borrow occurs here That's because Rust has a left-to-right evaluation order, and the method receiver is passed first. Thus, the argument to the method cannot then mutate `self`. There's an easy solution to this error: just extract a local variable for the inner argument: let tmp = self.bar(); self.foo(tmp); However, the error doesn't give any suggestion of how to solve the problem. As a result, new users may assume that it's impossible to express their code correctly and get stuck. This commit adds a (non-structured) suggestion to extract a local variable for the inner argument to solve the error. The suggestion uses heuristics that eliminate most false positives, though there are a few false negatives (cases where the suggestion should be emitted but is not). Those other cases can be implemented in a future change.
2021-11-30Remove all migrate.nll.stderr filesLucas Kent-47/+13
2021-11-28Rollup merge of #90131 - camsteffen:fmt-args-span-fix, r=cjgillotMatthias Krüger-0/+14
Fix a format_args span to be expansion I found this while exploring solutions for rust-lang/rust-clippy#7843. r? `@m-ou-se`
2021-11-25Add test demonstrating no more ICEMichael Goulet-0/+27
2021-11-21Simplify for loop desugarCameron Steffen-3/+3
2021-11-20Point at bounds when comparing impl items to traitEsteban Kuber-2/+2
2021-11-18Move some tests to more reasonable directoriesCaio-0/+77
2021-11-16Rollup merge of #90936 - JohnTitor:issue-80772, r=Mark-SimulacrumYuki Okushi-0/+21
Add a regression test for #80772 Closes #80772