about summary refs log tree commit diff
path: root/src/test/ui/moves
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-2569/+0
2022-12-25Remove redundant clone suggestionEsteban Küber-20/+0
2022-12-25Create new inference contextEsteban Küber-0/+24
2022-12-23Verify receiver is of `self: Pin<&mut Self>`Esteban Küber-4/+0
2022-12-23Suggest `.clone()` on method call move errorsEsteban Küber-0/+44
2022-12-23Suggest `Pin::as_mut` when encountering borrow errorEsteban Küber-0/+57
2022-12-13Rollup merge of #105500 - oli-obk:unhide_unknown_spans, r=estebankMatthias Krüger-24/+9
Make some diagnostics not depend on the source of what they reference being available r? `@estebank` follow up to https://github.com/rust-lang/rust/pull/104449
2022-12-13Account for dereference expressionsEsteban Küber-12/+16
2022-12-13Suggest `ref` for some patterns as a fallbackEsteban Küber-4/+30
2022-12-13Change pattern borrowing suggestions to be verboseEsteban Küber-22/+44
Synthesize a more accurate span and use verbose suggestion output to make the message clearer.
2022-12-13Stop pointing to operators if their libcore method source is not availableOli Scherer-4/+1
2022-12-13Clarify what "this" meansOli Scherer-9/+9
2022-12-13Make some diagnostics not depend on the source of what they reference being ↵Oli Scherer-15/+3
available
2022-11-23Account for closuresEsteban Küber-7/+0
2022-11-23review comments: inline bindings and fix typoEsteban Küber-7/+7
2022-11-23Fix wordingEsteban Küber-7/+7
2022-11-23Tweak output in for loopsEsteban Küber-4/+0
Do not suggest `.clone()` as we already suggest borrowing the iterated value.
2022-11-23Remove logic duplicationEsteban Küber-7/+7
2022-11-23Suggest `.clone()` or `ref binding` on E0382Esteban Küber-6/+177
2022-11-05Adjust diagnostics, bless testsMichael Goulet-2/+2
2022-10-01bless ui testsMaybe Waffle-1/+1
2022-09-26fix #102087, Suggest Default::default() when binding isn't initializedyukang-0/+19
2022-09-06Shrink span for bindings with subpatterns.Camille GILLOT-6/+6
2022-07-31Improve `cannot move out of` error messageObei Sideg-1/+26
2022-07-19Mention first and last macro in backtraceMichael Goulet-1/+1
2022-07-15Auto merge of #98203 - kckeiks:gather-body-owners-in-hir-item-queries, ↵bors-14/+14
r=cjgillot gather body owners Issue #96341
2022-07-13use gathered body_owners in par_body_ownersMiguel Guarniz-14/+14
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-08Auto merge of #98482 - cjgillot:short-struct-span-closure, r=estebankbors-3/+2
Shorten def_span of closures to just their header Continuation of https://github.com/rust-lang/rust/pull/93967.
2022-07-07Tweak wording and spansEsteban Küber-11/+11
2022-07-07On partial uninit error point at where we need initEsteban Küber-16/+25
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-07Shorten span for closures.Camille GILLOT-3/+2
2022-07-01Shorten def_span for more items.Camille GILLOT-2/+2
2022-06-02On E0204 suggest missing type param boundsEsteban Küber-10/+10
``` error[E0204]: the trait `Copy` may not be implemented for this type --> f42.rs:9:17 | 9 | #[derive(Debug, Copy, Clone)] | ^^^^ 10 | pub struct AABB<K>{ 11 | pub loc: Vector2<K>, | ------------------- this field does not implement `Copy` 12 | pub size: Vector2<K> | -------------------- this field does not implement `Copy` | note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:11:5 | 11 | pub loc: Vector2<K>, | ^^^^^^^^^^^^^^^^^^^ note: the `Copy` impl for `Vector2<K>` requires that `K: Debug` --> f42.rs:12:5 | 12 | pub size: Vector2<K> | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider restricting type parameter `K` | 10 | pub struct AABB<K: Debug>{ | +++++++ ``` Fix #89137.
2022-04-30Save colon span to suggest bounds.Camille GILLOT-3/+3
2022-04-30Bless tests.Camille GILLOT-22/+22
2022-04-12Add test for `T:` suggestionsMaybe Waffle-1/+61
2022-03-28Suggest function borrow ignoring needs_noteMichael Goulet-2/+23
`needs_note` is false if we've already suggested why the type is Copy... but that has nothing to do with the diagnostic.
2022-03-28Add suggestion to borrow opaque Fn and FnMut instead of moveMichael Goulet-3/+71
2022-03-03Tweak move errorEsteban Kuber-12/+8
Point at method definition that causes type to be consumed. Fix #94056.
2022-03-01Use rustfix in copy suggestion testMaybe Waffle-25/+119
2022-03-01Add a test for Adt copy suggestionsMaybe Waffle-0/+216
2021-11-28Rollup merge of #90131 - camsteffen:fmt-args-span-fix, r=cjgillotMatthias Krüger-0/+2
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-13Sanity check for move from an uninit variable whose address is takenDylan MacKenzie-0/+23
2021-10-29Fix a format_args span to be expansionCameron Steffen-0/+2
2021-09-30Auto merge of #87998 - nneonneo:master, r=oli-obkbors-0/+132
Avoid spurious "previous iteration of loop" errors Only follow backwards edges during `get_moved_indexes` if the move path is definitely initialized at loop entry. Otherwise, the error occurred prior to the loop, so we ignore the backwards edges to avoid generating misleading "value moved here, in previous iteration of loop" errors. This patch also slightly improves the analysis of inits, including `NonPanicPathOnly` initializations (which are ignored by `drop_flag_effects::for_location_inits`). This is required for the definite initialization analysis, but may also help find certain skipped reinits in rare cases. Patch passes all non-ignored src/test/ui testcases. Fixes #72649.
2021-09-30Auto merge of #89110 - Aaron1011:adjustment-span, r=estebankbors-1/+1
Use larger span for adjustment THIR expressions Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions. These spans are recoded when we first create the adjustment during typecheck. For example, an autoref adjustment triggered by a method call will record the span of the entire method call. The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-26Remove box syntax from most places in src/test outside of the issues direst31-54/+45
2021-09-25Use larger span for adjustments on method callsAaron Hill-1/+1
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-09-15Point to closure when emitting 'cannot move out' for captured variableFabian Wolff-1/+4
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-0/+2