Add explanatory comment to is_rvalue_or_immutable()

This commit is contained in:
Niko Matsakis 2013-05-14 09:28:58 -04:00
parent d204cfd739
commit 87398f31e5

View File

@ -170,6 +170,11 @@ impl GuaranteeLifetimeContext {
fn is_rvalue_or_immutable(&self, fn is_rvalue_or_immutable(&self,
cmt: mc::cmt) -> bool { cmt: mc::cmt) -> bool {
//! We can omit the root on an `@T` value if the location
//! that holds the box is either (1) an rvalue, in which case
//! is is in a non-user-accessible temporary, or (2) an immutable
//! lvalue.
cmt.mutbl.is_immutable() || match cmt.guarantor().cat { cmt.mutbl.is_immutable() || match cmt.guarantor().cat {
mc::cat_rvalue => true, mc::cat_rvalue => true,
_ => false _ => false