在"引用与借用"小结中,最后一段总结了语义优化。

作者: zjbanya创建于 2026年4月29日更新于 2026年4月29日

Summary of borrowing rules

In general, the borrowing rules are as follows:

  • At any given moment, you can have either one mutable reference or any number of immutable references that coexist, but not both at the same time.
  • References must always be valid (not dangling).

内容来源: sunface/rust-course