From a3d2d35fcbdc4ef5afc1fff2cc6d5ba34004cef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Tue, 3 Feb 2015 01:22:09 +0100 Subject: [PATCH] Avoid extra ref/deref cycles when converting &T to *T --- src/librustc_trans/trans/expr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index cf85389cd5b57..223db47c57132 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 to &T, etc. ty::ty_rptr(..) => {