Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMissing drop in FnOnce adapter for closures #29946
Comments
Manishearth
added
the
A-destructors
label
Nov 22, 2015
This comment has been minimized.
This comment has been minimized.
|
cc @pnkfelix I think I've seen this before, happens with other traits as well. |
Gankro
added
the
I-nominated
label
Nov 22, 2015
eddyb
added
the
T-compiler
label
Nov 22, 2015
pnkfelix
self-assigned this
Dec 3, 2015
arielb1
added
the
I-wrong
label
Dec 3, 2015
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium |
1 similar comment
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium |
dotdash
added
the
P-medium
label
Dec 17, 2015
rust-highfive
added
P-medium
and removed
I-nominated
P-medium
labels
Dec 17, 2015
This comment has been minimized.
This comment has been minimized.
|
This appears to only happen if 1. the closure is called via a generic function, and 2. the captured variable is not explicitly moved into the closure body. If "let a = x;" is used in place of calling a borrowing method, the destructor is called. |
This comment has been minimized.
This comment has been minimized.
|
Preliminary investigation - The cause is from the closure not being treated as FnOnce when destructor calls are added to the "body" (in This is exposed when the closure is explicitly called as Routes to fixing:
|
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
I don't think the shim is used here. |
This comment has been minimized.
This comment has been minimized.
|
I'm reasonably sure it is. It is being run, and registers |
This comment has been minimized.
This comment has been minimized.
|
fcx.pop_custom_cleanup_scope(self_scope);to fcx.pop_and_trans_custom_cleanup_scope(bcx, self_scope);Leads to my test case passing. I'm running the full test suite now in preparation for a PR. |
This comment has been minimized.
This comment has been minimized.
|
trans::meth is such a hack |
thepowersgang
added a commit
to thepowersgang/rust
that referenced
this issue
Feb 7, 2016
This comment has been minimized.
This comment has been minimized.
What do you mean by that? |
thepowersgang
added a commit
to thepowersgang/rust
that referenced
this issue
Feb 7, 2016
thepowersgang
added a commit
to thepowersgang/rust
that referenced
this issue
Feb 7, 2016
This comment has been minimized.
This comment has been minimized.
|
PR with fix filed #31462 - Running full local tests at the moment, stage1 passed |
eefriedman commentedNov 20, 2015
playpen
Somehow, the Foo object leaks: my guess is that it has something to do with the way we generate code for the
FnOnce()trait for closures which also implementFn().Originally reported at #28796 (comment) .