Skip to content
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

Point at variable moved by closure #41523

Merged
merged 1 commit into from
Apr 28, 2017
Merged

Point at variable moved by closure #41523

merged 1 commit into from
Apr 28, 2017

Conversation

estebank
Copy link
Contributor

Fix #41482, #31752.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@GuillaumeGomez
Copy link
Member

Awesome! :D

@oli-obk
Copy link
Contributor

oli-obk commented Apr 25, 2017

Travis failed:

[00:35:33] ---- [compile-fail] compile-fail/borrowck/borrowck-in-static.rs stdout ----
[00:35:33] 	
[00:35:33] error: /checkout/src/test/compile-fail/borrowck/borrowck-in-static.rs:15: unexpected "note": 'cannot move out of captured outer variable in an `Fn` closure'
[00:35:33] 
[00:35:33] error: 1 unexpected errors found, 0 expected errors not found
[00:35:33] status: exit code: 101
[00:35:33] command: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc /checkout/src/test/compile-fail/borrowck/borrowck-in-static.rs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail --target=x86_64-unknown-linux-gnu --error-format json -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/borrowck/borrowck-in-static.stage2-x86_64-unknown-linux-gnu.compile-fail.libaux -C prefer-dynamic -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/borrowck/borrowck-in-static.stage2-x86_64-unknown-linux-gnu -Crpath -O -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers
[00:35:33] unexpected errors (from JSON output): [
[00:35:33]     Error {
[00:35:33]         line_num: 15,
[00:35:33]         kind: Some(
[00:35:33]             Note
[00:35:33]         ),
[00:35:33]         msg: "cannot move out of captured outer variable in an `Fn` closure"
[00:35:33]     }
[00:35:33] ]
[00:35:33] 
[00:35:33] thread '[compile-fail] compile-fail/borrowck/borrowck-in-static.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:1123
[00:35:33] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:35:33] 
[00:35:33] ---- [compile-fail] compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs stdout ----
[00:35:33] 	
[00:35:33] error: /checkout/src/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21: unexpected "note": 'cannot move out of captured outer variable in an `Fn` closure'
[00:35:33] 
[00:35:33] error: 1 unexpected errors found, 0 expected errors not found
[00:35:33] status: exit code: 101
[00:35:33] command: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc /checkout/src/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail --target=x86_64-unknown-linux-gnu --error-format json -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.stage2-x86_64-unknown-linux-gnu.compile-fail.libaux -C prefer-dynamic -o /checkout/obj/build/x86_64-unknown-linux-gnu/test/compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.stage2-x86_64-unknown-linux-gnu -Crpath -O -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers
[00:35:33] unexpected errors (from JSON output): [
[00:35:33]     Error {
[00:35:33]         line_num: 21,
[00:35:33]         kind: Some(
[00:35:33]             Note
[00:35:33]         ),
[00:35:33]         msg: "cannot move out of captured outer variable in an `Fn` closure"
[00:35:33]     }
[00:35:33] ]
[00:35:33] 
[00:35:33] thread '[compile-fail] compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:1123
[00:35:33] 
[00:35:33] 
[00:35:33] failures:
[00:35:33]     [compile-fail] compile-fail/borrowck/borrowck-in-static.rs
[00:35:33]     [compile-fail] compile-fail/unboxed-closures-move-upvar-from-non-once-ref-closure.rs

|
61 | foo(f);
68 | let mut f = |g: Box<FnMut(isize)>, b: isize| {};
| ----- moved
Copy link
Contributor

Choose a reason for hiding this comment

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

are these the latest outputs? if so, I can't really understand what this "moved" annotation is trying to tell me =)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would be a better text for the span? I'm considering captured outer variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see what it means. Well, that would certainly be clearer. Maybe "declaration of captured variable"?

Copy link
Contributor

Choose a reason for hiding this comment

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

(or "moved variable")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Changed to "captured outer variable" to keep the same wording as the main label (it might help ESLs be less lost with it).

@aidanhs aidanhs added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 26, 2017
@arielb1
Copy link
Contributor

arielb1 commented Apr 27, 2017

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 27, 2017

📌 Commit 1ca1483 has been approved by arielb1

@bors
Copy link
Contributor

bors commented Apr 27, 2017

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Apr 27, 2017

📌 Commit 1ca1483 has been approved by arielb1

arielb1 pushed a commit to arielb1/rust that referenced this pull request Apr 27, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Apr 27, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this pull request Apr 27, 2017
bors added a commit that referenced this pull request Apr 28, 2017
Rollup of 7 pull requests

- Successful merges: #41438, #41523, #41526, #41546, #41556, #41572, #41578
- Failed merges:
@bors bors merged commit 1ca1483 into rust-lang:master Apr 28, 2017
@tekjar
Copy link

tekjar commented Apr 29, 2017

This has been an annoying error message for quite some time. thanks @estebank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants