Rustc could be pointing out that the only thing preventing a function from being FnOnce is that it is unsafe #90073
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://godbolt.org/z/zK79rccxf
The current output is:
This error is a bit difficult, since it does not give the user the essential information:
assume_init_mut
is unsafe, and therefore cannot be turned into a Fn* trait. Ideally, the compiler would point this out, and suggest a rewrite into a closure like|x| x.assume_init_mut()
(plus or minus anunsafe {}
block as context requires).The text was updated successfully, but these errors were encountered: