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 upClosure inference fails to infer that `move` is required when pattern matching #30046
Comments
nikomatsakis
added
A-typesystem
I-wrong
T-compiler
A-const-fn
labels
Nov 25, 2015
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium |
rust-highfive
added
the
P-medium
label
Nov 25, 2015
This comment has been minimized.
This comment has been minimized.
|
A-const-fn? |
This comment has been minimized.
This comment has been minimized.
|
Do you just mean the help message is wrong, or it should have automatically created a move closure? |
This comment has been minimized.
This comment has been minimized.
|
@durka neither. Normally, even for non-move closures, we infer when particular variables are used in the body and we move just those variables. For some reason, that is not triggering in this particular case. |
nagisa
referenced this issue
Jan 29, 2016
Closed
Uplifting captures to by-move is too conservative #30745
This comment has been minimized.
This comment has been minimized.
|
Might be duplicate of #26139? |
brson
added
the
E-hard
label
Aug 25, 2016
This comment has been minimized.
This comment has been minimized.
|
Related example from #26139: struct Name(String);
fn apply<F>(f: F) where
F: FnOnce() {
f()
}
fn main() {
let n = Name(String::new());
let consume = || {
let Name(i) = n;
};
apply(consume);
} |
Mark-Simulacrum
added
C-bug
and removed
I-wrong
labels
Jul 24, 2017
nikomatsakis
referenced this issue
Nov 8, 2017
Merged
adjust closure kind based on the guarantor's upvar note #45864
bors
added a commit
that referenced
this issue
Nov 12, 2017
bors
closed this
in
#45864
Nov 12, 2017
nivkner
added a commit
to nivkner/rust
that referenced
this issue
Mar 17, 2018
nivkner
added a commit
to nivkner/rust
that referenced
this issue
Mar 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nikomatsakis commentedNov 25, 2015
See this example, which fails to compile:
Error: