closure captures copyable variable doesn't according capture rule #60413
Labels
A-closures
Area: closures (`|args| { .. }`)
A-lifetimes
Area: lifetime related
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
This code will success compiled.
playground
But if derived
Copy
:playground
this is very confusing.
MIR
MIR of closure is
but after derive
Copy
:playground
More examples
There is a blog article about this bug, but it is write up by Chinese.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a4cebe3ca7669755d34de340f14305fc
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=eddfdbcdfeed71b1311df6115f7484a5
Maybe related issue:
#47448 and #36569
The text was updated successfully, but these errors were encountered: