-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Closure inference fails to infer that move
is required when pattern matching
#30046
Labels
A-const-eval
Area: Constant evaluation, covers all const contexts (static, const fn, ...)
A-type-system
Area: Type system
C-bug
Category: This is a bug.
E-hard
Call for participation: Hard difficulty. Experience needed to fix: A lot.
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
nikomatsakis
added
A-type-system
Area: Type system
I-wrong
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Nov 25, 2015
triage: P-medium |
A-const-fn? |
Do you just mean the help message is wrong, or it should have automatically created a move closure? |
@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. |
Might be duplicate of #26139? |
brson
added
the
E-hard
Call for participation: Hard difficulty. Experience needed to fix: A lot.
label
Aug 25, 2016
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);
} |
nivkner
added a commit
to nivkner/rust
that referenced
this issue
Mar 17, 2018
RalfJung
added
the
A-const-eval
Area: Constant evaluation, covers all const contexts (static, const fn, ...)
label
Dec 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-const-eval
Area: Constant evaluation, covers all const contexts (static, const fn, ...)
A-type-system
Area: Type system
C-bug
Category: This is a bug.
E-hard
Call for participation: Hard difficulty. Experience needed to fix: A lot.
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
See this example, which fails to compile:
Error:
The text was updated successfully, but these errors were encountered: