Skip to content

Commit 1b2c088

Browse files
committed
---
yaml --- r: 282029 b: refs/heads/stable c: 92e4858 h: refs/heads/master i: 282027: c015578
1 parent a513dc3 commit 1b2c088

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 3c795e08d6f4a532f12f3f8e1837db5e0647f8b0
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: eb43d952118f8d33e221c00f71a343f32ce17655
32+
refs/heads/stable: 92e485874e668fdc21855e0a288f526161576070
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc_trans/trans/mir/constant.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use trans::abi;
1717
use trans::common::{self, BlockAndBuilder, C_bool, C_bytes, C_floating_f64, C_integral,
1818
C_str_slice, C_undef};
1919
use trans::consts;
20+
use trans::datum;
2021
use trans::expr;
2122
use trans::inline;
2223
use trans::type_of;
@@ -122,7 +123,18 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
122123
let d = bcx.with_block(|bcx| {
123124
expr::trans(bcx, expr)
124125
});
125-
OperandRef::from_rvalue_datum(d.datum.to_rvalue_datum(d.bcx, "").datum)
126+
127+
let datum = d.datum.to_rvalue_datum(d.bcx, "").datum;
128+
129+
match datum.kind.mode {
130+
datum::RvalueMode::ByValue => {
131+
OperandRef {
132+
ty: datum.ty,
133+
val: OperandValue::Immediate(datum.val)
134+
}
135+
}
136+
datum::RvalueMode::ByRef => self.trans_load(bcx, datum.val, datum.ty)
137+
}
126138
}
127139
mir::Literal::Value { ref value } => {
128140
self.trans_constval(bcx, value, ty)

branches/stable/src/librustc_trans/trans/mir/operand.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,6 @@ impl<'tcx> OperandRef<'tcx> {
8181
_ => unreachable!()
8282
}
8383
}
84-
85-
pub fn from_rvalue_datum(datum: datum::Datum<'tcx, datum::Rvalue>) -> OperandRef {
86-
OperandRef {
87-
ty: datum.ty,
88-
val: match datum.kind.mode {
89-
datum::RvalueMode::ByRef => OperandValue::Ref(datum.val),
90-
datum::RvalueMode::ByValue => OperandValue::Immediate(datum.val),
91-
}
92-
}
93-
}
9484
}
9585

9686
impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {

0 commit comments

Comments
 (0)