diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2013-05-14 09:28:58 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2013-05-14 09:28:58 -0400 |
| commit | 87398f31e5615bef744f2ac3f66c00b1a7d4959e (patch) | |
| tree | 22de0d0aebd2d0e75df2d1c7c291e3461c71c95e | |
| parent | d204cfd739bfecb6252b54c5007a28559d0f9a73 (diff) | |
| download | rust-87398f31e5615bef744f2ac3f66c00b1a7d4959e.tar.gz rust-87398f31e5615bef744f2ac3f66c00b1a7d4959e.zip | |
Add explanatory comment to is_rvalue_or_immutable()
| -rw-r--r-- | src/librustc/middle/borrowck/gather_loans/lifetime.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustc/middle/borrowck/gather_loans/lifetime.rs b/src/librustc/middle/borrowck/gather_loans/lifetime.rs index b0ddf2057d9..e01a26a1281 100644 --- a/src/librustc/middle/borrowck/gather_loans/lifetime.rs +++ b/src/librustc/middle/borrowck/gather_loans/lifetime.rs @@ -170,6 +170,11 @@ impl GuaranteeLifetimeContext { fn is_rvalue_or_immutable(&self, 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 { mc::cat_rvalue => true, _ => false |
