Is reborrowing documented anywhere?


#1

An important bit to understand when writing Rust code is that passing &'a mut around often inserts automatic reborrows, like &mut *x, which allows to “shorten” a unique lifetime and can easy be confused with variance.

Is this behavior documented anywhere?


#2

Basically not. It’s mentioned offhand in the reference but not really documented well.


#3

There was a bit of an attempt as part of RFC 2364, which was postponed because the language team feels it would be better to do it after MIR borrowck, NLL, and Chalk are complete.

Old versions of the Rustonomicon had a brief description of reborrowing in the References chapter.