diff options
| author | Dhruv Jauhar <dhruvjhr@gmail.com> | 2020-11-01 02:15:22 -0500 |
|---|---|---|
| committer | Dhruv Jauhar <dhruvjhr@gmail.com> | 2020-11-02 01:31:34 -0500 |
| commit | 1f53754236b654d3a4edbf5cb28cfe24f4e3fe26 (patch) | |
| tree | 4dbfd52efabdcc2eeb5b08375494f9b5137d6947 /src/test | |
| parent | c4fe25d8613a32dcd71e5258c22ff5685f12d4c3 (diff) | |
Provide diagnostic suggestion in ExprUseVisitor Delegate
The [Delegate trait](https://github.com/rust-lang/rust/blob/981346fc07dd5ef414c5b1b21999f7604cece006/compiler/rustc_typeck/src/expr_use_visitor.rs#L28-L38) currently use `PlaceWithHirId` which is composed of Hir `Place` and the corresponding expression id. Even though this is an accurate way of expressing how a Place is used, it can cause confusion during diagnostics. Eg: ``` let arr : [String; 5]; let [a, ...] = arr; ^^^ E1 ^^^ = ^^E2^^ ``` Here `arr` is moved because of the binding created E1. However, when we point to E1 in diagnostics with the message `arr` was moved, it can be confusing. Rather we would like to report E2 to the user. Closes: https://github.com/rust-lang/project-rfc-2229/issues/20
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr b/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr index 7f6c764ec22..9e1e47a9241 100644 --- a/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr +++ b/src/test/ui/borrowck/borrowck-closures-slice-patterns.stderr @@ -75,7 +75,7 @@ LL | fn arr_box_by_move(x: Box<[String; 3]>) { LL | let f = || { | -- value moved into closure here LL | let [y, z @ ..] = *x; - | - variable moved due to use in closure + | -- variable moved due to use in closure LL | }; LL | &x; | ^^ value borrowed here after move |
