Skip to content

Reword reason for move note #47124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 4, 2018
Merged

Reword reason for move note #47124

merged 5 commits into from
Jan 4, 2018

Conversation

estebank
Copy link
Contributor

@estebank estebank commented Jan 2, 2018

On move errors, when encountering an enum variant, be more ambiguous and do not refer to the type on the cause note, to avoid referring to (maybe as std::prelude::v1::Some).0, and instead refer to the value.

Sidesteps part of the problem with #41962:

error[E0382]: use of partially moved value: `maybe`
 --> file.rs:5:30
  |
5 |         if let Some(thing) = maybe {
  |                     -----    ^^^^^ value used here after move
  |                     |
  |                     value moved here
  = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0`
 --> file.rs:5:21
  |
5 |         if let Some(thing) = maybe {
  |                     ^^^^^ value moved here in previous iteration of loop
  = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

error: aborting due to 2 previous errors

Previous discussion: #44360

r? @arielb1

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 2, 2018
@estebank estebank force-pushed the loan-paths branch 10 times, most recently from 503bdc3 to 65ac7e8 Compare January 2, 2018 23:30
@estebank estebank changed the title Move reason for move to label Reword reason for move note Jan 3, 2018
@estebank estebank force-pushed the loan-paths branch 2 times, most recently from 89c1e15 to ce930bb Compare January 3, 2018 01:47
@@ -346,6 +346,16 @@ impl<'tcx> LoanPath<'tcx> {
}

fn to_type(&self) -> Ty<'tcx> { self.ty }

fn is_downcast(&self) -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe call this has_downcast? Also, we should try this out with the MIR borrowck.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me after those changes

@nikomatsakis
Copy link
Contributor

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned arielb1 Jan 3, 2018
@estebank
Copy link
Contributor Author

estebank commented Jan 3, 2018

@bors r=nikomatsakis

@bors
Copy link
Collaborator

bors commented Jan 3, 2018

📌 Commit a4d46b3 has been approved by nikomatsakis

@estebank estebank added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 4, 2018
@bors
Copy link
Collaborator

bors commented Jan 4, 2018

⌛ Testing commit a4d46b3 with merge 681c86ad0f7ce4158656a312031b47151ff87c24...

@bors
Copy link
Collaborator

bors commented Jan 4, 2018

💔 Test failed - status-appveyor

@estebank
Copy link
Contributor Author

estebank commented Jan 4, 2018

@bors retry

failures:
---- [debuginfo-gdb] debuginfo\limited-debuginfo.rs stdout ----
	NOTE: compiletest thinks it is using GDB without native rust support
NOTE: compiletest thinks it is using GDB version 7010001
error: gdb failed to execute
status: exit code: 1816

@bors
Copy link
Collaborator

bors commented Jan 4, 2018

⌛ Testing commit a4d46b3 with merge 78f24d8...

bors added a commit that referenced this pull request Jan 4, 2018
Reword reason for move note

On move errors, when encountering an enum variant, be more ambiguous and do not refer to the type on the cause note, to avoid referring to `(maybe as std::prelude::v1::Some).0`, and instead refer to `the value`.

Sidesteps part of the problem with #41962:

```
error[E0382]: use of partially moved value: `maybe`
 --> file.rs:5:30
  |
5 |         if let Some(thing) = maybe {
  |                     -----    ^^^^^ value used here after move
  |                     |
  |                     value moved here
  = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

error[E0382]: use of moved value: `(maybe as std::prelude::v1::Some).0`
 --> file.rs:5:21
  |
5 |         if let Some(thing) = maybe {
  |                     ^^^^^ value moved here in previous iteration of loop
  = note: move occurs because the value has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait

error: aborting due to 2 previous errors
```

Previous discussion: #44360

r? @arielb1
@bors
Copy link
Collaborator

bors commented Jan 4, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 78f24d8 to master...

@bors bors merged commit a4d46b3 into rust-lang:master Jan 4, 2018
@estebank estebank deleted the loan-paths branch November 9, 2023 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants