about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2016-01-29 15:44:16 +0100
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2016-01-29 16:13:31 +0100
commit06ef2e72c9724e89057f9d3a9ba50e1ce78da40d (patch)
tree6b2791513d3e1d4af86de7c77f915516ebffcfb1 /src
parent7bd87c1f1b8afabcf1bafa14dd13c59f00b4f4be (diff)
downloadrust-06ef2e72c9724e89057f9d3a9ba50e1ce78da40d.tar.gz
rust-06ef2e72c9724e89057f9d3a9ba50e1ce78da40d.zip
[MIR] Fix type of temporary for `box EXPR`
Previously the code would fail to dereference the temporary.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/build/expr/as_rvalue.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs
index c389e8e7330..e556d707a2d 100644
--- a/src/librustc_mir/build/expr/as_rvalue.rs
+++ b/src/librustc_mir/build/expr/as_rvalue.rs
@@ -61,16 +61,15 @@ impl<'a,'tcx> Builder<'a,'tcx> {
             }
             ExprKind::Box { value } => {
                 let value = this.hir.mirror(value);
-                let value_ty = value.ty.clone();
-                let result = this.temp(value_ty.clone());
+                let result = this.temp(expr.ty);
 
                 // to start, malloc some memory of suitable type (thus far, uninitialized):
-                let rvalue = Rvalue::Box(value.ty.clone());
+                let rvalue = Rvalue::Box(value.ty);
                 this.cfg.push_assign(block, expr_span, &result, rvalue);
 
                 // schedule a shallow free of that memory, lest we unwind:
                 let extent = this.extent_of_innermost_scope();
-                this.schedule_drop(expr_span, extent, DropKind::Free, &result, value_ty);
+                this.schedule_drop(expr_span, extent, DropKind::Free, &result, value.ty);
 
                 // initialize the box contents:
                 let contents = result.clone().deref();