Skip to content

Conversation

@flip1995
Copy link
Member

@flip1995 flip1995 commented Nov 5, 2020

r? @ghost

changelog: none

null-sleep and others added 2 commits November 2, 2020 01:31
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: rust-lang/project-rfc-2229#20
…sakis

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: rust-lang/project-rfc-2229#20

r? `@ghost`
@flip1995
Copy link
Member Author

flip1995 commented Nov 5, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Nov 5, 2020

📌 Commit 0c1531a has been approved by flip1995

@bors
Copy link
Contributor

bors commented Nov 5, 2020

⌛ Testing commit 0c1531a with merge b20d4c1...

@bors
Copy link
Contributor

bors commented Nov 5, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing b20d4c1 to master...

@bors bors merged commit b20d4c1 into rust-lang:master Nov 5, 2020
@flip1995 flip1995 deleted the rustup branch November 5, 2020 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants