about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2015-02-03 01:22:09 +0100
committerBjörn Steinbrink <bsteinbr@gmail.com>2015-02-03 01:22:09 +0100
commita3d2d35fcbdc4ef5afc1fff2cc6d5ba34004cef4 (patch)
treee714c264f2b540df8932916c2c87e270f117e60f /src
parenteaf4c5c784637f3df8bdebc6ec21dbd4bc69420a (diff)
downloadrust-a3d2d35fcbdc4ef5afc1fff2cc6d5ba34004cef4.tar.gz
rust-a3d2d35fcbdc4ef5afc1fff2cc6d5ba34004cef4.zip
Avoid extra ref/deref cycles when converting &T to *T
Diffstat (limited to 'src')
-rw-r--r--src/librustc_trans/trans/expr.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index cf85389cd5b..223db47c571 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -194,7 +194,8 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                 // a different region or mutability, but we don't care here. It might
                 // also be just in case we need to unsize. But if there are no nested
                 // adjustments then it should be a no-op).
-                Some(ty::AutoPtr(_, _, None)) if adj.autoderefs == 1 => {
+                Some(ty::AutoPtr(_, _, None)) |
+                Some(ty::AutoUnsafe(_, None)) if adj.autoderefs == 1 => {
                     match datum.ty.sty {
                         // Don't skip a conversion from Box<T> to &T, etc.
                         ty::ty_rptr(..) => {