Closed
Description
I tried this code:
fn main() {
if true {
1
} else {
&1
};
}
I expected to see this happen: I expected that the help text would give syntactically correct code, or that there would be no help text.
Instead, this happened:
help: consider dereferencing the borrow
|
4 | } else *{
5 | &1
6 | };
|
The provided code snippet is not valid - it tries to deference the else-block, which is impossible. Better would be to put the *
inside the else-block.
Meta
rustc --version --verbose
:
rustc 1.52.0-nightly (83b30a639 2021-02-20)
binary: rustc
commit-hash: 83b30a639d5abd1270ade35d9bd92271f5a5ba18
commit-date: 2021-02-20
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1
Also occurs on stable, 1.50.0.