Open Pegasust opened 2 years ago
Perhaps there should be a clippy lint for having the same condition multiple times.
I just stubled over the same issue, albeit with two mutable borrows, which leads to a different error message.
In my view, the compiler should be able to prove that the logic in no_compile_main()
is equivalent to the logic in main()
and thus permit the code.
Given the following code:
The current output is:
Ideally the output should look like:
The problem still exists in the beta and nightly versions. Illustrated code in Godbolt for different versions