Why does Visual Studio Code show inlay hints using &* for &str type?

vscode show

Why the use of &* for inlay hints?

I am trying to understand dereferencing, but why does the IDE do it like this?

>Solution :

These are inlay hints for "reborrows". When executing this piece of code, the compiler inserts a &* (called reborrow) there, and rust-analyzer shows that to you. It can be controlled via the setting rust-analyzer.inlayHints.expressionAdjustmentHints.enable.

Leave a Reply